@Test public void lynx_is_not_a_supported_driver() throws InitializationError { try { environmentVariables.setProperty("webdriver.driver", "lynx"); SerenityRunner runner = getTestRunnerUsing(SuccessfulSingleTestScenario.class); runner.run(new RunNotifier()); fail("Should have thrown UnsupportedDriverException"); } catch (UnsupportedDriverException e) { assertThat(e.getMessage(), containsString("Unsupported browser type: lynx")); } }
@Test public void should_not_allow_an_incorrectly_specified_driver() throws InitializationError { try { environmentVariables.setProperty("webdriver.driver", "firefox"); SerenityRunner runner = getTestRunnerUsing(SuccessfulSingleTestScenarioWithWrongBrowser.class); runner.run(new RunNotifier()); fail("Should have thrown UnsupportedDriverException"); } catch (UnsupportedDriverException e) { assertThat(e.getMessage(), containsString("Unsupported browser type: doesnotexist")); } }
@Test public void opera_is_not_currently_a_supported_driver() throws InitializationError { try { System.setProperty("webdriver.driver", "opera"); WebDriverFactory mockBrowserFactory = mock(WebDriverFactory.class); ThucydidesRunner runner = getTestRunnerUsing(SuccessfulSingleTestScenario.class, mockBrowserFactory); runner.run(new RunNotifier()); fail("Should have thrown UnsupportedDriverException"); } catch (UnsupportedDriverException e) { assertThat( e.getMessage(), containsString("opera is not a supported browser. Supported driver values are:")); } }