robottelo
robottelo copied to clipboard
ui_session: return airgun session as a context manager
Problem Statement
If a UI test is using the new session approach via target_sat.ui_session()
,
the browser window is not closed at the end of the test.
Also the screenshot is not taken if the test fails.
Solution
Satellite.ui_session()
method needs to return the airgun Session
as a context manager,
so the __exit__
method is called, which handles screenshot capture and closing the browser window.