Write e2e tests for all functional capabilities
See original GitHub issueThis project is aimed at writing e2e (end-to-end) tests for all functional capabilities. See this wiki page for information on e2e testing principles at Oppia. The general procedure to write such tests is as follows:
- Try manually doing the action you are trying to test.
- Get a list of smaller actions needed by the user to complete the action (like, click button X to navigate to page Y, then input “text” in component Z)
- At each stage, there should be some way to assert that the smaller action has completed. (This includes waiting for a page to load, waiting for a button to become clickable, etc).
- The e2e test written must perform the exact same set of smaller actions, and verify that the action is completed.
A few general guidelines while writing such tests:
- Always think from the perspective of the user, and not the code. You are trying to test the functionality and not the code that implements the functionality (The latter is already asserted by the unit testing framework).
- To prevent flakiness follow the patterns used in the testing suites already (like waitFor).
- Any common setup, like login, creating explorations, etc which needs to happen just once should be added to a “beforeAll” block, while setup that needs to happen for each test suite needs to go into a “beforeEach” block.
- Add appropriate classes in the HTML if needed. These labels should be of the form protractor-test-*. Do not use existing class selectors which do not follow this format.
- Tests should be granular (each of the below mentioned tests needs to go into separate test suites).
- The name of the file where the test needs to go in is given in brackets.
- Tests within a single file are run sequentially without resetting the program state. This means that if a test creates an exploration, for example, that exploration will still exist when the next test in that file runs. Try to avoid relying on previous tests having run, as this makes debugging difficult.
PR’s for reference: #8571 , #8639
To be assigned to a file or for any queries, comment on the thread and tag @U8NWXD .
To get started, ask to be assigned to any unclaimed task. Tasks are claimed by adding the username of the claimer to the end of the task, e.g. @example
.
Unclaimed Tasks
Interactions
- Create, edit, and play interactions. When creating interactions, specify feedback. When playing interactions, check that feedback is provided. The tests for a given interaction go in a
protractor.js
file in the interaction’s folder under/extensions/interactions/
and are loaded by the interactions e2e test file at/extensions/interactions/protractor.js
. For an example, see the test for the Continue button. You will need to create theprotractor.js
file specified below, implement the functions specified in the comments of the interactions e2e test file, and add your test to that interactions e2e test file. This task replaces parts of #4558 and #2731.- Drag and drop interaction:
extensions/interactions/DragAndDropSortInput/protractor.js
. Note that this one is challenging because protractor does not handle drag and drop very well. - Image Click Input Interaction (
/extensions/interactions/ImageClickInput/protractor.js
). This one is also challenging because it requires drag and drop functionality.
- Drag and drop interaction:
Less Important Interactions
- Set Input
- Pencil Code
- Music Notes
- Interactive Map
Claimed Tasks
Admin Page (adminTab.js
)
- Config values should be editable in the config tab. @jivthesh
- The various sections in the misc tab should work as expected. @krishnarao22
To access the admin page (note this only works when running Oppia locally):
- Login to Oppia, selecting the checkbox to make yourself an administrator when you enter an email address
- Open the main menu by hovering over your profile picture in the upper-right corner and select
Admin Page
- Select the tab you are writing tests for, for example
MISC
For examples of existing admin page tests, check out core/tests/protractor_desktop/adminTabFeatures.js
.
Play Audio Translations
- Play audio translations while playing an exploration. The test should create an exploration with audio translations and then check that those translations can be played. See #8089 for an example of how to upload audio in an end-to-end test. @krishnarao22
Blocked Tasks
Review Tests
- Review tests (see #7270 for more details)
To run a review test:
- Create a topic
- In that topic, create a story
- Create story nodes
- Go to
/story/<story_id>
to complete the story nodes - You should see a review test every 3 nodes
Practice Sessions
- Practice sessions (see #7263 for more details). This test should check the following workflows:
- Player Tests
- Run a practice session and answer all questions. Score should be 100%
- Run a practice session, answer one question, go back to the previous question, come back to the current question. Answer both questions correctly. Score should be 100%
- Run a practice session, use a hint in one question. Score should be 90%.
- Run a practice session, view a solution in one question. Score should be 50%
- Run a practice session, view the solution for one question
- Run a practice session, get two wrong answers. Score should be 80%
- Results Page Tests
- Run a practice session, get a wrong answer for one skill. Boost score button should open up the concept card of that skill
- Complete the practice session, click on the ‘Retry Test’ button. It should load a new practice session
- Complete a practice session, click on the ‘My Dashboard’ button. It should go to the topic viewer page
- Player Tests
To run a practice session:
- Create a topic
- Assign some skills to the topic
- Create some questions and link them to those skills
- Go to
/practice_session/<topic_name>
to see the practice session
Stats Modal
- Stats modal gets populated with the correct values. (see #7320 for more details)
Assigning Super-Admin Privileges
- Can assign super-admin privileges from the admin dashboard
Need to check with brianrodri, who wrote the dashboard
Resolved Tasks
List of resolved part of this issue:
- One-off jobs should be visible and runnable from the jobs tab. @Showtim3
- Creator Dashboard (creatorDashboard.js)
- The various tabs on the creator dashboard (exploration, collection, etc) are displayed with correct data when the user has created an exploration, collection, etc. @bansalnitish
- Add subject interests in the preferences page @nipan09
- View number of created explorations @LanJosh
- (Easy) Mark correct answers after enabling correctness feedback @nuajen.
- Assigning and viewing of roles should be possible in the roles tab. @Showtim3
- The stats shown on the creator dashboard update correctly. @bansalnitish #7491
- (Easy) The list view and the grid view on the creator dashboard work correctly. @bansalnitish
- (Easy) View explorations created by another user on their profile page - @marianazangrossi
- (Easy) View personal details of user (profile picture, bio, subject interests) - @U8NWXD
- Exploration player features
- Suggest a change to an exploration @Showtim3
- Explorations marked as play later are accessible under the “play later” tab of the learner dashboard. (learnerDashboard.js) @Showtim3
- Revert to an old commit in an exploration (explorationHistoryTab.js) @sagangwee
- Report an exploration (additionalEditorAndPlayerFeatures.js) @Showtim3
- Save an exploration to play later list (publicationAndLibrary.js) @Showtim3
- Subscribe to the user (profileFeatures.js) @apb7 (already covered in subscriptionFlow.js)
- Create and edit questions linked to any of the skills in the topic. @aks681
- Add description to story @aks681
- Edit title of story @aks681
- Edit story notes @aks681
- Add concept card contents @aks681
- Change skill description @aks681
- Add worked examples and misconceptions @aks681
- Create and edit questions linked to the skill @aks681
- Create a subtopic @aks681
- Edit subtopic page contents @aks681
- Delete subtopic @aks681
- Edit exploration properties (title, category, goal, language, etc) (coreEditorAndPlayerFeatures.js) @sophiewu6 (https://github.com/oppia/oppia/pull/6557)
- Add a bio to your profile (preferences.js) @yesass (https://github.com/oppia/oppia/pull/6512)
- Add exploration specific roles to users (coreEditorAndPlayerFeatures.js) (note: test already exists)
- Preferences (preferences.js)
- (Easy) Set your preferred dashboard - @hareshkh #7503
- (Easy) Change preferred site or audio language - @bansalnitish #7456
- Upload a profile picture @U8NWXD
- Exploration editor tabs (explorationFeedbackTab.js)
- (Easy) Message on a feedback thread @bansalnitish #7495
- (Easy) Change status of a feedback thread @bansalnitish #7484
- Profile features (profileFeatures.js)
- (Easy) The navigation (using next and back buttons) works correctly in an exploration. - @nishantwrp
- New structures
- Create, edit and delete chapters - @cuichenli
- Harder tests to write due to issues like file upload, one-off jobs etc:
- Add audio translations for the state content - @piotrhm
- Interactions
- Code Editor Interaction (
/extensions/interactions/CodeRepl/protractor.js
) @rohitkatlaa - Item Selection Interaction (
/extensions/interactions/ItemSelectionInput/protractor.js
) @nadintamer
- Code Editor Interaction (
Issue Analytics
- State:
- Created 5 years ago
- Comments:161 (128 by maintainers)
Top GitHub Comments
Hi @nishikeshKardak, assigned you. Go ahead!
@christinechengubc Thanks for letting us know. @nishantwrp I have assigned you the test. Feel free to ping me in case you run into any trouble or such.