-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui_session: return airgun session as a context manager #15050
ui_session: return airgun session as a context manager #15050
Conversation
In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant.
trigger: test-robottelo |
PRT Result
|
The test It is using
Also the test session video recording shows it takes 40s (session 24fe1fd0680d15575fcf6ecce53e71e2). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! This seems to be the solution to those hanging sessions (before they finally time out).
It's a really important patch if true.
LGTM
trigger: test-robottelo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRT Result
|
@pnovotny I saw some failures on the PRT job related to
|
@pnovotny did you get chance to look into those failures ? |
Yes, thanks @omkarkhatavkar for raising the issue with the session ID exceptions. |
trigger: test-robottelo |
PRT Result
|
trigger: test-robottelo |
trigger: test-robottelo |
PRT Result
|
@pnovotny I reviewed the failures and they do not appear to be specifically related to this PR. Overall, everything looks good to me. |
In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant. (cherry picked from commit 2618e01)
In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant. (cherry picked from commit 2618e01)
In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant. (cherry picked from commit 2618e01)
In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant. (cherry picked from commit 2618e01)
@omkarkhatavkar thank you for checking the test results. |
ui_session: return airgun session as a context manager (#15050) In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant. (cherry picked from commit 2618e01) Co-authored-by: Pavel Novotny <[email protected]>
ui_session: return airgun session as a context manager (#15050) In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant. (cherry picked from commit 2618e01) Co-authored-by: Pavel Novotny <[email protected]>
ui_session: return airgun session as a context manager (#15050) In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant. (cherry picked from commit 2618e01) Co-authored-by: Pavel Novotny <[email protected]>
ui_session: return airgun session as a context manager (#15050) In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant. (cherry picked from commit 2618e01) Co-authored-by: Pavel Novotny <[email protected]>
…5050) In `Satellite.ui_session()` context manager method, `airgun.session.Session()` is also a context manager and needs to be returned using the `with-yield` contruct, so the Session's `__enter__` and `__exit__` methods are executed. This fixes the problem where `Session.__exit__()` method was not called and thus screenshot was not taken and the browser window was not closed at the end of the test. Also the `except Exception: raise` part was removed as redundant.
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 airgunSession
as a context manager,so the
__exit__
method is called, which handles screenshot capture and closing the browser window.