Project

General

Profile

action #120022

Updated by JERiveraMoya over 1 year ago

#### Motivation 
 Once Yam squad is starting progressively In order to rewrite some YaST modules test cases with libyui-rest-api and apply a good design to them, like in this PR: https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/15496 
 capture screen before / after libyui control level api, we still need to improve how each step is visualized, we can see that the screenshot we provide is not in sync with the action: 
 https://openqa.opensuse.org/tests/2857887#step/yast2_firewall_stop_service/5 
 Wrapping the method, add decorator for example like this `wait_screen_change(sub { $testapi::distri->get_firewall()->start_firewall() } );` 
 See Draft PR: https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/15844/files#diff-8fc5ca29998de81bd0c818e44236ad9c51cc838bafc7429a1f30d83e43acbc3dR23 
 we can achieve: https://openqa.opensuse.org/tests/2857895#step/yast2_firewall_stop_service/8 libyui api. 

 The goal is to find a solution, perhaps decorator pattern in Perl or some sort of wrapping which is flexible and decoupled from the other layers. AC: Simple solution for capture screen for each libyui api. 

 One simple spike by jknphy: 
 Therefore in the example above we still run `$testapi::distri->get_firewall()->start_firewall()` but behind the scene the other actions will take place. But those actions should be assigned from outside, so Controller layer can have some variable to store and execute it, but doesn't know anything about testapi.pm. https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/15844/files 

 **AC1**: Define a wrapper/decorator for some methods of the Controller 
 **AC2**: Being able to have other Controller methods not decorated

Back