← Back to Discord Forum

Group tests, sometimes storagestate is not being executed

When running a group of test files using a tag (@smoketest), some tests do not log in.
Is this a limitation to how many tests can be run at once? I am only running 27 tests.

I have removed the storage state out of the playwright config file and instead I am using test.use({ storageState: "playwright/.auth/login-user.json" })

Here is an example of one such error: 3) [chromium] › user-profile-page.ui.spec.js:16:7 › user profile page is displayed @smoketest ────

Error: Timed out 30000ms waiting for expect(locator).toBeVisible()

Locator: getByRole('button', { name: 'autotest' })
Expected: visible
Received: hidden
Call log:
  - expect.toBeVisible with timeout 30000ms
  - waiting for getByRole('button', { name: 'autotest' })

   8 |     await page.goto('/')
   9 |     await page.waitForLoadState()

10 | await expect(page.getByRole('button', { name: 'autotest' })).toBeVisible() | ^ 11 | const dashboard = new dashboardPage(page) 12 | await dashboard.userProfile.click() 13 | await expect(page.getByLabel('Nickname')).toHaveValue('autotest')

at C:\Users\Nate\Documents\KuvaPlaywright\kuvaApp\tests\user-profile-page.ui.spec.js:10:66

This thread is trying to answer question "Is there a limitation to how many tests can be run at once that could be causing intermittent login failures and timeouts when running a group of tests?"

2 replies

Here is the code of the test file import { test, expect } from '@playwright/test' import { dashboardPage } from '@pages/dashboard-page' import { profilePage } from '@pages/profile-page'

test.use({ storageState: 'playwright/.auth/login-user.json' })

test.beforeEach(async ({ page }) => { await page.goto('/') await page.waitForLoadState() await expect(page.getByRole('button', { name: 'autotest' })).toBeVisible() const dashboard = new dashboardPage(page) await dashboard.userProfile.click() await expect(page.getByLabel('Nickname')).toHaveValue('autotest') })

test('user profile page is displayed @smoketest', async ({ page }) => { expect(page.getByRole('img', { name: 'autotest' }).nth(1)).toBeVisible expect(page.getByText('Playwright User')).toBeVisible await expect(page.getByLabel('Name', { exact: true })).toHaveValue('Playwright User') await expect(page.getByLabel('Picture URL')).toBeVisible() await expect(page.getByText('Organizations KuvaKuva')).toBeVisible() await expect(page.getByRole('img', { name: 'autotest' }).nth(1)).toBeVisible() })

If I run the group of tests several times its not always the same test that fails like this

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.