I've been grappling with this problem for the past few days. I've tried a few workarounds, but none of them have worked as expected.
What I need is to run Playwright tests against multiple URLs. Currently, running tests in a single project works perfectly fine and I already have some tests set up. However, I now want to introduce multiple projects with the best possible configuration.
For example, my './tests/ProjectA' runs against 'https://projectA.home.com' './tests/ProjectB' runs against 'https://projectB.home.com' with different credentials and so on.
I would like both Project A & B to run against every release in a single run.
I am considering a config file like the one below with specific 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
},
},
],
Challenge: I want to determine which test directory my current worker is pointing to at the 'globalSetup' level so that I can authenticate and bring up the URL accordingly.
How can I access Project information at the globalSetup level? Or what is the best way to handle this challenge? Any suggestions would be greatly appreciated. Thank you!!