Testing with Cypress
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
Variable | Type | Description | Default |
---|---|---|---|
email | string | Account email - used for login and signup when recording API calls | test@example.com |
password | string | Account passsword: used for login and signup when recording API calls | qwerty123 |
cypress-plugin-autostub.apiHost | string | The API base URL | http://localhost:3000 |
cypress-plugin-autostub.stubAPIPatterns | string | Patterns to stub | api/.* |
cypress-plugin-autostub.apiMaxWaitingTime | number | API request timeout duration | 60000 |
cypress-plugin-autostub.recordAPI | boolean | Enable 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.updateFixtures | boolean | Update 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...