To run @playwright/test in Azure DevOps, follow these steps:
First, install the Playwright Test task from the Azure DevOps Marketplace.
Add the Playwright Test task to your pipeline by editing your
Configure the task by specifying the path to your test files and selecting the browsers you want to test. You can also choose whether to show browsers during testing and set other options such as headless mode.
- task: PlaywrightTest@0 inputs: testFilesPath: '**/*.spec.ts' browsers: 'chromium,firefox,webkit' headless: true
If you need to install any dependencies before running your tests, such as Node.js or NPM packages, add these steps before running the Playwright Test task.
- task: NodeTool@0 inputs: versionSpec: '14.x' - script: npm ci
Once configured, run your pipeline in Azure DevOps. It will automatically execute your Playwright tests according to their configurations. Any errors or failures will be reported back through Azure DevOps.
Here's an example of a complete
trigger: branches: include: - main pool: vmImage: 'ubuntu-latest' steps: - task: NodeTool@0 inputs: versionSpec: '14.x' - script: npm ci - task: PlaywrightTest@0 inputs: testFilesPath: '**/*.spec.ts' browsers: 'chromium,firefox,webkit' headless: true
Now you're all set to run your @playwright/test tests in Azure DevOps!
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email email@example.com.