@Test public void driver_can_be_overridden_using_the_driver_property_in_the_Managed_annotation() throws InitializationError { environmentVariables.setProperty("webdriver.driver", "opera"); SerenityRunner runner = getTestRunnerUsing(SuccessfulSingleTestScenarioWithABrowser.class); runner.run(new RunNotifier()); }
@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")); } }