@Before public void resetCounter() { PlainUI.resetCounter(); PlainAlternativeUI.resetCounter(); PlainColidingAlternativeUI.resetCounter(); InstrumentedUI.resetCounter(); InstrumentedView.resetCounter(); ScopedInstrumentedView.resetCounter(); ViewWithoutAnnotation.resetCounter(); WithAnnotationRegisteredView.resetCounter(); SecondUI.resetCounter(); RootUI.resetCounter(); RootWithCustomMappingUI.resetCounter(); UIWithCDIDependentListener.resetCounter(); UIWithCDISelfListener.resetCounter(); DependentCDIEventListener.resetCounter(); DependentCDIEventListener.resetEventCounter(); ParameterizedNavigationUI.reset(); NoViewProviderNavigationUI.resetCounter(); firstWindow.restartBrowser(); }
@Test public void cdiEventsArrivesInTheSameUIScopedInstance() throws MalformedURLException { assertThat(UIWithCDISelfListener.getNumberOfInstances(), is(0)); assertThat(UIWithCDISelfListener.getNumberOfDeliveredEvents(), is(0)); String uri = deriveMappingForUI(UIWithCDISelfListener.class); openWindow(uri); waitModel.until(elementPresent.locator(LABEL)); firstWindow.click(BUTTON); waitModel.waitForChange(retrieveText.locator(LABEL)); assertThat(UIWithCDISelfListener.getNumberOfInstances(), is(1)); assertThat(UIWithCDISelfListener.getNumberOfDeliveredEvents(), is(1)); firstWindow.click(BUTTON); waitModel.waitForChange(retrieveText.locator(LABEL)); assertThat(UIWithCDISelfListener.getNumberOfInstances(), is(1)); assertThat(UIWithCDISelfListener.getNumberOfDeliveredEvents(), is(2)); }