local run fixes
This commit is contained in:
parent
deaa4555fa
commit
24fbd1631c
3 changed files with 19 additions and 12 deletions
|
@ -1 +1,3 @@
|
|||
USE_LOCAL_BROWSER=false
|
||||
USE_LOCAL_BROWSER=true
|
||||
SHOULD_START_SELENOID=false
|
||||
TURN_OFF_SCREENSHOTS=true
|
|
@ -48,16 +48,10 @@ public class BaseTest {
|
|||
|
||||
static {
|
||||
Dotenv.load().entries().forEach(env -> System.setProperty(env.getKey(), env.getValue()));
|
||||
if (TestConfiguration.CLEAR_REPORTS_DIR) clearReports();
|
||||
String remote = TestConfiguration.SELENOID_URL;
|
||||
if (TestConfiguration.SHOULD_START_SELENOID) {
|
||||
selenoid.start();
|
||||
remote =
|
||||
"http://%s:%s/wd/hub"
|
||||
.formatted(selenoid.getContainerIpAddress(), selenoid.getMappedPort(4444));
|
||||
if (TestConfiguration.CLEAR_REPORTS_DIR) {
|
||||
clearReports();
|
||||
}
|
||||
setupSelenoid(remote);
|
||||
SelenideLogger.addListener("allure", new AllureSelenide().savePageSource(false));
|
||||
setupSelenoid();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
|
@ -67,10 +61,19 @@ public class BaseTest {
|
|||
}
|
||||
|
||||
@SneakyThrows
|
||||
private static void setupSelenoid(String remote) {
|
||||
private static void setupSelenoid() {
|
||||
String remote = TestConfiguration.SELENOID_URL;
|
||||
if (TestConfiguration.SHOULD_START_SELENOID) {
|
||||
selenoid.start();
|
||||
remote =
|
||||
"http://%s:%s/wd/hub"
|
||||
.formatted(selenoid.getContainerIpAddress(), selenoid.getMappedPort(4444));
|
||||
}
|
||||
|
||||
Configuration.reportsFolder = TestConfiguration.REPORTS_FOLDER;
|
||||
if (!TestConfiguration.USE_LOCAL_BROWSER) {
|
||||
Configuration.remote = remote;
|
||||
TestConfiguration.BASE_URL = TestConfiguration.BASE_URL.replace("localhost", "host.docker.internal");
|
||||
}
|
||||
Configuration.screenshots = TestConfiguration.SCREENSHOTS;
|
||||
Configuration.savePageSource = TestConfiguration.SAVE_PAGE_SOURCE;
|
||||
|
@ -81,6 +84,8 @@ public class BaseTest {
|
|||
var capabilities = new DesiredCapabilities();
|
||||
capabilities.setCapability("enableVNC", TestConfiguration.ENABLE_VNC);
|
||||
Configuration.browserCapabilities = capabilities;
|
||||
|
||||
SelenideLogger.addListener("allure", new AllureSelenide().savePageSource(false));
|
||||
}
|
||||
|
||||
public static void clearReports() {
|
||||
|
|
|
@ -7,7 +7,7 @@ public class TestConfiguration {
|
|||
public static boolean SHOULD_START_SELENOID =
|
||||
Boolean.parseBoolean(System.getProperty("SHOULD_START_SELENOID", "false"));
|
||||
|
||||
public static String BASE_URL = System.getProperty("BASE_URL", "http://192.168.1.2:8080/");
|
||||
public static String BASE_URL = System.getProperty("BASE_URL", "http://localhost:8080/");
|
||||
|
||||
public static boolean USE_LOCAL_BROWSER =
|
||||
Boolean.parseBoolean(System.getProperty("USE_LOCAL_BROWSER", "true"));
|
||||
|
|
Loading…
Add table
Reference in a new issue