Rayrun
← Back to Discord Forum

Running the same tests on multiple users

Dor Shinar
Dor Shinar

Hi 🙂 I'm wondering what is the best way to run a suite of tests on multiple users. I'm working on an app with free users and premium users, and I'd like to run the entire suite for both types of users with minimal test duplication. I was looking at https://playwright.dev/docs/auth#multiple-signed-in-roles which offers a way to run different tests with different users, but I can't find a good way to run the same tests for all users.

Our current solution is to store the users in an array and do something like:

users.map(user => {
  let page;
  test.beforeEach(() => {
    page = ...;
  });
  
  test(`${user} is logged in`, async () => {
    ...
  });
})

But I was wondering if there is a better way.

This thread is trying to answer question "What is the best way to run a suite of tests on multiple users with minimal test duplication?"

0 replies
TwitterGitHubLinkedIn
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.