playwright: [Bug]: Devops Pipelines/Releases fail to run npx playwright test

Playwright version

1.12.3

Operating system

Windows

What browsers are you seeing the problem on?

Chromium

Other information

npm/6.14.13 node/v14.17.3 win32 x64

Azure Release : Agent.Version 2.188.4 Windows 2019

In package.json “@playwright/test”: “^1.12.3”, “playwright”: “^1.12.3”,

What happened? / Describe the bug

When I try to run npx playwright test in a Pipelines/Releases I got this error

If I run manually on same server same code (in release deploy directory) it work

2021-07-13_14-41-33

Code snippet to reproduce your bug

npx playwright test

Relevant log output

021-07-13T17:35:20.4031005Z ##[section]Starting: Run Playwright Test 
2021-07-13T17:35:20.4155036Z ==============================================================================
2021-07-13T17:35:20.4155649Z Task         : Command Line
2021-07-13T17:35:20.4156001Z Description  : Run a command line with arguments
2021-07-13T17:35:20.4156302Z Version      : 1.1.3
2021-07-13T17:35:20.4156597Z Author       : Microsoft Corporation
2021-07-13T17:35:20.4157052Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
2021-07-13T17:35:20.4157535Z ==============================================================================
2021-07-13T17:35:20.4186740Z ##[debug]Working directory: 'C:\AzurePiplinesAgent_Extension\_work\r4\a\GMaster\DevDrop\test_e2e'
2021-07-13T17:35:20.4196097Z ##[debug]Fail on standard error: 'False'
2021-07-13T17:35:20.4196492Z ##[debug]Modify environment: 'False'
2021-07-13T17:35:20.4196878Z ##[debug]C:\windows\system32\cmd.exe /c "npx playwright test"
2021-07-13T17:35:20.4197250Z ##[command]npx playwright test
2021-07-13T17:35:22.5056679Z Error: Error while reading C:\AzurePiplinesAgent_Extension\_work\r4\a\GMaster\DevDrop\test_e2e\e2e\playwright\use-case\add-new-patient.uctest.spec.ts:
2021-07-13T17:35:22.5058090Z describe() can only be called in a test file
2021-07-13T17:35:22.5956884Z ##[error]Process completed with exit code 1.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (5 by maintainers)

Most upvoted comments

OMG Thanks @ychaudhari I try run “npm run test” with “Powershell” task instead of “Command Line” Task and now test work in Pipeline/Release …

Really Command line task and/or Playwright/Test have a bug

I have the opposite problem:

Running “npx Playwright test” in Powershell results in “Error: test() can only be called in a test file” Doing the same from command prompt works fine.

FYI, I 'm new to Playwright. Just following the instructions here: https://playwright.dev/docs/intro (First Test section)

UPDATE: oddly enough, it fails no matter what shell I use in the VS Code integrated terminal…

If it helps anyone, my issue was somehow related to the terminal I was using (Cmder)… Tests worked fine without any error using powershell, git bash or cmd. Could not pinpoint the issue with Cmder (or the specific environment setup in Cmder) but was able to work with other terminals and updated Cmder version.