Skip to content

Commit

Permalink
[java] Run browsers in xvfb instead of headless
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Nov 24, 2020
1 parent b7ef89b commit b8b73c1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,14 @@ jobs:
java-version: '11'
- name: Setup Chrome and chromedriver
uses: ./.github/actions/setup-chrome
- name: Start XVFB
run: Xvfb :99 &
- name: Run browser tests in Chrome
uses: ./.github/actions/bazel-test
with:
query: attr(tags, chrome, tests(//java/client/...)) except attr(tags, remote, tests(//java/client/...))
env:
DISPLAY: :99

firefox_tests:
needs: small_tests
Expand All @@ -144,10 +148,14 @@ jobs:
java-version: '11'
- name: Setup Firefox and geckodriver
uses: ./.github/actions/setup-firefox
- name: Start XVFB
run: Xvfb :99 &
- name: Run browser tests in Firefox
uses: ./.github/actions/bazel-test
with:
query: attr(tags, firefox, tests(//java/client/...)) except attr(tags, remote, tests(//java/client/...))
env:
DISPLAY: :99


server_tests:
Expand Down Expand Up @@ -176,9 +184,11 @@ jobs:
uses: ./.github/actions/setup-chrome
- name: Setup Firefox and geckodriver
uses: ./.github/actions/setup-firefox
- name: Start XVFB
run: Xvfb :99 &
- name: Run server tests
env:
MOZ_HEADLESS: 1
uses: ./.github/actions/bazel-test
with:
query: tests(//java/server/...) except attr(tags, 'lint|ie|edge|edgehtml|safari', tests(//java/server/...))
env:
DISPLAY: :99
12 changes: 6 additions & 6 deletions java/client/test/org/openqa/selenium/WindowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void testSetsThePositionOfTheCurrentWindow() {
}

@Test
@Ignore(value = CHROME, travis = true, gitHubActions = true)
@Ignore(value = CHROME, travis = true)
@Ignore(EDGE)
public void testCanMaximizeTheWindow() {
// Browser window cannot be resized or moved on ANDROID (and most mobile platforms
Expand All @@ -132,7 +132,7 @@ public void testCanMaximizeTheWindow() {

@SwitchToTopAfterTest
@Test
@Ignore(value = CHROME, travis = true, gitHubActions = true)
@Ignore(value = CHROME, travis = true)
@Ignore(EDGE)
public void testCanMaximizeTheWindowFromFrame() {
// Browser window cannot be resized or moved on ANDROID (and most mobile platforms
Expand All @@ -148,7 +148,7 @@ public void testCanMaximizeTheWindowFromFrame() {

@SwitchToTopAfterTest
@Test
@Ignore(value = CHROME, travis = true, gitHubActions = true)
@Ignore(value = CHROME, travis = true)
@Ignore(EDGE)
public void testCanMaximizeTheWindowFromIframe() {
// Browser window cannot be resized or moved on ANDROID (and most mobile platforms
Expand All @@ -175,7 +175,7 @@ public void canMinimizeTheWindow() {
}

@Test
@Ignore(value = CHROME, travis = true, gitHubActions = true)
@Ignore(value = CHROME, travis = true)
@Ignore(SAFARI)
@Ignore(EDGE)
public void canFullscreenTheWindow() {
Expand All @@ -189,7 +189,7 @@ public void canFullscreenTheWindow() {

@SwitchToTopAfterTest
@Test
@Ignore(value = CHROME, travis = true, gitHubActions = true)
@Ignore(value = CHROME, travis = true)
@Ignore(SAFARI)
@Ignore(EDGE)
public void canFullscreenTheWindowFromFrame() {
Expand All @@ -206,7 +206,7 @@ public void canFullscreenTheWindowFromFrame() {

@SwitchToTopAfterTest
@Test
@Ignore(value = CHROME, travis = true, gitHubActions = true)
@Ignore(value = CHROME, travis = true)
@Ignore(SAFARI)
@Ignore(EDGE)
public void canFullscreenTheWindowFromIframe() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ private static ChromeDriverService getService() {

private static ChromeOptions chromeWithCustomCapabilities(Capabilities originalCapabilities) {
ChromeOptions options = new ChromeOptions();
if (Boolean.parseBoolean(System.getenv("GITHUB_ACTIONS"))) {
options.setHeadless(true);
}
options.addArguments("disable-extensions", "disable-infobars", "disable-breakpad", "disable-dev-shm-usage", "no-sandbox");
Map<String, Object> prefs = new HashMap<>();
prefs.put("exit_type", "None");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ static void addShutdownAction(Runnable action) {
.setLegacy(true)
.setHeadless(Boolean.parseBoolean(System.getProperty("webdriver.firefox.headless", "false"))))
.put(Browser.MARIONETTE, original -> new FirefoxOptions(original)
.setHeadless(
Boolean.parseBoolean(System.getProperty("webdriver.firefox.headless", "false")) ||
Boolean.parseBoolean(System.getenv("GITHUB_ACTIONS")))
.setHeadless(Boolean.parseBoolean(System.getProperty("webdriver.firefox.headless", "false")))
)
.put(Browser.IE, original -> {
InternetExplorerOptions options = new InternetExplorerOptions(original);
Expand Down

0 comments on commit b8b73c1

Please sign in to comment.