kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Convert epub viewer table of contents unit tests to Vue Testing Library

Open rtibbles opened this issue 9 months ago • 16 comments

🙂 Looking for an issue? Welcome! This issue is open for contribution. If this is the first time you’re requesting an issue, please:

  • Read Contributing guidelines carefully. Pay extra attention to Using generative AI. Pull requests and comments that don’t follow the guidelines won’t be answered.
  • Confirm that you’ve read the guidelines in your comment.

Overview

Complexity: Low

Context

The test suites for the epub viewer's table of contents functionality (TocButton.spec.js, TableOfContentsSection.spec.js, TableOfContentsSectionSideBar.spec.js) currently use @vue/test-utils, which couples tests to component internals.

Related page:

Epub viewer showing TOC button in TopBar

The Change

Refactor these test files to use Vue Testing Library (VTL) and write tests that reflect how a user interacts with the table of contents:

  • kolibri/plugins/epub_viewer/frontend/views/__tests__/TocButton.spec.js
  • kolibri/plugins/epub_viewer/frontend/views/__tests__/TableOfContentsSection.spec.js
  • kolibri/plugins/epub_viewer/frontend/views/__tests__/TableOfContentsSectionSideBar.spec.js

Do not refactor any other test files or areas of the codebase.

How to Get There

  • Sign in to Kolibri
  • Go to Learn > Library
  • Open any epub/document content (e.g., from the QA Channel)
  • The TOC button (list icon) appears at the left of the TopBar; clicking it opens the table of contents sidebar

Acceptance Criteria

  • [ ] TocButton.spec.js, TableOfContentsSection.spec.js, and TableOfContentsSectionSideBar.spec.js migrated to use @testing-library/vue
  • [ ] No residual @vue/test-utils imports in migrated files
  • [ ] Cover all major workflows while avoiding excessive testing of details
  • [ ] Concise but explicit test descriptions that describe what's tested from a user point of view
  • [ ] Follow Testing Library principles and Testing Library query priority recommendation
  • [ ] Use patterns consistent with existing VTL test suites (search for from '@testing-library/vue')
  • [ ] All migrated tests pass: pnpm run test-jest -- --testPathPattern epub_viewer

References

🤖 This issue was written with AI assistance, under supervision, review and final edits by @rtibbles 🤖

rtibbles avatar Feb 17 '26 00:02 rtibbles

Hi @rtibbles,

I would like to request the opportunity to work on this issue. I am currently going through the codebase and getting familiar with it. I feel confident that I can take this up, and this would be my first contribution to the organization.

Please consider assigning this to me. Thank you!

Satish-2004 avatar Feb 17 '26 04:02 Satish-2004

hi @rtibbles, can i work on this one?

sahibsiddiqui avatar Feb 17 '26 04:02 sahibsiddiqui

Hi @rtibbles , I've been exploring the epub_viewer plugin in my local dev environment and would like to help with the migration to Vue Testing Library. Could you please assign this to me?

IslamHesham-Dev avatar Feb 17 '26 08:02 IslamHesham-Dev

Thanks, assigning @Satish-2004

MisRob avatar Feb 17 '26 10:02 MisRob

Thanks

Satish-2004 avatar Feb 17 '26 10:02 Satish-2004

@MisRob if there is no update yet , can i work on this issue? I already worked on the similar issue before , and completed the assigned two issues of the same parent issue

curiouscoder-cmd avatar Feb 28 '26 19:02 curiouscoder-cmd

Hi @Satish-2004 , just checking in if are you still working on this or need any help? I recently completed the VTL migration for the epub viewer navigation tests and the user auth layout tests, so I 'm fairly familiar with the migration patterns for this codebase. Happy to pick this up or help out if needed!

curiouscoder-cmd avatar Mar 05 '26 12:03 curiouscoder-cmd

Hi, I would like to take this one up, if noones active on it.

sharma-anushka avatar Mar 13 '26 01:03 sharma-anushka

Hi! 👋

Thanks so much for your interest! This issue is already assigned. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.

We really appreciate your willingness to help. 😊

Are you preparing for Google Summer of Code? See our GSoC guidelines.

learning-equality-bot avatar Mar 17 '26 10:03 learning-equality-bot

Thanks @curiouscoder-cmd for your interest. I have tried but was not able to solve this issue. I am requesting the maintainers to transfer this issue to someone else, as I am currently leaving this task.

Satish-2004 avatar Mar 17 '26 10:03 Satish-2004

@MisRob @rtibbles I would love to take this one up, since @Satish-2004 has asked for re-assignment.

sharma-anushka avatar Mar 17 '26 10:03 sharma-anushka

Hi! 👋

Thanks so much for your interest! This issue is already assigned. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.

We really appreciate your willingness to help. 😊

Are you preparing for Google Summer of Code? See our GSoC guidelines.

learning-equality-bot avatar Mar 26 '26 12:03 learning-equality-bot

Hi, Just wanted a follow-up if it's open for re-assignment, as Satish already told me he is not continuing. Thanks.

curiouscoder-cmd avatar Mar 26 '26 16:03 curiouscoder-cmd

Sorry this has slipped my attention. I will re-assign. Thanks all.

MisRob avatar Mar 27 '26 04:03 MisRob

Sorry this has slipped my attention. I will re-assign. Thanks all.

no problem , thanks for reassigning! I'll start working and share the updates soon.

curiouscoder-cmd avatar Mar 27 '26 19:03 curiouscoder-cmd

wanted to share a quick update, The tests are almost done I will finalize the tests and raise a PR .

curiouscoder-cmd avatar Apr 06 '26 07:04 curiouscoder-cmd