This repository was archived by the owner on Jul 24, 2020. It is now read-only.
generated from E-Edu/microservice-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Cypress tests
msentwickler edited this page Apr 16, 2020
·
4 revisions
- Please write for your created pages and components tests
- Please look up here how to write them
- Test your app before making a pull request
- Start your localhost with
npm start - To run all tests:
npm run test:run - To open cypress and select a specific test:
npm run test:open
- Put all your tests under
cypress/integrationoutside thesrcfolder - Create for your test a new file with the schema:
name.spec.jsjust replace name with your filename
- Start your file with
describe('description', () => {...}replace description with yours in lowercase - Inside this you can place multiple
it('description', () => {...} - Inside this you can add some functions starting by
cyand your function:-
.get('element')[you can e.g. access a p tag or with a.a class ( be careful that a class can return an array ) -
.click()clicks on the element -
.eq(index)gets the elment with the specific index from an array -
.first()gets the first element form an array -
.should('include', 'text')[replace text with yours], checks if a element includes text e.g. the url -
.url()gets the url -
.type('text')[replace text with your input], type the text in an input -
.visit('url')[replace url with yours], navigate to the side but type forhttp://localhost:3000/just/ - you finde more under documentation
-