projects: [
{
name: 'citizen-users-teardown',
testMatch: '**playwright/tests/bootstrap/users/citizen-users.teardown.ts',
},
{
name: 'citizen-users-setup',
testMatch: '**playwright/tests/bootstrap/users/citizen-users.setup.ts',
teardown: 'citizen-users-teardown',
},
{
name: 'citizen-auth-setup',
use: { ...devices['Desktop Chrome'] },
testMatch: '**playwright/tests/bootstrap/auth/citizen-auth.setup.ts',
dependencies: ['citizen-users-setup'],
teardown: 'citizen-auth-teardown',
},
{
name: 'citizen-auth-teardown',
use: { ...devices['Desktop Chrome'] },
testMatch: '**playwright/tests/bootstrap/auth/citizen-auth.teardown.ts',
},
{
name: 'full-functional',
use: {...devices['Desktop Chrome'] },
dependencies: ['citizen-auth-setup'],
},
],
I have this setup above for my playwright project. I am finding that when I do cmd + c in mac the teardown do not run, is there a way (without using playwrights global teardown) to ensure the teardown always runs even if tests are interrupted?
I ask this because during the teardown process I am using playwrights request: APIRequestContext object and my own custom playwright fixtures, which I cannot access using the global teardown or setup method.
I have tried asking ChatGPT which did not give me a good solution.