Being a test enthusiast and an Azure DevOps fanatic, I couldn’t resist writing this article. In this article, we will learn how to integrate Playwright scripts with Azure DevOps.
- Knowledge of Playwright, NodeJS and Azure DevOps
- Working tests using the above tech stack. If you don’t have one, feel free to use this
- Azure DevOps free account. Sign up here to get one
- Azure Repos to store the codebase
- Once you create a free account, log in into Azure DevOps.
- Create a new project with the details shown below by clicking Create Project button
3. Once your project is created, go to the Pipelines from the Left Menu
5. Now select the code repository from which we can use the code. In this case, the code is residing inside the Azure Repos, so we can click on the “Use Classic Editor” link.
8. Now, it’s time for us to configure the Job with information like agents, batch executions and triggering test cases. Let’s do them one by one. Firstly, let’s select the Agent Specification to “windows latest“
9. Click the ‘+’ icon near Agent job 1 and search for Node. We need to install Node Tool in our agent before we execute our test. Azure has a job that can do this for us. Once searched, click Add.
10. Configuring Node Task. Playwright supports from Node v14 and above. Hence, let’s configure the task to 16.x as given below.
Add this to the Script field :
npm install && npx playwright install
Go to Advanced –> Click on the little (i) icon and select the Link. This will enable the working directory for the task.
Select Custom for Command. Then add the below code in Commands & arguments.
14. Once all the configurations are done, it’s time for us to run it. Click on the ‘Save & Queue’ button.
What we have done till now is the Build Pipeline and there is a Release pipeline you can do as well.
Stay tuned & happy testing!
Image Credits: Google.com
Leave a Reply