kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Convert epub viewer bar unit tests to Vue Testing Library

Open rtibbles opened this issue 9 months ago • 6 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 top and bottom bar components (BottomBar.spec.js, TopBar.spec.js) currently use @vue/test-utils, which couples tests to component internals. This makes them brittle — they break when implementation changes even if user-facing behavior remains correct.

Related page:

Epub viewer showing TopBar and BottomBar

The Change

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

  • kolibri/plugins/epub_viewer/frontend/views/__tests__/BottomBar.spec.js
  • kolibri/plugins/epub_viewer/frontend/views/__tests__/TopBar.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 TopBar appears at the top of the reader (TOC, settings, search, fullscreen buttons) and the BottomBar at the bottom (progress slider)

Acceptance Criteria

  • [ ] BottomBar.spec.js and TopBar.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, if the other issue is being assigned to @AadarshM07, Id be happy to give this one a try.

sharma-anushka avatar Feb 17 '26 04:02 sharma-anushka

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 all. Will assign @sharma-anushka.

MisRob avatar Feb 17 '26 10:02 MisRob

Hi @rtibbles, implementation is complete. You may have a look.

sharma-anushka avatar Feb 22 '26 08:02 sharma-anushka