mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Replaced System.getProperty with System.getenv calls in Tests
This commit is contained in:
parent
d91f4bae35
commit
1225902347
@ -47,11 +47,12 @@ public class SeleniumExtension implements ParameterResolver, BeforeAllCallback,
|
||||
Assume.assumeNotNull("rules.SeleniumDriver: Chrome driver location not specified for this OS type", driverLocation);
|
||||
Assume.assumeTrue("rules.SeleniumDriver: Chrome driver not found at " + driverLocation, new File(driverLocation).exists());
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", driverLocation);
|
||||
driver = getChromeWebDriver();
|
||||
}
|
||||
|
||||
private WebDriver getChromeWebDriver() {
|
||||
if (Boolean.parseBoolean(System.getProperty(CIProperties.IS_TRAVIS))) {
|
||||
if (Boolean.parseBoolean(System.getenv(CIProperties.IS_TRAVIS))) {
|
||||
ChromeOptions chromeOptions = new ChromeOptions();
|
||||
chromeOptions.setBinary("/usr/bin/google-chrome-stable");
|
||||
chromeOptions.setHeadless(true);
|
||||
@ -65,11 +66,9 @@ public class SeleniumExtension implements ParameterResolver, BeforeAllCallback,
|
||||
|
||||
private String getChromeDriverLocation() {
|
||||
if (SystemUtils.IS_OS_WINDOWS) {
|
||||
String driverLocation = "C:\\chromedriver.exe";
|
||||
System.setProperty("webdriver.chrome.driver", driverLocation);
|
||||
return driverLocation;
|
||||
return "C:\\chromedriver.exe";
|
||||
}
|
||||
return System.getProperty("webdriver.chrome.driver");
|
||||
return System.getenv("webdriver.chrome.driver");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,6 +25,7 @@ import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import utilities.CIProperties;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@ -41,11 +42,12 @@ public class SeleniumDriver extends ExternalResource {
|
||||
Assume.assumeNotNull("rules.SeleniumDriver: Chrome driver location not specified for this OS type", driverLocation);
|
||||
Assume.assumeTrue("rules.SeleniumDriver: Chrome driver not found at " + driverLocation, new File(driverLocation).exists());
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", driverLocation);
|
||||
driver = getChromeWebDriver();
|
||||
}
|
||||
|
||||
private WebDriver getChromeWebDriver() {
|
||||
if (System.getProperty("TRAVIS").equals("true")) {
|
||||
if (Boolean.parseBoolean(System.getenv(CIProperties.IS_TRAVIS))) {
|
||||
ChromeOptions chromeOptions = new ChromeOptions();
|
||||
chromeOptions.setBinary("/usr/bin/google-chrome-stable");
|
||||
chromeOptions.setHeadless(true);
|
||||
@ -59,11 +61,9 @@ public class SeleniumDriver extends ExternalResource {
|
||||
|
||||
private String getChromeDriverLocation() {
|
||||
if (SystemUtils.IS_OS_WINDOWS) {
|
||||
String driverLocation = "C:\\chromedriver.exe";
|
||||
System.setProperty("webdriver.chrome.driver", driverLocation);
|
||||
return driverLocation;
|
||||
return "C:\\chromedriver.exe";
|
||||
}
|
||||
return System.getProperty("webdriver.chrome.driver");
|
||||
return System.getenv("webdriver.chrome.driver");
|
||||
}
|
||||
|
||||
public void newTab() {
|
||||
|
@ -21,7 +21,7 @@ public class MySQLTest extends CommonDBTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpDatabase() throws Exception {
|
||||
boolean isTravis = Boolean.parseBoolean(System.getProperty(CIProperties.IS_TRAVIS));
|
||||
boolean isTravis = Boolean.parseBoolean(System.getenv(CIProperties.IS_TRAVIS));
|
||||
assumeTrue(isTravis);
|
||||
|
||||
PlanConfig config = component.getPlanSystem().getConfigSystem().getConfig();
|
||||
|
Loading…
Reference in New Issue
Block a user