Skip to content

[Bug]: StorageState timeout  #29450

Closed
Closed

Description

Version

1.41.2

Steps to reproduce

The issue happens somewhere during this test

import { expect, test as setup } from '@playwright/test'

const BASE_URL = 'http://localhost:5173'
const authFile1 = 'playwright/.auth/user1.json'
const authFile2 = 'playwright/.auth/user2.json'

setup.describe.configure({ mode: 'serial' })

setup('authenticate as test1', async ({ page }) => {
  await page.goto(`${BASE_URL}/`)

  const email = 'test@capgo.app'

  // Fill in the username and password fields
  await page.fill('input[name="email"]', email)
  await page.fill('input[name="password"]', 'testtest')

  // Click the submit button
  await page.getByRole('button', { name: 'Log in' }).click()

  // Expect the URL to change to the logged in dashboard
  await expect(page).toHaveURL(`${BASE_URL}/app/home`, { timeout: 60_000 })

  await page.evaluate(email => localStorage.setItem('supabase-email', email), email)
  await page.context().storageState({ path: authFile1 })
})

setup('authenticate as test2', async ({ page }) => {
  await page.goto(`${BASE_URL}/`)

  const email = 'test2@capgo.app'

  // Fill in the username and password fields
  await page.fill('input[name="email"]', email)
  await page.fill('input[name="password"]', 'testtest')

  // Click the submit button
  await page.getByRole('button', { name: 'Log in' }).click()

  // Expect the URL to change to the logged in dashboard
  await expect(page).toHaveURL(`${BASE_URL}/app/home`, { timeout: 60_000 })

  await page.evaluate(email => localStorage.setItem('supabase-email', email), email)
  await page.context().storageState({ path: authFile2 })
})

I was never able to reproduce locally but it happens sometimes on the CI/CD. It's not very consistent on the CI/CD - sometimes it works and sometimes it doesn't

Expected behavior

I expect page.context().storageState({ path: authFile2 }) to never fail or timeout

Actual behavior

page.context().storageState({ path: authFile2 }) times out randomly making the test really unreliable.
The trace looks something like this:
image

It makes no darn sense - why would this ever timeout?

Additional context

I have reported this issue in the past here but then the traces were corrupt. I was told my issue is similar to something else but actually it was never addressed. Yes, the traces are no longer corrupt but the timeout is still here

Environment

Run bunx envinfo --preset playwright
 Resolving dependencies
 Resolved, downloaded and extracted [4]
 Saved lockfile

  System:
    OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (4) x64 AMD EPYC 7763 64-Core Processor
    Memory: 13.36 GB / 15.61 GB
    Container: Yes
  Binaries:
    Node: 18.19.0 - /opt/hostedtoolcache/node/18.19.0/x64/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 10.2.3 - /opt/hostedtoolcache/node/18.19.0/x64/bin/npm
    bun: 1.0.26 - ~/.bun/bin/bun
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  npmPackages:
    @playwright/test: 1.41.2 => 1.41.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions