-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#6459]improve(test): Use explicit wait for time-based condition #6460
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,8 +48,8 @@ public class BaseWebIT extends BaseIT { | |
// https://www.selenium.dev/documentation/webdriver/waits/#implicit-waits | ||
protected static final long MAX_IMPLICIT_WAIT = 30; | ||
protected static final long MAX_TIMEOUT = 60; | ||
protected static final long EACH_TEST_SLEEP_MILLIS = 1_000; | ||
protected static final long ACTION_SLEEP_MILLIS = 1_000; | ||
protected static final long EACH_TEST_SLEEP = 1; | ||
protected static final long ACTION_SLEEP = 1; | ||
|
||
protected boolean waitShowText(final String text, final Object locator) { | ||
try { | ||
|
@@ -82,12 +82,12 @@ protected void clickAndWait(final Object locator) throws InterruptedException { | |
wait.until(ExpectedConditions.elementToBeClickable(locatorElement(locator))); | ||
|
||
locatorElement(locator).click(); | ||
Thread.sleep(ACTION_SLEEP_MILLIS); | ||
Thread.sleep(ACTION_SLEEP * 1000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zzzk1 @LauraXia123 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yuqi1129 I have tried, but there is no way to do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zzzk1, Please revert the changes here. I will take a final review. |
||
} catch (ElementClickInterceptedException e) { | ||
// if the previous click did not effected then try clicking in another way | ||
Actions action = new Actions(driver); | ||
action.moveToElement(locatorElement(locator)).click().build().perform(); | ||
Thread.sleep(ACTION_SLEEP_MILLIS); | ||
Thread.sleep(ACTION_SLEEP * 1000); | ||
} | ||
} | ||
|
||
|
@@ -106,7 +106,7 @@ WebElement locatorElement(final Object locatorOrElement) { | |
@BeforeEach | ||
public void beforeEachTest() { | ||
try { | ||
Thread.sleep(EACH_TEST_SLEEP_MILLIS); | ||
Thread.sleep(EACH_TEST_SLEEP * 1000); | ||
} catch (Exception e) { | ||
LOG.error(e.getMessage(), e); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue lies in here and L90. You should not delete these two lines unless you have alternatives.