question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Write e2e tests for all functional capabilities

See original GitHub issue

This 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 the protractor.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.

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):

  1. Login to Oppia, selecting the checkbox to make yourself an administrator when you enter an email address
  2. Open the main menu by hovering over your profile picture in the upper-right corner and select Admin Page
  3. 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:

  1. Create a topic
  2. In that topic, create a story
  3. Create story nodes
  4. Go to /story/<story_id> to complete the story nodes
  5. 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

To run a practice session:

  1. Create a topic
  2. Assign some skills to the topic
  3. Create some questions and link them to those skills
  4. 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)
  • Exploration editor tabs (explorationFeedbackTab.js)
  • Profile features (profileFeatures.js)
    • (Easy) The navigation (using next and back buttons) works correctly in an exploration. - @nishantwrp
  • New structures
  • Harder tests to write due to issues like file upload, one-off jobs etc:
    • Move skill between subtopics and remove from topic (see #6404 for more details) @U8NWXD
  • 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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:161 (128 by maintainers)

github_iconTop GitHub Comments

2reactions
anubhavsinha98commented, Feb 13, 2019

Hi @nishikeshKardak, assigned you. Go ahead!

1reaction
Showtim3commented, Oct 30, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is End To End Testing? - BrowserStack
Explore end to end testing, a software testing technique that tests an application's workflow from beginning to end in real user scenarios.
Read more >
A Complete End to End (E2E) Testing Tutorial - LambdaTest
A comprehensive end to end Testing tutorial that covers what E2E Testing is, its importance, benefits, and how to perform it with real-time...
Read more >
What Is END-TO-END Testing: E2E Testing Framework with ...
Basically, End to End test performs functional as well as the architectural approach for any software or programs to validate system functions.
Read more >
What is END-To-END Testing? E2E Example - Guru99
END-TO-END TESTING is a type of Software Testing that validates the software system along with its integration with external interfaces.
Read more >
What is End-to-End Testing? | E2E Testing Tools - Katalon
What is End-to-End (E2E) Testing? All You Need to Know ; Developers · Testers · Managers ; Test planning · Test execution ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found