← Back to Discord Forum

Generation of random data for tests

I have a normal object in which I use a faker to generate random values: const product = { id: faker.random.numeric(6), note: faker.random.word(), }; I have two tests that have a step that takes this object as an argument test('Populate form', async ({ dashboardPage, page, }) => { await dashboardPage.createNewProduct(product); await expect(page).toHaveScreenshot(); }); The problem is that the data generated in this object during the run of these tests is random only for one test, while for the second it will be the same as for the first. What is the problem and how can it be solved?

This thread is trying to answer question "Why is the faker generating the same random data for the second test and how can this be resolved?"

0 replies

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.