End-to-end tests with cypress (e2e-cypress)
cypress e2e testing quickstarter project
What files / architecture is generated?
. ├── Jenkinsfile ├── README.md ├── files │ ├── README.md │ ├── build │ │ ├── integration │ │ │ └── main.spec.js │ │ └── support │ │ ├── commands.js │ │ └── index.js │ ├── cypress.json │ ├── fixtures │ │ └── example.json │ ├── integration │ │ └── main.spec.ts │ ├── package.json │ ├── plugins │ │ └── index.js │ ├── support │ │ ├── commands.ts │ │ └── index.ts │ ├── tsconfig.json │ └── tslint.json └── init.sh 9 directories, 16 files
Frameworks used
This project is generated by Angular CLI
Usage - how do you start after you provisioned this quickstarter
-
Run command
npm install
in project directory to install npm packages -
Run
npm run e2e
to execute the end-to-end tests via cypress against the test instance of the front end -
Run
npm run watch
to develop the e2e test. The tests will automatically rebuild and run, if you change any of the source files. The test will run against a local instance of the front end, e.g.localhost:4200
. This destination is configurable incypress.json
. Provide credentials for a test user by defining them in a file calledsecrets.json
inside the base directory. This file should have the following format:
{ "e2e": { "testUserName": "User Name", "testUserPassword": "xxxx" } }
Please note: secrets.json
is mentioned in .gitignore
to prevent it from being added to version control. Please keep it this way.
How this quickstarter is built through jenkins
The Jenkinsfile is provisioned with this quickstarter to ease CI/CD process. In Jenkinsfile, there is the following stage:
-
stageTest - Lint the TypeScript code by running
npm install
andnpm run lint
, and transpiles it to JavaScript and run the tests with thenpm run build
command.
Builder Slave used
This quickstarter uses Nodejs10-Angular builder slave Jenkins builder slave.