SynchronisationService extends BaseServiceHub { public void checkAndAssertForExpectedCondition(ExpectedCondition<?> condition) { if (!waitForExpectedCondition(condition, 0)) { fail(String.format("Element does not meet condition %1$s", condition.toString())); } }  boolean waitForExpectedCondition(ExpectedCondition<?> condition, int timeout); boolean waitForExpectedCondition(ExpectedCondition<?> condition); void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition, int timeout); void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition); boolean checkForExpectedCondition(ExpectedCondition<?> condition); void checkAndAssertForExpectedCondition(ExpectedCondition<?> condition); void waitAndSwitchToNewBrowserWindow(int timeout); void waitAndSwitchToNewBrowserWindow(); void switchToMainWindow(); void switchToLatestPopupWindow();  }
@Test public void testCheckAndAssertForExpectedCondition() throws Exception { seleniumNavigationService.navigate_to_url(TEST_PAGE_URL); seleniumSynchronisationService.checkAndAssertForExpectedCondition(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("div[id='text']"))); seleniumElementService.findExpectedElement(By.cssSelector("button[id='delayedDisplayButton']")).click(); seleniumSynchronisationService.checkAndAssertForExpectedCondition(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id='text']"))); }