webdriverio/webdriverio
GitHub ã§èŠã[ð Bug]: Middleware interfering with API: waitForDisplayed({ reverse: true })
Open
#13,253 opened on 2024幎8æ1æ¥
Bug ðhelp wanted
Repository metrics
- Stars
- Â (6,029 stars)
- PR merge metrics
-  (å¹³åããŒãž 15d 15h) (30d ã§ 48 merged PRs)
説æ
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
v8
Node.js Version
20
Mode
Standalone Mode
Which capabilities are you using?
No response
What happened?
class MyPage {
// A button to submit a form
get submit(){ return $('#submit') }
// A loading progress bar within the submit button that activates when submit is pressed
get submitLoading(){ return this.submit.$('.loading') }
}
In my tests:
const myPage = new MyPage()
// Intent is to press the submit button and then wait for the loading to finish before moving on
await myPage.submit.click()
// If the loading is finished very briefly the entire form disappears, therefore the submit button dissappears
// WDIO middleware cannot find the submit button, so it stalls until waitForTimeout is reached and then errors
await myPage.submitLoading.waitForDisplayed({ reverse: true })
What is your expected behavior?
If the API has an option to wait for an element to not be displayed (waitForDisplayed({ reverse: true })) and
- the element was built by nesting of elements like
browser.$('#submit').$('.loading') - a parent element no longer exists
Then waitForDisplayed should not error with a timeout waiting for a parent element to exist
How to reproduce the bug.
class MyPage {
// A button to submit a form
get submit(){ return $('#submit') }
// A loading progress bar within the submit button that activates when submit is pressed
get submitLoading(){ return this.submit.$('.loading') }
}
In my tests:
const myPage = new MyPage()
// Intent is to press the submit button and then wait for the loading to finish before moving on
await myPage.submit.click()
// If the loading is finished very briefly the entire form disappears, therefore the submit button dissappears
// WDIO middleware cannot find the submit button, so it stalls until waitForTimeout is reached and then errors
await myPage.submitLoading.waitForDisplayed({ reverse: true })
Relevant log output
N/A
Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues