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.14.z] browser teardown fix at session exit #1415

Conversation

Satellite-QE
Copy link
Contributor

Cherrypick of PR: #1413

Cherrypick of PR: #1390

Problem Statement

When nesting airgun.session.Session in multiple context managers (like robottelo session fixture does),
the __exit__ method, which handles browser teardown, is called mutliple times as well.

This causes that the second and further attempt to call webdriver.quit() will fail,
because the browser was already closed.

Solution

Execute the browser teardown only once.

Related Issues

Needed for SatelliteQE/robottelo#15050

The browser teardown in `airgun.session.Session.__exit__` should be executed only once.

Because when `Session` is nested in multiple context managers(*),
the `__exit__` method is called for each one
and this causes that the second and further `webdriver.quit()` call will fail,
because the browser session was already stopped.

(*) for example in the robottelo `session` fixture in `robottelo/pytest_fixtures/core/ui.py`.

(cherry picked from commit 6b6423e)
@Satellite-QE Satellite-QE added 6.14.z Auto_Cherry_Picked GHA has automatically cherrypicked this PR No-CherryPick PR doesnt need CherryPick to previous branches labels Jun 3, 2024
@Satellite-QE Satellite-QE added the AutoMerge_Cherry_Picked Automatically merge the PR is PRT and all checks are passing label Jun 3, 2024
@pnovotny pnovotny changed the title [6.14.z] [6.15.z] browser teardown fix at session exit [6.14.z] browser teardown fix at session exit Jun 3, 2024
@omkarkhatavkar omkarkhatavkar merged commit df39d37 into 6.14.z Jun 3, 2024
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.14.z Auto_Cherry_Picked GHA has automatically cherrypicked this PR AutoMerge_Cherry_Picked Automatically merge the PR is PRT and all checks are passing No-CherryPick PR doesnt need CherryPick to previous branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants