aitk-qe
v1.0.1-AITK-96-contract-tests-65edee5.0
Published
Cypress Tests for AI Force
Downloads
12
Readme
Cypress integration tests for https://github.com/ImagineLearning/ai-toolkit/
[!NOTE] These instructions are based on https://github.com/edgenuity/mpng-automation-ui/blob/main/README.MD Please direct questions on Slack to the
#qa_cypress
channel on theImagine Learning Enterprise
workspace.
SETUP
Install Node 20+ (current: v20.11.1)
Install npm 10+ (current: 10.2.4)
Clone this repo and run npm i
CREATE .env FILE
Create a local .env
file in the root of the repo. The file MUST contain the following:
CYPRESS_TEAM=
CYPRESS_ENV=
CYPRESS_API_URL="https://cypress-director.imaginelearning.engineering/"
CYPRESS_ENV
specifies the environment where tests will run from your local machine:
"local"
"qa"
"prod"
CYPRESS_TEAM
specifies which team's data to use for tests:
"lmsadmin"
usesenv-mps-data
(this is the default test data if CYPRESS_TEAM is not provided)"edgeex"
uses...
"mpng"
uses ``
PLEASE DO NOT COMMIT YOUR LOCAL .env
FILE!
RUNNING TESTS
Cypress E2E UI (headed : local) Tests can be run using the Cypress E2E UI on your local machine. You can choose which test(s) to run and view it in realtime.
npm run cy-open
Sorry Cypress (headless : local)
Tests can be run on Sorry Cypress from your local machine.
Tests will run in the environment set in your .env
file.
Test tags are implemented with Gleb Bahmutov's cy-grep and can be
used to run a subset of tests:
@smoke
#to run tests with a tag, surround the tag in quotes
#run ALL tests with @smoke tag
npm run local '@smoke'
#to run tests with a tag OR another tag, surround each tag in quotes
#run ALL tests with @alladmin OR @teacher tags (||)
npm run local '@alladmin' '@teacher'
#to run tests with a tag AND another tag, concatenate tags with + and surround in quotes
#run ALL tests with @schooladmin AND @smoke tags (&&)
npm run local '@schooladmin+@smoke'
#to run tests with a tag AND another tag OR tests with a tag, combine the tagging methods
#run ALL tests with @teacher AND @smoke tags OR ALL tests with @student tag (&& and ||)
npm run local '@teacher+smoke' '@student'
Scripts are also included for local test runs:
__RUN ALL TESTS__
#run every test in the repo
npm run local
VIEWING TEST RESULTS
Cypress E2E UI (headed : local) Test results from Cypress E2E UI runs are stored in the repo directory:
cypress/reports/downloads
cypress/reports/screenshots
cypress/reports/videos
Sorry Cypress (headless : local or remote) Test results from local and CI/CD pipeline runs are stored online: Sorry Cypress Dashboard
TROUBLESHOOTING
CYPRESS E2E UI ISSUES
- Cypress E2E UI and Chrome can eat up a lot of memory. If you get the "Aw, Snap!" Chrome error message, you have to shut down Cypress entirely from the CLI and restart again. Restarting the Cypress E2E UI is not enough; the error will persist.
- In
cypress.config.js
, the valuenumTestsKeptInMemory
is set to 0 to save memory. This can be increased to view results from local test runs if desired but please remember to set to 0 on pushes.