This repository contains end-to-end (E2E) tests written in Cypress for various Open edX applications.
Cypress is a modern automated testing tool that is rapidly gaining popularity.
Cypress has excellent documentation, so newcomers can find most information directly on their website.
Automated tests are focused on verifying critical functionality (marked with the @smoke tag). Additional tests can be added for various open edX functionalities, such as validation message checks (marked with the @regression tag).
- LMS: Authentication: Registration
- LMS: Course About Page
- LMS: Course Discovery
- LMS: Course Home
- LMS: Dashboard
- Studio: Content: Outline: Unit
- Studio: Home
- LMS: Course Home: Progress
- LMS: Course Home: Tools
- LMS: Instructor: Data Download
- LMS: Instructor: Membership
- Studio: Content: Outline: Unit: Component
- Studio: Settings: Advanced
- Studio: Settings: Certificates
- Studio: Settings: Schedule & Details
- Studio: In-Context Metrics
There are not yet well-defined protocols for writing Cypress tests for Open edX applications, so this work is mostly experimental.
Suggestion: The test case structure should follow the guidelines of the community test documentation.
The code is generalized, allowing multiple projects to be run by setting environment variables, without modifying the code.
You must have Node.js installed before using Cypress.
To install Cypress and supporting tools, navigate to the project folder in your terminal and run:
npm install
Set the following environment variables before running the tests:
PLATFORM_NAMEBASE_MFE_URLBASE_CMS_URL
ADMIN_USER_NAME- Staff usernameADMIN_USER_EMAIL- Staff emailADMIN_USER_PASSWORD- Staff password
LMS_USER_NAME- Learner usernameLMS_USER_EMAIL- Learner emailLMS_USER_PASSWORD- Learner passwordEXISTING_USER_FOR_BLOCK- Username for verifying the allowed number of login attempts
ENABLE_CREATE_NEW_COURSE_FOR_UNIT_TESTS- Used for course creation; set tofalseafter the first runENABLE_REGISTER_NEW_USER- Set totrueto test the registration flowENABLE_BULK_EMAIL_FLAG- Set totrueto verify course email settings on dashboard (ensure bulk email flag is enabled in admin)ENABLE_SUPPORT_URL- Set totrueto verify the help link on dashboardENABLE_PROGRAMS- Set totrueto verify ProgramsENABLE_CREATE_NEW_COURSE- Set totrueto verify creating a new course with a new organization
-
Verify Cypress installation:
npm run cy:verify -
Open Cypress Test Runner (interactive mode):
npm run cy:open -
Run all tests headless (CLI):
npm run cy:run -
Run only smoke tests (uses grepTags plugin):
npm run cy:run:smoke -
Run only regression tests:
npm run cy:run:regression
ESLint is also set up in the repo. You can run it using the following command in your terminal:
npm run lint