@Test public void testPageRefresh() { final WebDriver mockDriver = mock(WebDriver.class); Navigation navigation = mock(Navigation.class); when(mockDriver.navigate()).thenReturn(navigation); MockSeleniumNavigationStepDefinitions navigationSteps = new MockSeleniumNavigationStepDefinitions(mockDriver); navigationSteps.pageRefresh(); verify(navigation, times(1)).refresh(); }
protected Navigation getNavigate() { return GenericDriver.getNavigate(); }
public static Navigation getNavigate() { return getWebDriver().navigate(); }
public Navigation navigate() { return driver.navigate(); }
public Navigation navigate() { return webDriver.navigate(); }
@Test public void testThatNavigatingBackInvokesCorrectWebDriverMethods() { Navigation navigation = mockNavigation(); cut.navigateBackwards(); verify(navigation).back(); }
@Test public void testThatNavigatingForwardsInvokesCorrectWebDriverMethods() { Navigation navigation = mockNavigation(); cut.navigateForwards(); verify(navigation).forward(); }
@Test public void testThatRefreshingInvokesCorrectWebDriverMethods() { Navigation navigation = mockNavigation(); cut.refresh(); verify(navigation).refresh(); }
private Navigation mockNavigation() { Navigation navigation = mock(Navigation.class); doReturn(navigation).when(webDriver).navigate(); return navigation; }
protected Navigation browser() { return driver.navigate(); }
/** * Creates a new instance of this object with a given navigation object and an * event queue. * * @param navigation * Navigation object to wrap for delayed event execution * @param queue * Event queue to add events to for delayed execution */ public DelayedNavigation(final Navigation navigation, final IDelayedEventQueue queue) { this.mNavigation = navigation; this.mQueue = queue; }
/** * Creates a new instance of this object using a given navigation object. * * @param navigation * Object to use for navigation, should not be an instance of * {@link de.zabuza.sparkle.webdriver.DelayedNavigation * DelayedNavigation}. */ public ForwardEvent(final Navigation navigation) { this.mNavigation = navigation; }
/** * Creates a new instance of this object using a given navigation object. * * @param navigation * Object to use for navigation, should not be an instance of * {@link de.zabuza.sparkle.webdriver.DelayedNavigation * DelayedNavigation}. * @param url * URl to navigate to */ public ToUrlEvent(final Navigation navigation, final URL url) { this.mNavigation = navigation; this.mUrl = url; }
/** * Creates a new instance of this object using a given navigation object. * * @param navigation * Object to use for navigation, should not be an instance of * {@link de.zabuza.sparkle.webdriver.DelayedNavigation * DelayedNavigation}. */ public BackEvent(final Navigation navigation) { this.mNavigation = navigation; }
/** * Creates a new instance of this object using a given navigation object. * * @param navigation * Object to use for the refresh, should not be an instance of * {@link de.zabuza.sparkle.webdriver.DelayedNavigation * DelayedNavigation}. */ public RefreshEvent(final Navigation navigation) { this.mNavigation = navigation; }
/** * Creates a new instance of this object using a given navigation object. * * @param navigation * Object to use for navigation, should not be an instance of * {@link de.zabuza.sparkle.webdriver.DelayedNavigation * DelayedNavigation}. * @param url * URl to navigate to */ public ToStringEvent(final Navigation navigation, final String url) { this.mNavigation = navigation; this.mUrl = url; }
/** * An abstraction allowing the driver to access the browser's history and to navigate to a given * URL. * * @return A {@link Navigation} that allows the selection of what to * do next */ public Navigation navigate() { return seleniumWebDriver().navigate(); }