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 test runs successfully locally but encounters errors when executed on a different environment (such as after pushing to a git repo and running on a CI/CD pipeline or another machine) #30783

Closed
Amuthan07 opened this issue May 14, 2024 · 1 comment

Comments

@Amuthan07
Copy link

          I created playwright test files on my local machine, the test scripts were working for me

However when I pushed the same to a repo when I created a branch and tried to run it, it's not working
throwing the following error

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

  • You are calling test() in a configuration file.

  • You are calling test() 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.

    at Playwright/tests/Amazon/login.spec.js:6

    4 |
    5 |

6 | test('If sign-in button is there', async ({page}) => {
| ^
7 | //check if the sign-in button is present
8 | await page.goto(urlToTest);
9 | await page.getByRole('link', { name: 'Sign in', exact: true }).click();

at TestTypeImpl._currentSuite (/Users/amu/Downloads/amazon-playwright-automation/Playwright/node_modules/playwright/lib/common/testType.js:71:13)
at TestTypeImpl._createTest (/Users/amu/Downloads/amazon-playwright-automation/Playwright/node_modules/playwright/lib/common/testType.js:80:24)
at /Users/amu/Downloads/amazon-playwright-automation/Playwright/node_modules/playwright/lib/transform/transform.js:256:12
at Object.<anonymous> (/Users/amu/Downloads/amazon-playwright-automation/Playwright/tests/Amazon/login.spec.js:6:5)

Error: No tests found.
Make sure that arguments are regular expressions matching test files.
You may need to escape symbols like "$" or "*" and quote the arguments.

Originally posted by @Amuthan07 in #17500 (comment)

@Amuthan07 Amuthan07 changed the title I created playwright test files on my local machine, the test scripts were working for me Playwright test runs successfully locally but encounters errors when executed on a different environment (such as after pushing to a git repo and running on a CI/CD pipeline or another machine) May 14, 2024
@mxschmitt
Copy link
Member

This issue is not following the bug template. Please re-file and provide a self-contained reproduction, which we can run locally to reproduce your issue. Thanks for your understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants