Open reallymello opened 3 days ago
Some extra context I discovered this morning. It seems that the issue occurs when the waitForInProgressOverlay command waitUntil times out and I have a downstream click command with nested .findByText that isn't awaited.
// Broken example
await desktopParticipantPage
.click('@coverageMatchLink') // This action triggers a loading screen to appear to "lock" the page
.waitForInProgressOverlay(
500, // Set very short to ensure we timeout to reproduce the issue
'clicked coverage match link in desktop participant page'
)
.click(browser.element.findByText('Ok'))
.assert.textContains('@coverageMatch', 'Covered')
// Working example
await desktopParticipantPage
.click('@coverageMatchLink') // This action triggers a loading screen to appear to "lock" the page
.waitForInProgressOverlay(
500, // Set very short to ensure we timeout to reproduce the issue
'clicked coverage match link in desktop participant page'
)
.click(await browser.element.findByText('Ok'))
.assert.textContains('@coverageMatch', 'Covered')
I tried to reproduce this but I couldn't. Then I realized you are using the custom command on a page object, which clears one thing that this issue is only present for the page objects (although I'm yet to reproduce it, which I'll try in the morning) and the commands work as intended when called on the browser
object.
Tried this on page object as well but still unable to reproduce the unhandledRejection
error.
Would it be possible for you to provide us with a minimal reproducible project?
I'll work on it
Description of the bug/issue
When I use waitUntil in an async custom command to wait for an event to occur and that event takes longer than the provided timeout I expect the test to fail gracefully, but instead an unhandledRejection occurs due to the reject property being null causing Nightwatch to exit before ending the session normally (leaving the browser session open).
Steps to reproduce
In general, to reproduce, I have a custom command that uses .waitUntil to wait for a loading panel to complete between postback operations. Sometimes the wait takes longer than the max timeout provided to the waitUntil command which results in an error such as
When this occurs the after/afterEach test hooks and the global session quit never runs. This causes severe issues in our BrowserStack CI runs because it gets interpreted as a timeout and we don't get results for our test run.
Sample test
Command to run
No response
Verbose Output
Nightwatch Configuration
No response
Nightwatch.js Version
3.7
Node Version
20.11
Browser
Chrome 128
Operating System
Windows 11 / Linux
Additional Information
Appears to manifest as a Timeout error when this occurs in BrowserStack TurboScale without any trace information