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.

Test frontend services

See original GitHub issue

This is intended as a starter project for newer contributors but if you’re already a contributor for some time, you can help as well.

NOTE: Please ping @nithusha21 if you have any questions about this issue or would like to be assigned to some part of it.

In order to prevent future regressions, we want to ensure that all services in our frontend codebase are thoroughly tested. If it’s your first time here, please read carefully the guide of how to get started with frontend unit testing: Guide for writing frontend tests. Please use this guide as your helper, all the instructions of how to test properly is in it.

Also, here is Oppia’s wiki page for running the client-side Karma tests.

The services are separated by three levels of complexity:

Complexity Easy Medium Hard
Number of lines up to 100 lines up to 250 lines at least 250 lines

Then, it doesn’t matter if you’re new to unit test or if you’re looking for something more challenging, there will be service for you work with.

Each file is marked with two information that will help you to decide which service to pick. For example:

  • A - B service-name.service.ts

A means the service complexity: E for Easy, M for medium and H for Hard. B means if the service has a spec file: Y for Yes and N for No.

Spec files for services tests consist of the name of the service, followed by .spec.ts or Spec.ts, it depends of the service file name structure:

  • Use .spec.ts for services like: service-name.service.ts
  • Use Spec.ts for services like: ServiceNameService.ts When writing tests, if a spec file already exists for the service you have picked, then edit the existing file. If a spec file isn’t present yet, create a new file and name it accordingly. You can also take a look at the existing spec files for different services to get an idea on how to get started.

Note: We are currently in the process of upgrading AngularJS to Angular. If the service is written in AngularJS, write the test in AngularJS. If the service is written in Angular, write the test in Angular. We would also prefer to cover all Angular files before moving to AngularJS files to prevent extra work during the migration.

If you’d like to help with this issue, please select a file from the list below, comment on the thread with the file name or any query you’d like to be assigned, and submit a PR when you’ve completed writing the test. Once the PR is submitted, you can tick the checkboxes.

PR’s for reference: #4135 #8916 #8934


Files to write tests for or increase until 100%:

Angular files

  • core/templates
    • components/graph-services
      • H - N graph-layout.service.ts
    • components/state-editor
      • M - Y state-editor.service.ts @Deepam101
      • M - Y state-property.service.ts
    • domain/collection
      • M - Y collection-node.model.ts @Nisarg-Chaudhari
      • H - Y collection.model.ts
      • E - N collection-playthrough.model.ts @karthikshetty03
      • M - Y editable-collection-backend-api.service.ts
      • M - Y read-only-collection-backend-api.service.ts
    • domain/question
      • E - Y pretest-question-backend-api.service.ts @wcascades
    • domain/skill
      • H - Y SkillObjectFactory.ts
    • domain/state_card
      • M - Y StateCardObjectFactory.ts
    • domain/story
      • M - Y editable-story-backend-api.service.ts @kaushambisharma
      • H - Y StoryContentsObjectFactory.ts
      • H - Y story-node.model.ts
    • domain/topic
      • M - Y SubtopicObjectFactory.ts
      • M - Y SubtopicPageObjectFactory.ts
      • H - Y TopicObjectFactory.ts
    • domain/topics_and_skills_dashboard
      • E - Y topics-and-skills-dashboard-backend-api.service.ts @michaelw54
    • domain/utilities
      • M - Y language-util.service.ts @laujamie
      • M - Y url-interpolation.service.ts
    • expressions
      • M - Y expression-evaluator.service.ts
      • M - Y expression-interpolation.service.ts
    • pages/community-dashboard-page
      • M - Y contribution-opportunities-backend-api.service.ts
    • pages/email-dashboard-pages
    • pages/exploration-editor-page
      • H - N exploration-diff.service.ts
      • M - Y version-tree.service.ts
  • pages/exploration-player-page
    • E - Y audio-translation-manager.service.ts @Nik-09
    • M - Y answer-classification.service.ts
    • M - Y audio-preloader.service.ts
    • M - Y current-interaction.service.ts
    • E - N exploration-recommendations.service.ts @TheoLipeles
    • M - Y learner-answer-info.service.ts
    • E - N player-correctness-feedback-enabled.service.ts @soumyo123-prog
    • M - Y player-transcript.service.ts
    • H - N question-player-engine.service.ts @ehwu
    • H - N stats-reporting.service.ts
  • pages/story-editor-page
    • M - Y story-editor-state.service.ts
  • services
    • E - N autogenerated-audio-player.service.ts
    • H - Y context.service.ts @HarshKhilawala
    • E - Y csrf-token.service.ts @Nik-09
    • E - Y html-escaper.service.ts @Nik-09
    • M - N messenger.service.ts
    • E - Y promo-bar-backend-api.service.ts @tanishq67
    • M - N request-interceptor.service.ts
    • M - Y state-top-answers-stats.service.ts
    • E - Y utils.service.ts @HarshKhilawala
  • extensions
    • classifiers
      • H - Y python-program.tokenizer.ts
      • H - Y svm-prediction.service.ts
    • extensions
      • M - N base-interaction-validation.service.ts
      • H - Y code-repl-prediction.service.ts
      • E - Y continue-rules.service.ts
      • M - Y drag-and-drop-sort-input-validation.service.ts
      • E - N end-exploration-rules.service.ts @SAEb-ai
      • H - Y fraction-input-validation.service.ts
      • E - N graph-detail.service.ts @safwan20
      • M - Y graph-input-rules.service.ts
      • M - Y graph-input-validation.service.ts
      • M - N graph-utils.service.ts @atpug22
      • M - Y item-selection-input-validation.service.ts
      • M - Y music-notes-input-rules.service.ts
      • E - N music-phrase-player.service.ts @HarshKhilawala
      • M - Y number-with-units-validation.service.ts @akshayrathi2102
      • M - Y numeric-input-validation.service.ts @EeshaArif

