I am trying figure this out since few days. Found couple workarounds but nothing seems to work as expected.
My requirement is to run Playwright tests against multiple URLs. Single project - runs perfectly fine, I have few tests already in place. Now I want to introduce multiple projects with the best possible configuration.
For instance my './tests/ProjectA' runs against 'https://projectA.home.com './tests/ProjectB' runs against 'https://projectB.home.com with different credentials and so on.
I want both A & B to run against every release in single run.
I am looking at a config file like this with projects...
projects: [
{
name: 'Project A',
testDir: './tests/ProjectA',
use: {
baseURL: process.env.projectA,
},
},
{
name: 'Project B',
testDir: './tests/LTI/ProjectB',
use: {
baseURL: process.env.projectB
},
},
],
Issue: I want to check which testDir my current worker is pointing to at 'globalSetup' level so I can authenticate and bring up the URL accordingly.
How do I access Project info at globalSetup level? Or how do I best handle this issue? Appreciate any suggestions. Thanks!!