2022-01-24

Playwright : How to run the same test on multiple url in the same browser on different tabs and in parallel

I'm looking to run the same test for serverals url (~20) and I want to be the quickest as possible.

I would like to run my 20 tests in parallel in one browser and in a new tab (page) for each but I can't achieve it.

Here my code that open a new browser for each test :

const urlList: string[] = [
  'url1',
  'url2',
  ...
];

test.describe.parallel("Same test for multiple url", async () => {

  let context;

  test.beforeAll(async ({ browser }) => {
    context = await browser.newContext();
  });

  for (const url of urlList) {

    test(`${url}`, async () => {
      let page = await context.newPage();
      await page.goto(url);
    });

  }

});
 


from Recent Questions - Stack Overflow https://ift.tt/32p2P82
https://ift.tt/eA8V8J

No comments:

Post a Comment