Skip to content

Instantly share code, notes, and snippets.

@kfatehi
Created July 28, 2022 18:06
Show Gist options
  • Save kfatehi/302fde5b7812699c132f9480749bda8b to your computer and use it in GitHub Desktop.
Save kfatehi/302fde5b7812699c132f9480749bda8b to your computer and use it in GitHub Desktop.
Playwright parallel independent sessions
import { test, expect } from '../helper/test.mjs';
import { signInProcess} from '../helper/sign_in_helper.mjs'
test('test', async ({ page, bpd, playwright }) => {
await Promise.all([
(async ()=>{
const browser2 = await playwright.chromium.launch();
const context2 = await browser2.newContext();
const page2 = await context2.newPage();
const pc2 = await bpd.createCompanyWithUsersContacts();
await signInProcess(page2)(pc2.company, pc2.user);
})(),
(async ()=>{
const pc1 = await bpd.createCompanyWithUsersContacts();
await signInProcess(page)(pc1.company, pc1.user);
})()
])
await page.locator('#foo').click();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment