Skip to main content

Testing with Cypress

Cypress Demo

Environment Variables

Create a cypress.env.json file in the project root directory. Paste the contents of cypress.env.json.sample and update with your details.

Variables

VariableTypeDescriptionDefault
emailstringAccount email - used for login and signup when recording API callstest@example.com
passwordstringAccount passsword: used for login and signup when recording API callsqwerty123
cypress-plugin-autostub.apiHoststringThe API base URLhttp://localhost:3000
cypress-plugin-autostub.stubAPIPatternsstringPatterns to stubapi/.*
cypress-plugin-autostub.apiMaxWaitingTimenumberAPI request timeout duration60000
cypress-plugin-autostub.recordAPIbooleanEnable or disable API recording. If true, login requests will not be stubbed. email and password variables will be used for login requests.false
cypress-plugin-autostub.updateFixturesbooleanUpdate existing fixtures when recordAPI is true.false

Commands

yarn cy:open

Opens Cypress GUI

yarn cy:run

Runs all Cypress tests in a headless browser.

Filtering emails in Gmail account

Emails are all prefixed with devops+reos-cypress, EG: devops+reos-cypress.ownername@rentalconnect.co.za. If you're getting bombarded by emails it's probably a good idea to set up a Gmail filter to skip inbox and send to a label.

Recording API Fixtures

To be continued...