-
Step0
- install NodeJs
-
Step1
- Create folder for tests in your project or not
-
install cypress
-
npm install cypress -global
-
follow instructions
- https://docs.cypress.io/guides/getting-started/installing-cypress.html#Direct-download
-
install dependencies
- nmp i
-
Step2
-
adapt your cypress.json file
- {
"projectId": "xxxxxx",
"baseUrl": "https://xxxxx.com",
"viewportWidth": 1920,
"viewportHeight": 1080,
"defaultCommandTimeout": 30000,
"chromeWebSecurity": false
}
-
Step3
-
write your fist Test
- https://docs.cypress.io/guides/getting-started/writing-your-first-test.html#Add-a-test-file
-
Step4
-
create Dash
- https://docs.cypress.io/guides/core-concepts/dashboard-service.html#Overview
-
Step5
-
Run Test
-
with GUI
- cypress open
-
with Dash
-
cypress run --record --key <your key>
- use with docker
-
WHY
- Cypress is executed in the same run loop as your application
- quick start
- easy cross browser
-
dockerize
-
to pipeline
-
create Docker file
- FROM cypress/base:10
WORKDIR /app
# dependencies will be installed only if the package files change
COPY package.json .
COPY package-lock.json .
RUN npm install
# by setting CI environment variable we switch the Cypress install messages
# to small "started / finished" and avoid 1000s of lines of progress messages
# https://github.com/cypress-io/cypress/issues/1243
ENV CI=1
RUN npm ci
# verify that Cypress has been installed correctly.
# running this command separately from "cypress run" will also cache its result
# to avoid verifying again when running the tests
# RUN npm cypress verify
COPY cypress cypress
COPY cypress.json .
CMD [ "npm", "run", "start" ]
-
clear runner
- https://docs.cypress.io/guides/core-concepts/test-runner.html#Overview
-
NO addition report service
- cypress app
- Dash board
-
easy to create screenshots
- cy.screenshot();
- 1.Logs 2. errors 3. video for each test