AngularJS files

  • core/templates
    • components/entity_creation
      • M - N exploration-creation.service.ts
      • E - N skill-creation.service.ts @LakmaNeha
      • E - N story-creation.service.ts @taiwo2
      • E - N topic-creation.service.ts
    • domain/collection
      • H - Y collection-update.service.ts
    • domain/question
      • M - Y question-update.service.ts
    • domain/skill
      • H - Y skill-update.service.ts
    • domain/story
      • H - Y story-update.service.ts
    • pages/community-dashboard-page
      • M - Y contribution-and-review.service.ts
      • E - N contribution-opportunities.service.ts
      • M - N translate-text.service.ts
    • pages/exploration-editor-page
      • M - N change-list.service.ts
      • H - N exploration-save.service.ts
      • H - Y exploration-states.service.ts
      • E - N state-tutorial-first-time.service.ts @safwan20
      • M - N suggestion-modal-for-exploration-editor.service.ts
      • M - N voiceover-recording.service.ts
    • pages/exploration-player-page
      • H - N exploration-engine.service.ts
      • H - Y exploration-player-state.service.ts
      • E - N fatigue-detection.service.ts
      • M - N hint-and-solution-modal.service.ts @Radesh-kumar
      • M - Y learner-answer-info.service.ts
      • E - N refresher-exploration-confirmation-modal.service.ts
      • M - N suggestion-modal-for-exploration-player.service.ts
    • pages/skill-editor-page
      • M - Y skill-editor-state.service.ts
    • pages/topic_editor
      • topic-editor-state.service.ts
    • services
      • M - N audio-player.service.ts
      • E - Y image-upload-helper.service.tests @sachinchauhan2889
      • E - N translation-file-hash-loader.service.ts

Click to see the list of completed work.

Note: For a guide on how to access Oppia’s webpages, see this.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:313 (272 by maintainers)

github_iconTop GitHub Comments

1reaction
arpit1912commented, Apr 2, 2021
1reaction
U8NWXDcommented, Mar 29, 2021

@LakmaNeha the people I talked to said they see this occasionally, but it’s intermittent for them. They didn’t have a solution. If you want to get the VScode linter working, you could ask on oppia-dev to see if someone has a solution. Alternatively, you could ignore the VScode lint errors and run the linter manually instead with scripts/linters/pre_commit_linter.py

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Front End Testing? - Guru99
Front End Testing is a testing technique in which Graphical User Interface (GUI), functionality and usability of web applications or a software ...
Read more >
Front-End Testing is For Everyone - CSS-Tricks
Front-end testing is for the client side of your application. For example, front-end tests can validate that pressing a “Delete” button properly ...
Read more >
A Comprehensive Guide to Front End Testing - Perfecto
Front end testing is performed to check the functionality and usability of an application's GUI. It usually involves validating menus, forms, ...
Read more >
Frontend Testing: A Guide for 2022 and Beyond - Netguru
Frontend testing, therefore, refers to the checks performed to test the usability and functionality of your application's GUI. Usually, this ...
Read more >
Testing Frontend Apps — what, where, how? - ITNEXT
Targets all the code excluding backend services · Each test should implement acceptance criteria of the test case that reflects one of at...
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