All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.magentys.cinnamon.webdriver.events.handlers.QuitBrowserSession Maven / Gradle / Ivy

package io.magentys.cinnamon.webdriver.events.handlers;

import com.google.common.eventbus.Subscribe;
import io.magentys.cinnamon.events.TestCaseFinishedEvent;
import io.magentys.cinnamon.events.TestSuiteFinishedEvent;
import io.magentys.cinnamon.webdriver.WebDriverContainer;

public class QuitBrowserSession {

    private final WebDriverContainer webDriverContainer;

    public QuitBrowserSession(final WebDriverContainer webDriverContainer) {
        this.webDriverContainer = webDriverContainer;
    }

    @Subscribe
    public void handleEvent(final TestCaseFinishedEvent event) {
        if (!webDriverContainer.reuseBrowserSession()) {
            webDriverContainer.quitWebDriver();
        }
    }

    @Subscribe
    public void handleEvent(final TestSuiteFinishedEvent event) {
        webDriverContainer.quitWebDriver();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy