This is a project which you can use to start your E2E testing with Cypress by azure CI/CD.
- Parallel execution
- Cross Browser Testing (Using Chrome,FireFox & Edge)
Demo azure pipeline
- Create a project directory and Clone the project:
git clone https://github.com/QACodeDev/cypress-pipeline-demo.git
- Under the project directory install the followings:
npm install
In order to start using this project. You will have to do the following steps:
Provide the username
, password
, and baseUrl
in cypress.json and put other required test data.
Start by creating a new variable group on Azure DevOps. I use two, one for my DEV branch and one for my master branch. If you only want to use one branch or one environment, you can remove the dynamic grouping expression in the azure-pipelines.yml file. Add the following variables to the group: CI: true cypress_project_id: - the ID of the project Cypress gave you. cypress_record_key: - If you want to record to Cypress.io. verbose: true or false - Allows you to run the pipeline in verbose mode, and will add some extra logging. Cypress will also run in DEBUG mode by setting it to true. In the azure-pipelines.yml file, update the dynamic group name variables from vargroup-master and vargroup-dev to your corresponding group names.
- Under the project directory run the following npm command:
npm run cy:open
- Under the project directory run the following npm command:
npm run cy:run:headless
- Under the project directory run the following npm command:
npm run cy:chrome
- Under the project directory run the following npm command:
npm run cy:firefox
- Under the project directory run the following npm command:
npm run cy:edge
- Under the project directory run the following npm command:
npm run cy:run:record
- Alternative command :
$(npm bin)/cypress run -b chrome -s "**/*spec.j,baseUrl='<app_url>',username='<username>,password='<password>'
-
During test execution locally if any test fails, screenshot with execution log will be taken for that. Screenshots will be available under the path:
cypress-pipeline-demo/cypress/screenshots
-
Junit xml reports are created under the path:
cypress-pipeline-demo/cypress/reports
-
By default capturing test videos is turned off by the
cypress.json
. If needed, can be possible to turn it on there.if enabled the you can find videos under the path:cypress-pipeline-demo/cypress/videos
- Got to build artifacts for screenshots and videos
- Go to tests tab under pipeline for test results
- Chrome
- Firefox
- Edge