← Back to Discord Forum

Run tests against multiple URLs in one run

Hello everyone, I am looking into the option of running multiple Playwright tests on different URLs with one command. For example, I do npx playwright test and then tests run on URL1, URL2, URL3.. I know that we can use projects for this purpose, but is there a way to do this dynamically? Let's say if I want to reed the URLs from a file? Thanks!

This thread is trying to answer question "How can I run multiple Playwright tests on different URLs with one command, reading the URLs from a file and creating projects dynamically?"

5 replies

Read urls in the config and create projects dynamically

I am trying to do something like that: projects = testData.forEach((baseURL) => { console.log(baseURL); projects.push({ name: 'chromium', use: { ...devices['Desktop Chrome'], baseURL, }, }); });

but it doesn't seem to work on the test side. I also have issue with the global setup not recognizing the base url. How do you pass the baseUrl to the test?

doesn't work as if baseURL undefined?

otherwise your code looks ok

well except that you get multiple projects with same name, perhaps you should use different name

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.