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.12.z] ui_session: return airgun session as a context manager #15156

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.12.z Introduced in or relating directly to Satellite 6.12 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: 7088
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/ -m e2e --external-logging
Test Result : = 11 failed, 1 passed, 784 deselected, 1634 warnings, 1 error in 5292.28s (1:28:12) =

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label May 23, 2024
@pnovotny
Copy link
Contributor

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

@Gauravtalreja1 Gauravtalreja1 merged commit a2c5534 into 6.12.z May 29, 2024
25 of 28 checks passed
@Gauravtalreja1 Gauravtalreja1 deleted the cherry-pick-6.12.z-2618e01768c22921302da9dc3841809bd74e840b branch May 29, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.12.z Introduced in or relating directly to Satellite 6.12 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