microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.54k stars 3.64k forks source link

[Question] Can I use multiple storageState in a single spec file? #19115

Closed gineanne closed 1 year ago

gineanne commented 1 year ago
Example:

test.describe(), async() => {
    test.use({storageState: '/user1'});
    test('test 1', async ({

    }))

    test.use({storageState: '/user2'});
    test('test 2', async ({

    }))
}
pavelfeldman commented 1 year ago

No, you would need to place them in different (nested) describes blocks. Otherwise your user2 overwrites user1.