testcafe
testcafe copied to clipboard
The combination of video recording and concurrency breaks testcafe test hook execution
What is your Scenario?
I want to run testcafe tests with video recording and concurrency.
What is the Current behavior?
If I enable both capabilities, some tests will execute before the .before block is complete.
What is the Expected behavior?
Tests should wait for the .before block to finish executing before they start.
What is your public website URL? (or attach your complete example)
What is your TestCafe test code?
import { t } from "testcafe";
let value = 0;
fixture("bugTest")
.before(async () => {
await new Promise(r => setTimeout(r, 10000));
// Value should be set before any test starts
value = 10;
})
.beforeEach(async t => {
await t.navigateTo(`file://${__dirname}/testcafeBug.html`);
});
test("test1", async t => {
await t.expect(value).eql(10);
});
test("test2", async t => {
await t.expect(value).eql(10);
});
test("test3", async t => {
await t.expect(value).eql(10);
});
Your complete configuration file
.testcaferc.json
{
"videoPath": "artifacts/videos",
"videoOptions": {
"singleFile": true,
"failedOnly": true,
"pathPattern": "${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.mp4"
}
}
Your complete test report
No response
Screenshots
No response
Steps to Reproduce
- Extract project
- Build project with yarn or npm
- Run command from terminal:
testcafe chrome -c 3 tests
Expected: All tests should pass Actual: 2 tests fail because they execute before the .before block is done
TestCafe version
1.18.6
Node.js version
16.13.0
Command-line arguments
testcafe chrome -c 3 tests
Browser name(s) and version(s)
Chrome 100
Platform(s) and version(s)
Windows 10
Other
This also occurs if I use the Runner code instead of the CLI. When I'm debugging I always have to create my own locking mechanism to avoid this issue.
I managed to reproduce the issue. I confirm that it appears only when video recording is enabled. We'll research this behavior.
I managed to reproduce the issue. I confirm that it appears only when video recording is enabled. We'll research this behavior.
I just encountered the same problem but without video recording. No special configuration but it only happens on a specific test file (I can't determine what causes it) but figured its worth mentioning that its possibly a more global problem.
Hi @Makavelic
Thank you for the additional information. We will keep it in mind when investigating the cause of the issue.
This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.
This is still an issue.
Release v3.5.0-rc.1 addresses this.
Release v3.5.0-rc.1 addresses this.