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

Assumption in tests prevents browser to be closed #1659

Open
mcollovati opened this issue Aug 8, 2023 · 0 comments
Open

Assumption in tests prevents browser to be closed #1659

mcollovati opened this issue Aug 8, 2023 · 0 comments
Labels

Comments

@mcollovati
Copy link
Contributor

If a JUnit 5 test (based on BrowserTestBase) that opens a browser window contains an assumption that aborts the execution, the browser window will not be closed automatically.

For example, running will leave the browser open.

public class BrowseNotClosedTest extends BrowserTestBase {

    @BeforeEach
    public void setup() throws Exception {
        getDriver().get("http://localhost:8080/");
    }

    @BrowserTest
    void skipWithAssumption_browserWindowNotClosed() {
        Assumptions.assumeTrue(false, "Skipped with assumption");
    }

}

For BrowserTestBase test classes, the WebDriver is usually closed by the ScreenshotOnFailureExtension extension.
However, that class does not implement the testAborted().

Implementing testAborted() and calling quitDriverOnFinish() should fix the issue.
Consider also if it is worth it take the screenshot also for the aborted test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🔖 Normal Priority (P2)
Development

No branches or pull requests

1 participant