Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
How to run test suite in parallel but not the single tests

I'm using Playwright.dev to automate our UI tests. Currently I face the following issue:

In a single spec.ts file I have different test suites. Those test suites should run in parallel but not each test. I can not split those test suites into separate files because they are created dynamically. Why I want to run the tests of each test suite serial is, to reuse the existing page. Because it's much faster to just reuse the page without doing a complete refresh of the page the whole time. I'll try to explain my problem with some pseudo-code:

catalogs.forEach((objectIdsOfCatalog, catalogId) => {
    // each suite could run in parallel because they do not
    // depend on each other
    test.describe('Test catalog "' + catalogId + '"', () => {
        let newVersion: PageObject;
        let actualVersion: PageObject;

        test.beforeAll(async ({browser}) => {
            console.log('New page for', catalogId);
            const {actualUrl, newUrl} = getConfig();
            const context = await browser.newContext();
            actualVersion = new PageObject(await context.newPage(), actualUrl);
            newVersion = new PageObject(await context.newPage(), newUrl);
        });

        test.afterAll(async () => {
            console.log('Close page for', catalogId);
            actualVersion.close();
            newVersion.close();
            actualVersion = null;
            newVersion = null;
        });
        // those tests should ran serial because it's faster
        // if we just navigate on the existing page due to the
        // client side caching of the web app
        for (const objectId of objectIdsOfCatalog) {
            test('Testing "' + objectId + '"', async () => {
            });
        }
    });
});

Is there some way to achieve the following behavior in Playwright or do I have to rethink my approach?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I don't know if multiple test.describe.serial blocks could be nested in a test.describe.parallel (and if that works), but maybe that's worth a try.

Another option could be to not generate real tests, but just to generate steps (test.step) inside tests inside a test.describe.parallel block.

And where do the catalogs come from? Maybe instead of generating describe blocks, you could generate projects in the playwright.config.ts? Projects run in parallel by default I think. But don't know if that approach would work if the data is coming from some async source.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!