I'm using Playwright with nodejs and I have grouped a couple of tests together like this
import { test, expect } from '@playwright/test';
test.describe('Add a simple invoice test', () => {
test('01.Login & add an invoice', async ({ page }) => {
await page.goto("https://someUrl.com");
await page.fill('input[id="email"]', "someEmailAddress");
await page.fill('input[ng-model="ctrl.user.password"]', "somePassword");
await page.click('button[id="login-btn"]');
});
test('02.Add an invoice', async ({ page }) => {
await page.click('[name="invoice"]');
await page.click('button[id="addInvoiceButton"]');
await page.click('a[ng-click="ctrl.goToAddInvoice()"]');
await page.fill('#invoiceTitle', Math.random().toString(36).substring(7));
await page.fill('#exampleInputAmount', "120");
await page.click("#invoiceCategory")
await page.fill("#invoiceCategory > input", "Car")
await page.keyboard.press("Enter");
await page.click('button[id="submitInvoiceButton"]');
});
});
The problem is that these 2 tests run in parallel whereas 02 is dependant on 01 since there's a required login.
How do I make 2 grouped tests run in the same context?