Skip to content

Commit

Permalink
remove Selenoid
Browse files Browse the repository at this point in the history
  • Loading branch information
Achitheus committed Feb 12, 2024
1 parent 7927add commit b6cf5cf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 29 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/tests-and-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ jobs:
cache: 'maven'
distribution: 'zulu'

# - name: Start selenoid
# uses: Xotabu4/selenoid-github-action@v2

- name: Run Test
run: ./mvnw verify -e -P env-test
continue-on-error: true
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/helpers/properties/TestProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public interface TestProperties extends Accessible {
@Key("user.data.dir")
String userDataDir();

@Key("selenoid.url")
String selenoidURL();

@Key("profile.dir")
String profileDir();

Expand All @@ -35,7 +32,4 @@ public interface TestProperties extends Accessible {

@Key("headless")
boolean headless();

@Key("use.selenoid")
boolean useSelenoid();
}
25 changes: 8 additions & 17 deletions src/test/java/ru/bellintegrator/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;
import java.util.Optional;

Expand Down Expand Up @@ -48,31 +45,26 @@ public void afterTestExecution(ExtensionContext context) {
* @author Achitheus (Yury Yurchenko)
*/
@BeforeEach
public void beforeEach() throws MalformedURLException {
public void beforeEach() {
ChromeOptions options = new ChromeOptions();
if (testProperties.useBrowserProfile()) {
options.addArguments("--user-data-dir=" + testProperties.userDataDir())
.addArguments("--profile-directory=" + testProperties.profileDir());
.addArguments("--profile-directory=" + testProperties.profileDir());
}
if (testProperties.headless()) {
options
.addArguments("--headless=new")
.addArguments("--user-agent="
+ getUserAgent().replaceAll("(Headless)", ""));
options.addArguments("--headless=new")
.addArguments("--user-agent=" + getUserAgent().replaceAll("(Headless)", ""));
}
if (testProperties.useSelenoid()) {
driver = new ChromeDriver(options);//RemoteWebDriver(new URL(testProperties.selenoidURL()), options);
} else {
if (testProperties.mavenProfile().equalsIgnoreCase("dev")) {
System.setProperty("webdriver.chrome.driver", testProperties.chromeDriver());
driver = new ChromeDriver(options);
}
driver = new ChromeDriver(options);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(IMPLICITLY_WAIT));
Allure.parameter("OS", System.getProperty("os.name") + " (" + System.getProperty("os.version") + ')');
Allure.parameter("JDK", System.getProperty("java.version") + " (" + System.getProperty("java.vendor") + ')');
Allure.parameter("Maven profile", testProperties.mavenProfile());
Allure.parameter("Selenoid used", testProperties.useSelenoid());
Allure.parameter("Headless mode", testProperties.headless());
Allure.parameter("Profile", testProperties.mavenProfile());
Allure.parameter("Headless", testProperties.headless());
Allure.parameter("Browser profile used", testProperties.useBrowserProfile());
}

Expand All @@ -86,7 +78,6 @@ private String getUserAgent() {
WebDriver chromedriver = new ChromeDriver(new ChromeOptions().addArguments("--headless=new"));
String currentUserAgent = (String) ((JavascriptExecutor) chromedriver).executeScript("return navigator.userAgent;");
chromedriver.quit();
log.info("user-agent = {}", currentUserAgent);
return currentUserAgent;
}

Expand Down
5 changes: 2 additions & 3 deletions src/test/resources/test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ yandex.service.title = Маркет

user.data.dir = ${env.USER_DATA}
profile.dir = profileForTests
selenoid.url = http://localhost:4444/wd/hub
chrome.driver = ${env.CHROME_DRIVER}\\chromedriver.exe

# Properties from active maven profile
maven.profile = ${mavenProfile}
use.browser.profile = ${useBrowserProfile}
headless = ${headless}
use.selenoid = ${useSelenoid}
headless = ${headless}

0 comments on commit b6cf5cf

Please sign in to comment.