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

Unable to run tests in terminal using scripts #32

Open
alendo opened this issue Jan 10, 2024 · 3 comments
Open

Unable to run tests in terminal using scripts #32

alendo opened this issue Jan 10, 2024 · 3 comments
Assignees
Labels
help wanted Extra attention is needed pending question Further information is requested

Comments

@alendo
Copy link

alendo commented Jan 10, 2024

🐞 Describe the question:
I'm not able to run the tests for Chapter-2 in the terminal using scripts. It is giving me error every time I run tests:

Error: Playwright Test did not expect test.beforeEach() to be called here.
Most common reasons include:

  • You are calling test.beforeEach() in a configuration file.
  • You are calling test.beforeEach() in a file that is imported by the configuration file.
  • You have two different versions of @playwright/test. This usually happens
    when one of the dependencies in your package.json depends on @playwright/test.

📸 Screenshots/GIFs/Videos:
Screenshot 2024-01-08 at 8 02 50 PM
Screenshot 2024-01-08 at 8 05 10 PM

Config file is exact as repo on GitHub:
Screenshot 2024-01-10 at 8 59 07 AM
Screenshot 2024-01-10 at 9 16 07 AM

🛝 Additional context:
I deleted the repo locally and cloned it again but still getting the error. Oddly enough, I can run the tests with Test Explorer

🎡 A picture of your pet or a toy or something really cool:
Thanks in advance for the help.

@alendo alendo added help wanted Extra attention is needed pending question Further information is requested labels Jan 10, 2024
@jamesjlopez
Copy link

I'm hitting the same issue for what it's worth

@deafinbothears
Copy link

I've also got the same issue as above.

@deafinbothears
Copy link

So I think I've found what's wrong. You'll need to update playwright in the project to make sure you can run the tests in terminal using scripts.

Steps:

  1. Open up the folder 'tau-introduction-to-playwright' in Visual Studio
  2. From the top navbar select Terminal > New Terminal
  3. Make sure the directory you see in terminal matches where you've put the project
  4. Update Playwright npm install -D @playwright/test@latest

Note that it may tell you to run the audit. Read the instructions and run the audit to fix anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed pending question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants