Skip to content

Commit

Permalink
Fixing a broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Jan 18, 2018
1 parent 834478e commit 209d9b0
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
import static org.openqa.selenium.testing.Driver.MARIONETTE;

import com.google.common.base.Throwables;

import org.junit.After;
import org.junit.Test;
import org.mockito.Mockito;
Expand Down Expand Up @@ -197,12 +195,12 @@ public void canSetPreferencesAndProfileInFirefoxOptions() {

@Test
public void shouldGetMeaningfulExceptionOnBrowserDeath() throws Exception {
localDriver = new FirefoxDriver();
localDriver.get(pages.formPage);
FirefoxDriver driver2 = new FirefoxDriver();
driver2.get(pages.formPage);

// Grab the command executor
CommandExecutor keptExecutor = localDriver.getCommandExecutor();
SessionId sessionId = localDriver.getSessionId();
CommandExecutor keptExecutor = driver2.getCommandExecutor();
SessionId sessionId = driver2.getSessionId();

try {
Field field = RemoteWebDriver.class.getDeclaredField("executor");
Expand All @@ -211,9 +209,9 @@ public void shouldGetMeaningfulExceptionOnBrowserDeath() throws Exception {
doThrow(new IOException("The remote server died"))
.when(spoof).execute(Mockito.any());

field.set(localDriver, spoof);
field.set(driver2, spoof);

localDriver.get(pages.formPage);
driver2.get(pages.formPage);
fail("Should have thrown.");
} catch (UnreachableBrowserException e) {
assertThat("Must contain descriptive error", e.getMessage(),
Expand All @@ -223,7 +221,6 @@ public void shouldGetMeaningfulExceptionOnBrowserDeath() throws Exception {
}
}


@NeedsFreshDriver
@NoDriverAfterTest
@Test
Expand Down

0 comments on commit 209d9b0

Please sign in to comment.