Skip to content

Commit

Permalink
Adding a new test inspired by issue #578. Driver should be able to se…
Browse files Browse the repository at this point in the history
…t page load timeout once and handle sequential pages with load timeouts.
  • Loading branch information
barancev committed Aug 27, 2017
1 parent 07eb380 commit 7e6e03d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions java/client/test/org/openqa/selenium/PageLoadingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,20 @@ public void testPageLoadTimeoutCanBeChanged() {
testPageLoadTimeoutIsEnforced(3);
}

@NoDriverAfterTest
@Test
@Ignore(PHANTOMJS)
@Ignore(FIREFOX)
@Ignore(value = SAFARI, reason = "issue 687, comment 41")
@NeedsLocalEnvironment
public void testCanHandleSequentialPageLoadTimeouts() {
long pageLoadTimeout = 2;
long pageLoadTimeBuffer = 10;
driver.manage().timeouts().pageLoadTimeout(2, SECONDS);
assertPageLoadTimeoutIsEnforced(pageLoadTimeout, pageLoadTimeBuffer);
assertPageLoadTimeoutIsEnforced(pageLoadTimeout, pageLoadTimeBuffer);
}

@NoDriverAfterTest // Subsequent tests sometimes fail on Firefox.
@Test
@Ignore(value = SAFARI, reason = "issue 687, comment 41")
Expand Down Expand Up @@ -547,7 +561,11 @@ private void testPageLoadTimeoutIsEnforced(long webDriverPageLoadTimeout) {
// Test page will load this many seconds longer than WD pageLoadTimeout.
long pageLoadTimeBuffer = 10;
driver.manage().timeouts().pageLoadTimeout(webDriverPageLoadTimeout, SECONDS);
assertPageLoadTimeoutIsEnforced(webDriverPageLoadTimeout, pageLoadTimeBuffer);
}

private void assertPageLoadTimeoutIsEnforced(long webDriverPageLoadTimeout,
long pageLoadTimeBuffer) {
long start = System.currentTimeMillis();
try {
driver.get(appServer.whereIs(
Expand Down

0 comments on commit 7e6e03d

Please sign in to comment.