This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Description
In the documentation there is reference to setting up authentication in globalSetup and then sharing that login across all test runs:
- Run tests (for example, with npm run test).
- Login via UI and retrieve authentication state.
- In Jest, this can be executed in globalSetup.
- In each test, load authentication state in beforeEach or beforeAll step.
This seems to suggest a setup like:
// jest.config.js
module.exports = {
globalSetup: '<rootDir>/jest.globalSetup.js',
preset: 'jest-playwright-preset',
setupFilesAfterEnv: ['expect-playwright', '<rootDir>/jest.setup.js'],
}
But there is nothing playwright-related setup when globalSetup runs:
// jest.globalSetup.js
module.exports = async function globalSetup() {
console.log('setting up', Object.keys(global));
};
So does going this route require manually setting up playwright, or is there some way to get access to the instance that jest-playwright-preset creates?