To run your Playwright tests in an Azure Test Plans release pipeline without errors, follow these steps:
First, ensure you have the required dependencies installed in your project. Add @playwright/test
to your package.json
file:
{
"devDependencies": {
"@playwright/test": "^1.17.0"
}
}
Create a test script using Playwright. For example, create a file called example.spec.ts
with the following content:
import { test, expect } from '@playwright/test';
test('Check Ray.run homepage', async ({ page }) => {
await page.goto('https://ray.run/');
const title = await page.title();
expect(title).toBe('Ray.run - Playwright Test Automation');
});
In your Azure DevOps project, create a new release pipeline. Add an "npm" task to install the dependencies:
- task: Npm@1
inputs:
command: 'install'
Next, add a "Command Line" task to run the Playwright tests:
- script: npx playwright test
displayName: 'Run Playwright tests'
Save and run the release pipeline. Your Playwright tests should now execute without errors.
For more information on writing efficient Playwright test scripts, check out Tips for Writing Efficient Playwright Test Scripts.
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 protected].