Most bugs that need two accounts to find are about one account changing what another sees: a seller edits a price while a buyer has it in the basket, an admin removes a permission while the user's page is open, two people edit the same record. Testing your app with multiple user accounts comes down to three things done once: accounts that exist on purpose, a separate browser session for each, and a fast way back to "signed in". Everything below assumes it is your app, or one you are hired to test, in a staging or test environment.

Step 1: seed one account per role

Write the test users into the database with the seed script, not by hand through the sign-up form. A hand-made account drifts: someone changes its password, finishes its onboarding, or deletes it during a demo, and the test that relied on it fails for a reason nobody can see.

A useful starting set for a marketplace-style app:

AccountWhy it exists
admin@testevery permission, for setup and for checking audit logs
seller-a@test, seller-b@testtwo of the same role, to prove one cannot see the other's data
buyer-new@testno history, for onboarding and empty states
buyer-old@testyears of orders, for pagination and slow queries
buyer-2fa@testtwo-factor on, so the sign-in path with a code is tested too

The pair of identical roles is the one teams skip, and it finds the worst bugs: a query missing its tenant filter returns seller B's orders to seller A, and with only one seller account every result looks right.

Step 2: give every account its own browser session

Two accounts in two tabs of the same browser are one session, because the tabs share cookies. Sign in as the buyer in the second tab and the seller's tab becomes the buyer on its next request. Each account needs its own cookie store: separate browser profiles by hand, or separate browser contexts in an automated test. The options and their limits are laid out in testing multiple sessions in the same browser.

Each profile keeps its own passwords and its own 2FA codesIn Mosaic: Logins and 2FA codes. A password vault and TOTP codes for each profile. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

How it works: Logins and 2FA codes

Step 3: save the signed-in state

Signing in through the form in every test is slow and makes every test depend on the login page. Playwright's pattern is a setup project that signs in once per role and writes each session to a file, which later tests load as storageState (Authentication, read 2 November 2026). For roles that interact, its documentation uses two contexts in one test:

test("seller sees the buyer's order", async ({ browser }) => {
  const seller = await browser.newContext({ storageState: 'playwright/.auth/seller.json' })
  const buyer = await browser.newContext({ storageState: 'playwright/.auth/buyer.json' })
  // act as the buyer, then assert on the seller's page
})

The same page carries a warning worth repeating: the state file "may contain sensitive cookies and headers that could be used to impersonate you or your test account", and Playwright discourages checking it into any repository. Put playwright/.auth in .gitignore.

Step 4: write the cases where accounts meet

With accounts and sessions in place, the cases worth writing are the cross-account ones:

  1. Isolation. Seller A cannot reach seller B's records by guessing an ID in the URL or the API.
  2. Live changes. A permission revoked by the admin takes effect on the user's open page, without waiting for them to sign in again.
  3. Concurrency. Two users save the same record a second apart; the app keeps one, says so, and does not silently merge.
  4. Notifications. An action by one account reaches the other's inbox, bell or websocket, once.
  5. Sign-out. Signing one account out does not end another account's session in a different browser.

Testing your app with multiple user accounts by hand, in Mosaic

Manual and exploratory testing needs the same separation, with a person at the keyboard. In Mosaic, each test account gets a profile: a browser with its own cookie jar and storage that stays signed in across restarts, its own proxy if the test depends on the network, and its own fingerprint. That last part matters when the app scores devices, because two accounts in two Chrome profiles still report one machine.

  1. Click New profile for each account and name it after the role: "Seller A", "Seller B", "Buyer (2FA)".
  2. Sign each in once. Save the account's password, and its two-factor setup key if it has one, in that profile's Logins tab (the Two-factor secret field), so the code is there when the session expires. A setup key that cannot produce a code is refused when you save it (logins and 2FA).
  3. Start the profiles a test needs, select them, and use Arrange to put the windows side by side.
  4. Tag the test profiles, say staging, and filter the table by that tag, so they never mix with anything else on the machine.
The Mosaic profiles table: names, coloured tags, proxy locations and a Start button on each row
One profile per test account, named after its role

On Pro, the local REST API starts a profile and returns its DevTools endpoint, so the same signed-in profiles can run your Playwright suite through connectOverCDP (REST API). Mosaic is a desktop app, so this suits a tester's own machine rather than CI. Pro is $25 a month, and a new account starts on Free with 3 profiles and no card, as pricing shows.

Sources

  1. Playwright docs: Authentication, read November 2, 2026
  2. Playwright docs: Isolation (browser contexts), read November 2, 2026