-
Disclaimer: I am new to both cucumber and playwright, forgive any dumb questions. 😉 I am looking for a solution to avoiding expensive repeated logins. I have features with multiple scenarios. The scenarios are not dependent on one another, and I would like them to have separate context, and be able to run in parallel. This is the current behavior, but sometimes logging in to the app takes longer than what I am testing for in a single scenario. Is it possible to use playwright's reuse auth functionality? I can create that storage state file by running this in the BeforeAll hook: const page = await browser.newPage()
await page.goto('https://myapp.com/', { timeout: 10000 })
await page.locator('#email').fill(users['login_user1'].username)
await page.locator('#current-password').fill(users['login_user1'].password)
await page.locator('#password-button').click()
await page.context().storageState({ path: 'storageState.json' }) But there are some problems here.
Any advice is welcome. Including just saving me from spinning my wheels on something that will never go anywhere. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The biggest limitation I found with cucumber is the lack of beforeFeature. BeforeAll runs only once for all tests and before runs before each scenario. So if you are looking for something at the feature level it does not exist.
|
Beta Was this translation helpful? Give feedback.
The biggest limitation I found with cucumber is the lack of beforeFeature. BeforeAll runs only once for all tests and before runs before each scenario. So if you are looking for something at the feature level it does not exist.