Skip to content
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

[6.13.z] ui_session: return airgun session as a context manager #15154

Conversation

Satellite-QE
Copy link
Collaborator

Cherrypick of PR: #15050

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.

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)
@Satellite-QE Satellite-QE added 6.13.z Introduced in or relating directly to Satellite 6.13 Auto_Cherry_Picked Automatically cherrypicked PR using GHA No-CherryPick PR doesnt need CherryPick to previous branches labels May 23, 2024
@Satellite-QE
Copy link
Collaborator Author

trigger: test-robottelo
pytest: tests/foreman/ui/ -m e2e
airgun: 1390

@Satellite-QE Satellite-QE added the AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing label May 23, 2024
@Satellite-QE
Copy link
Collaborator Author

PRT Result

Build Number: 7090
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/ -m e2e --external-logging
Test Result : = 21 failed, 1 passed, 622 deselected, 1894 warnings, 2 errors in 7233.82s (2:00:33) =

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label May 23, 2024
@pnovotny pnovotny requested a review from omkarkhatavkar May 23, 2024 20:56
@pnovotny
Copy link
Contributor

I've investigated the PRT failures and none is relevant to this patch.

@Gauravtalreja1 Gauravtalreja1 merged commit e68fa97 into 6.13.z May 29, 2024
15 of 18 checks passed
@Gauravtalreja1 Gauravtalreja1 deleted the cherry-pick-6.13.z-2618e01768c22921302da9dc3841809bd74e840b branch May 29, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.13.z Introduced in or relating directly to Satellite 6.13 Auto_Cherry_Picked Automatically cherrypicked PR using GHA AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing No-CherryPick PR doesnt need CherryPick to previous branches PRT-Failed Indicates that latest PRT run is failed for the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants