[BUG] Intermittent Issue where fixture is not returning unique data
See original GitHub issueContext:
- Playwright Version: 1.26.1
- Operating System: Mac
- Node.js version: v16.15.0
- Browser: N/A
- Extra: MacBook Pro M1 Pro
System:
- OS: macOS 13.0
- Memory: 576.33 MB / 32.00 GB
Binaries:
- Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
- Yarn: 1.22.19 - /opt/homebrew/bin/yarn
- npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
Languages:
- Bash: 3.2.57 - /bin/bash
Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally. For example:
FIXTURE
import { test as base } from '@playwright/test';
import { faker } from '@faker-js/faker';
type Email = {
email: string;
};
export const test = base.extend<{}, { email: Email }>({
email: [async ({ browser }, use, workerInfo) => {
const email = faker.internet.exampleEmail();
await use({ email });
}, { scope: 'worker' }],
});
export default test;
export const expect = test.expect;
TEST
import test, { expect } from '../../fixtures/testFixture';
test.describe.configure({ mode: 'parallel' });
test('Test One', async ({email}) => {
console.log(email.email);
});
test('Test Two', async ({email}) => {
console.log(email.email);
});
OUTPUT
Running 2 tests using 2 workers
Mitchel_Senger89@example.org
·Mitchel_Senger89@example.org
·
2 passed (1s)
➜ play-on-e2e npm run test
> play-on-e2e@1.0.0 test
> npx playwright test
Running 2 tests using 2 workers
Keeley_Veum68@example.org
Lois15@example.com
··
Describe the bug This example is a simplified version of the real issue I am facing in my actual e2e test project. I am using faker to generate fake data and passing this through to the test. The tests are running in parallel when this issue occurs. As you can see from the output where I print the fake email address on the first run the emails are the same but on the 2nd run the emails are unique.
I believe that the desired behaviour is the emails being unique. I would expect this because they run on separate workers. At the very least I would expect the results to be consistent.
Please can you look into it for me?
Add any other details about the problem here.
The reason this is an issue in my real tests is firebase is returning a 400 for 1 of the 2 requests when creating a user as they have to have unique email addresses.
It passes on some occasions which explains the intermittent behaviour.

Hope this helps. Thanks
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
I have found a solution where I generate a random number to pass into the faker seed
This seems to return unique emails now every time
Once again thanks for your help
Closing as per above, please feel free to open a new issue if this does not cover your use case.