Refactor Hooks setup methods to enhance clarity.
Separated context initialization and Android framework setup into distinct methods. Adjusted method ordering and logging to streamline scenario handling and improve readability. This ensures better modularity and maintainability of setup processes.
This commit is contained in:
1 parent
7f02be26cd
commit
b7d3179749
1 file changed
+14
-5
@@ -11,15 +11,26 @@ import org.openqa.selenium.chrome.ChromeOptions;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static frameworkContext.ContextFactory.getContext;
|
||||
import static frameworkContext.ContextFactory.instantiateContextObject;
|
||||
|
||||
@Slf4j
|
||||
public class Hooks {
|
||||
|
||||
@Before
|
||||
public void setup(Scenario scenario) {
|
||||
@Before(order = 1)
|
||||
public void setupContext() {
|
||||
instantiateContextObject();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setupFrameworkForAndroid(Scenario scenario) {
|
||||
setup();
|
||||
getContext().setScenario(scenario);
|
||||
|
||||
log.info("Start scenario: {}", scenario.getName());
|
||||
}
|
||||
|
||||
public void setup() {
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--incognito");
|
||||
options.addArguments("--lang=pl");
|
||||
@@ -27,15 +38,13 @@ public class Hooks {
|
||||
|
||||
Configuration.browser = "chrome";
|
||||
Configuration.timeout = TimeUnit.SECONDS.toMillis(30);
|
||||
;
|
||||
|
||||
Configuration.pollingInterval = 500;
|
||||
Configuration.browserSize = "1920x1200";
|
||||
Configuration.headless = false;
|
||||
Configuration.screenshots = true;
|
||||
|
||||
Configuration.reportsFolder = "target/screenshots/";
|
||||
|
||||
log.info("Start scenario: {}", scenario.getName());
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
Reference in new issue
Block a user