Skip to content

Commit

Permalink
Merge pull request #84 from Sprokof/update-baseTest
Browse files Browse the repository at this point in the history
Update base test
  • Loading branch information
devondragon authored May 8, 2024
2 parents 3a4c2e7 + 201f994 commit 14ff9fd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/test/java/ui/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,29 @@
import org.junit.jupiter.api.BeforeEach;

public abstract class BaseTest {
private Driver driver;

public enum Driver {
CHROME("chrome"),
OPERA("opera"),
FIREFOX("firefox"),
EDGE("edge");

private final String browser;

Driver(String browser) {
this.browser = browser;
}
}

public void setUp() {
WebDriverManager.chromedriver().setup();
Configuration.browser = "chrome";
switch (this.driver) {
case CHROME -> WebDriverManager.chromedriver().setup();
case OPERA -> WebDriverManager.operadriver().setup();
case FIREFOX -> WebDriverManager.firefoxdriver().setup();
case EDGE -> WebDriverManager.edgedriver().setup();
}
Configuration.browser = driver.browser;
Configuration.browserSize = "2560x1440";
Configuration.webdriverLogsEnabled = true;
Configuration.headless = false;
Expand All @@ -26,4 +45,9 @@ public void tearDown() {
Selenide.closeWebDriver();
}

void setDriver(Driver driver) {
this.driver = driver;
}


}
4 changes: 4 additions & 0 deletions src/test/java/ui/SpringUserFrameworkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public class SpringUserFrameworkTest extends BaseTest {

private static final UserDto testUser = UiTestData.getUserDto();

{
super.setDriver(Driver.CHROME);
}

@AfterEach
public void deleteTestUser() {
Jdbc.deleteTestUser(testUser);
Expand Down

0 comments on commit 14ff9fd

Please sign in to comment.