1

I want to run the same test for some urls (1000+) and I want to be the quickest as possible. I loop the test for each url, but when the number of urls exceeds 10, it will cause a timeout error. I guess this may be because each test is ran sequentially, do we have a way to run test in parallel?

const queries = getQueries();

for (let i=0; i < queries.length; i++){
    test.describe('LinkBroken'+ i.toString(), () => {
        test(queries[i].split('\t')[2], async ({ page }, testInfo) => {

            const url = getUrl(queries[i])
            await page.goto(url);
        
            const locators = page.locator('#b_content').locator('a:visible');
            const locator_count = await locators.count()
        
            for (let i=0; i <locator_count; i++){
                const link = locators.nth(i);
                await link.highlight();
                await link.click({trial:true});
            }
        });
    })
}

I tried to set playwright config as below, but it still doesn't work with fullyParallel: true and workers: 10.

stefan judis
  • 3,416
  • 14
  • 22
Tishuang
  • 13
  • 3

1 Answers1

0

According to the playwright documentation you should add this line before test logic.

test.describe.configure({ mode: 'parallel' });

More information here

Also you may need to extend your timeout in playwright.config.ts file due to default limit for one test is 30sec.