com.github.siwenyan.superglue.AbstractStepSet Maven / Gradle / Ivy
package com.github.siwenyan.superglue;
import com.github.siwenyan.common.ScenarioLogger;
import com.github.siwenyan.pickle.GlueManager;
import cucumber.api.Scenario;
import org.apache.log4j.Logger;
import org.openqa.selenium.WebDriver;
public class AbstractStepSet {
protected final Logger logger;
protected final ScenarioLogger scenarioLogger;
private Scenario scenario;
private WebDriver webDriver;
private String owner;
public AbstractStepSet(Scenario scenario, WebDriver webDriver) {
this.logger = Logger.getLogger(this.getClass());
this.scenarioLogger = new ScenarioLogger(scenario, logger, webDriver);
this.setScenario(scenario);
this.setDriver(webDriver);
}
//
//Get the Scenario
//
//@return
//
public Scenario scenario() {
GlueManager.immediateAbortCheck(scenario);
return this.scenario;
}
//
//Get the Scenario
//
//@return
//
public void setScenario(Scenario scenario) {
this.scenario = scenario;
this.owner = scenario.getId();
}
//
//Get the WebDriver
//
//@return
//
public WebDriver driver() {
GlueManager.immediateAbortCheck(scenario);
return this.webDriver;
}
//
//Set the WebDriver
//
//@param webDriver
//
protected void setDriver(WebDriver webDriver) {
GlueManager.immediateAbortCheck(scenario);
this.scenarioLogger.setDriver(webDriver);
this.webDriver = webDriver;
}
//
//Get the owner
//
//@return
//
public String getOwner() {
GlueManager.immediateAbortCheck(scenario);
return this.owner;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy