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 do not work on Github CI #31513

Closed
etc-tiago opened this issue Nov 16, 2021 · 4 comments
Closed

Playwright tests do not work on Github CI #31513

etc-tiago opened this issue Nov 16, 2021 · 4 comments
Labels
examples Issue/PR related to examples good first issue Easy to fix issues, good for newcomers

Comments

@etc-tiago
Copy link

etc-tiago commented Nov 16, 2021

What version of Next.js are you using?

12.0.4

What version of Node.js are you using?

14.x

What browser are you using?

Chrome Headless

What operating system are you using?

Ubuntu 18/20

How are you deploying your application?

Vercel

Describe the Bug

I did several tests this week and couldn't find the reason why nextjs doesn't work with headless on CI.

The test code can be found at https://github.com/etc-tiago/demo-nextjs-playwright-github-workflow

The start code is https://github.com/vercel/next.js/tree/canary/examples/with-playwright

Among the attempts are:

  • use the next dev command to start and test with playwright
  • use next build and next start and then start playwright.
  • use the next build command and start next start within playwright's web server settings.

Apparently there's something with react's hooks. Because the clicks on the button that use the next/router and switch of states are not working. Clicks on links work normally.

I did other tests using create-react-app, to validate if it's something related to react or nextjs, and the tests worked.

Expected Behavior

Tests pass when executing actions using hooks, such as useRouter (next/router) during tests with playwright

To Reproduce

The test code can be found at https://github.com/etc-tiago/demo-nextjs-playwright-github-workflow

@etc-tiago etc-tiago added the bug Issue was opened via the bug report template. label Nov 16, 2021
@timneutkens timneutkens added good first issue Easy to fix issues, good for newcomers examples Issue/PR related to examples and removed bug Issue was opened via the bug report template. labels Nov 19, 2021
@oliverpaulsen
Copy link

I tried to reproduce the bug and it only failed for mobile tests.
This was caused by the layout not being responsive and the "about" card being cut off.

I fixed it by adding

.container { height: auto; }

in the media query of the "Home.modules.css" file (line 116)

@etc-tiago
Copy link
Author

@oliverpaulsen I confess that I am ashamed. I've been working with CSS for years and I haven't thought about that detail. Thank you very much!

@TouchSek
Copy link

TouchSek commented Dec 9, 2021

@etc-tiago how did you resolved it? how to make it work in GitHub action?

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples good first issue Easy to fix issues, good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants