Skip to content

Commit 0981c62

Browse files
committed
There are issues on travis with window maximize operation, I hope this change will fix broken JS jobs.
1 parent ab00400 commit 0981c62

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

java/client/test/org/openqa/selenium/javascript/ClosureTestStatement.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.openqa.selenium.javascript;
1919

2020
import static org.junit.Assert.fail;
21+
import static org.openqa.selenium.testing.TestUtilities.isOnTravis;
2122

2223
import com.google.common.base.Stopwatch;
2324

@@ -27,6 +28,7 @@
2728
import org.openqa.selenium.TakesScreenshot;
2829
import org.openqa.selenium.WebDriver;
2930
import org.openqa.selenium.WebDriverException;
31+
import org.openqa.selenium.testing.TestUtilities;
3032

3133
import java.net.URL;
3234
import java.util.concurrent.TimeUnit;
@@ -63,14 +65,15 @@ public void evaluate() throws Throwable {
6365

6466
WebDriver driver = driverSupplier.get();
6567

66-
// Attempt to make the window as big as possible.
67-
try {
68-
driver.manage().window().maximize();
69-
} catch (RuntimeException ignored) {
70-
// We tried.
68+
if (!isOnTravis()) {
69+
// Attempt to make the window as big as possible.
70+
try {
71+
driver.manage().window().maximize();
72+
} catch (RuntimeException ignored) {
73+
// We tried.
74+
}
7175
}
7276

73-
7477
JavascriptExecutor executor = (JavascriptExecutor) driver;
7578
// Avoid Safari JS leak between tests.
7679
executor.executeScript("if (window && window.top) window.top.G_testRunner = null");

java/client/test/org/openqa/selenium/testing/TestUtilities.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ public static boolean isLocal() {
197197
return !Boolean.getBoolean("selenium.browser.remote") && !SauceDriver.shouldUseSauce();
198198
}
199199

200+
public static boolean isOnTravis() {
201+
return Boolean.valueOf(System.getenv("TRAVIS"));
202+
}
203+
200204
public static Throwable catchThrowable(Runnable f) {
201205
try {
202206
f.run();

0 commit comments

Comments
 (0)