I want to run global setup before all the tests using project configuration. This is my playwright.config.ts file -
import { defineConfig } from '@playwright/test';
require('dotenv').config();
export default defineConfig({
testDir: './tests',
timeout: 60 * 1000,
expect: {
timeout: 5000
},
forbidOnly: !!process.env.CI,
workers: process.env.WORKERS ? +process.env.WORKERS : undefined,
projects: [
{
name: "setup",
testMatch: /.*\.setup\.ts/ ,
setTimeout: 60 * 1000,
},
{
name: "chrome",
dependencies: ['setup'],
use: {
headless: true,
browserName: "chromium",
viewport: { width: 1280, height: 720 },
ignoreHTTPSErrors: true
},
testMatch: '**/*.spec.ts'
}
],
reporter: [["list"], ["junit"]]
});
I have one global.setup.ts file in the same location as of playwright.config.ts. And all the test files are present in the directory ./tests/
This is the snapshot of my global.setup.ts file -
But my global.setup.ts file is not running before the tests. How to fix this?