Skip to content
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

The combination of video recording and concurrency breaks testcafe test hook execution #6999

Closed
Makavelic opened this issue Apr 22, 2022 · 7 comments · Fixed by #8097
Closed
Assignees
Labels
FREQUENCY: level 1 Good first issue SYSTEM: video recording An issue related to the video recording functionality. TYPE: bug The described behavior is considered as wrong (bug).

Comments

@Makavelic
Copy link

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)

VideoConcurrencyIssues.zip

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

  1. Extract project
  2. Build project with yarn or npm
  3. 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.

@Makavelic Makavelic added the TYPE: bug The described behavior is considered as wrong (bug). label Apr 22, 2022
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Apr 22, 2022
@AlexKamaev
Copy link
Contributor

I managed to reproduce the issue. I confirm that it appears only when video recording is enabled. We'll research this behavior.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Apr 26, 2022
@AlexKamaev AlexKamaev added FREQUENCY: level 1 SYSTEM: video recording An issue related to the video recording functionality. labels Apr 26, 2022
@Makavelic
Copy link
Author

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.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Sep 21, 2022
@miherlosev
Copy link
Collaborator

Hi @Makavelic

Thank you for the additional information. We will keep it in mind when investigating the cause of the issue.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Sep 23, 2022
@github-actions
Copy link

github-actions bot commented Sep 7, 2023

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.

@github-actions github-actions bot added the STATE: Stale An outdated issue that will be automatically closed by the Stale bot. label Sep 7, 2023
@Makavelic
Copy link
Author

This is still an issue.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Sep 7, 2023
@AlexKamaev AlexKamaev removed STATE: Stale An outdated issue that will be automatically closed by the Stale bot. STATE: Need response An issue that requires a response or attention from the team. labels Sep 7, 2023
aleks-pro pushed a commit that referenced this issue Dec 13, 2023
)

<!--
Thank you for your contribution.

Before making a PR, please read our contributing guidelines at

https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution

We recommend creating a *draft* PR, so that you can mark it as 'ready
for review' when you are done.
-->

## Purpose
Fixed the bug when the concurrent tests did not wait until the finish of
the fixture and global before hook.

## Approach
Updated the method runFixtureBeforeHookIfNecessary in
src/runner/fixture-hook-controller.ts. Now we store the promises of
hooks in item from _getFixtureMapItem and await them in concurrent
tests.

## References
closes #6999

## Pre-Merge TODO
- [x] Write tests for your proposed changes
- [x] Make sure that existing tests do not fail
Copy link

Release v3.5.0-rc.1 addresses this.

1 similar comment
Copy link

Release v3.5.0-rc.1 addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FREQUENCY: level 1 Good first issue SYSTEM: video recording An issue related to the video recording functionality. TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants