browser.wait does not throw error in Element 2.0
imajus opened this issue · 1 comments
imajus commented
After switching to Element 2.0 our tests have started to fail on browser.wait
calls. In case when test runs should have been failed due to a missing element, browser.wait
has started skipping that. Now we just see timeout error dumped to output but test continues to be executed.
Here's a simple reproduction scenario:
// File: main.perf.ts
import { step, Until, By } from '@flood/element'
export default () => {
step('Start', async browser => {
await browser.visit('https://challenge.flood.io')
// Wait for non-existing element to be located
await browser.wait(Until.elementLocated(By.css('missing')));
})
}
I can see the timeout error from Playwright in console output but it doesn't affect test execution flow:
Running ./main.perf.ts (1 of 1) with
- Element v2.0.0
- Node v12.19.0
✔ Script Compiler
Compiled successfully in 110.86ms
✓ Iteration 1 of 1
✓ Step 'global' passed (32,234ms)
frame.waitForFunction: Timeout 30000ms exceeded.Error
at Object.captureStackTrace (.../node_modules/playwright/lib/utils/stackTrace.js:48:19)
at Connection.sendMessageToServer (.../node_modules/playwright/lib/client/connection.js:69:48)
at Proxy.<anonymous> (.../node_modules/playwright/lib/client/channelOwner.js:64:61)
at .../node_modules/playwright/lib/client/frame.js:398:42
at Frame._wrapApiCall (.../node_modules/playwright/lib/client/channelOwner.js:77:34)
at Frame.waitForFunction (.../node_modules/playwright/lib/client/frame.js:395:21)
at ElementLocatedCondition.<anonymous> (.../node_modules/@flood/element-core/dist/src/page/Condition.js:111:18)
at Generator.next (<anonymous>)
at .../node_modules/@flood/element-core/dist/src/page/Condition.js:8:71
at new Promise (<anonymous>) {
name: 'TimeoutError'
}
Iteration 1 completed in 40s (walltime) 1 passed
Test completed after 1 iterations
+------------+------------+------------+------------+------------+
| Iteration | Passed | Failed | Skipped | Unexecuted |
|------------|------------|------------|------------|------------|
| 1 | 1 | _ | _ | _ |
+------------+------------+------------+------------+------------+
Test running with the config file has finished
Expected behavior
The test run should fail due to a timeout error.
Desktop:
- OS: Ubuntu 20.10 (also reproduced on Windows 10)
- Node.js version: v12.19.0
- Version 2.0.0
nick-flood commented
Thanks for the report @imajus. We've fixed this in version 2.0.2, it should now throw an error and fail the step.