Reputation: 8386
I am testing a website that has a page that will update 4-5 minutes after I have done a certain action.
Here's what I've thought of:
DependsOnMethod
in a lengthy list. I could depend the first test on the test that performs the action, and have the second test depend on the last test to run. This option is not as bad...but it means putting the methods in a class that is completely irrelevant (and dependencies that don't make logical sense)Are there any other options?
Note: I am using TestNG with WebDriver
Upvotes: 0
Views: 3023
Reputation: 27496
Best solution would be to use implicit or explicit waits but it depends how the page update looks like. But if it's for instance some element with counter, you should try something like.
WebElement myDynamicElement = (new WebDriverWait(driver, 5 * 60)) //time in seconds
.until(ExpectedConditions.textToBePresentInElement(By.id("id"),
"Text after update"));
Upvotes: 1