@Test public void oneToOneRelationBetweenBrowserAndUI() throws MalformedURLException { openWindow(INSTRUMENTED_UI_URI); firstWindow.click(BUTTON); waitModel.waitForChange(retrieveText.locator(LABEL)); int clickCount = number(firstWindow.getText(LABEL)); assertThat(clickCount, is(1)); assertThat(InstrumentedUI.getNumberOfInstances(), is(1)); firstWindow.click(BUTTON); waitModel.waitForChange(retrieveText.locator(LABEL)); clickCount = number(firstWindow.getText(LABEL)); assertThat(clickCount, is(2)); assertThat(InstrumentedUI.getNumberOfInstances(), is(1)); firstWindow.restartBrowser(); openWindow(INSTRUMENTED_UI_URI); firstWindow.click(BUTTON); waitModel.waitForChange(retrieveText.locator(LABEL)); clickCount = number(firstWindow.getText(LABEL)); assertThat(clickCount, is(1)); assertThat(InstrumentedUI.getNumberOfInstances(), is(2)); firstWindow.click(BUTTON); waitModel.waitForChange(retrieveText.locator(LABEL)); clickCount = number(firstWindow.getText(LABEL)); assertThat(clickCount, is(2)); assertThat(InstrumentedUI.getNumberOfInstances(), is(2)); assertDefaultRootNotInstantiated(); }
@Test public void refreshButtonCreatesNewUIInstance() throws MalformedURLException { openWindow(INSTRUMENTED_UI_URI); assertThat(InstrumentedUI.getNumberOfInstances(), is(1)); firstWindow.refresh(); waitModel.until(elementPresent.locator(LABEL)); assertThat(InstrumentedUI.getNumberOfInstances(), is(2)); assertDefaultRootNotInstantiated(); }