Reputation: 3
My Playwright scripts are running fine in local. However same scripts are failing in Azure DevOps pipeline with the below error:
Error: Playwright Test did not expect test.describe() to be called here. Most common reasons include:
- You are calling test.describe() in a configuration file.
- You are calling test.describe() 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.
Error i am getting:
Azure pipeline yml file:
I have made sure
Upvotes: 0
Views: 559
Reputation: 35474
From your error message, I notice that the test file is under the path: TestCase-10459-StandarReport/tests/dashboard/alarm_count_quick_lists
.
In your YAML sample, you are executing the playwright command with the file path: tests/dashboard/alarm_count_quick_lists/xxx.js
The default working directory of the script task is s
folder.
So the cause of the issue can be that the command execution path has issues.
Test the similar YAML sample, I can reproduce the same issue:
To solve this issue, you need to set the correct workingDirectory
in the npx playwright test task.
For example:
- script: npx playwright test alarm_count_list.spec.js
displayName: 'Run Playwright test '
workingDirectory: $(System.DefaultWorkingDirectory)/TestCase-10459-StandarReport/tests/dashboard/alarm_count_quick_lists
env:
CI: 'true'
In this case, npx playwright test command will find the js file in the correct path.
Upvotes: 0