Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright tests with the next fixture always fail (using experimental testProxy) #77449

Open
GRA0007 opened this issue Mar 24, 2025 · 1 comment
Labels
Testing Related to testing with Next.js.

Comments

@GRA0007
Copy link

GRA0007 commented Mar 24, 2025

Link to the code that reproduces this issue

https://github.com/GRA0007/next-test-proxy-repro

To Reproduce

  1. Set up a test with Playwright that uses the NextFixture to mock a request (following instructions from here)
  2. Run the tests, notice that if the NextFixture is used, the test fails with the error TypeError: Cannot destructure property 'complete' of 'undefined' as it is undefined.

Current vs. Expected behavior

I expect mocking a request to successfully mock the request without causing an error. All the tests I've set up in my reproduction should pass.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:51:54 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: 1.22.21
  pnpm: 10.6.5
Relevant Packages:
  next: 15.2.3 // Latest available version is detected (15.2.3).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Testing

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local)

Additional context

I initially started making this reproduction because I notice that the testProxy didn't work with GET route handlers, only with pages, but it seems something else is going on because I can't get any of the mocked tests to work.

@github-actions github-actions bot added the Testing Related to testing with Next.js. label Mar 24, 2025
@cedricss
Copy link

cedricss commented Mar 24, 2025

Same here. It looks like this issue occurs with @playwright/test version 1.51.
Downgrading to 1.50.1 works around the problem.

Also, see this recent comment about the "Test Step improvements" update: microsoft/playwright#27059 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing Related to testing with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants