Reputation: 504
My Playwright scripts are configured to run in parallel (default) on Chrome, FF and Safari.
import { devices, PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
...
workers: 3,
fullyParallel: false,
},
projects: [
{
name: 'Chrome',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'Firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'Safari',
use: { ...devices['Desktop Safari'] },
},
],
One of my spec files has the below code
test.describe('Home Tests', () => {
let page: Page;
let homeView: HomeView;
test.beforeEach(async ({ page }) => {
homeView = new HomeView(page);
});
test('01', async () => {
await dashboard.login(false, ownerEmail);
...
});
test('02', async () => {
await dashboard.login(false, ownerEmail);
...
});
.
.
.
When I run this test, test 01 is taken up by all 3 browsers and executed in parallel. Due to technical login restrictions of the app, only one test passes and the rest fails. I want test 1 to run in Chrome first and once it is completed it should run on FF second and Safari next (which browser first doesn't matter)
I do not want to change the settings globally or make this possible on the CLI level. I want to handle this at the same spec file level. How can I achieve this?
Upvotes: 2
Views: 2333