kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Convert PDF viewer unit tests to Vue Testing Library

Open rtibbles opened this issue 9 months ago โ€ข 10 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 PDF viewer components (PdfRendererIndex.spec.js, Bookmarks.spec.js, PdfPage.spec.js) currently use @vue/test-utils, which couples tests to component internals.

Related page:

PDF viewer

The Change

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

  • kolibri/plugins/pdf_viewer/frontend/views/__tests__/PdfRendererIndex.spec.js
  • kolibri/plugins/pdf_viewer/frontend/views/__tests__/Bookmarks.spec.js
  • kolibri/plugins/pdf_viewer/frontend/views/__tests__/PdfPage.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 PDF content (e.g., from the QA Channel)
  • PdfRendererIndex is the main viewer with zoom controls and fullscreen button
  • Bookmarks manages the bookmark list in the sidebar
  • PdfPage renders individual PDF pages

Acceptance Criteria

  • [ ] PdfRendererIndex.spec.js, Bookmarks.spec.js, and PdfPage.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 pdf_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

Hii @rtibbles Could you assign this to me ??

rohitt-pandey avatar Feb 17 '26 00:02 rohitt-pandey

I have assigned you.

rtibbles avatar Feb 17 '26 01:02 rtibbles

Thank you for assigning this ๐Ÿ™‚ Iโ€™ll start working on it and will share updates soon.

rohitt-pandey avatar Feb 17 '26 04:02 rohitt-pandey

Apologies, I was just working on it for a school assignment, and meant to make a request to my own fork, and not the actual project. This project is amazing and I wish you all the best in seeing it completed!

lemusg avatar Feb 17 '26 19:02 lemusg

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 Feb 17 '26 19:02 learning-equality-bot

It looks like @lemusg already submitted a PR for this and it got merged. Great work!

@rtibbles Just to clear up my own understanding for next timeโ€”if I am officially assigned to an issue, is there a specific workflow I should follow to let others know about progress, or was this just a mix-up?

rohitt-pandey avatar Feb 20 '26 16:02 rohitt-pandey

Hi @rohitt-pandey - no @lemusg's PR was merged on their fork, not on our repo. We still keenly await your contribution!

rtibbles avatar Feb 20 '26 16:02 rtibbles

Thanks for clarifying that @rtibbles! I will have the PR updated and ready for review shortly.

rohitt-pandey avatar Feb 20 '26 19:02 rohitt-pandey

Yes, sorry. I just worked on it for a school assignment, I do not expect my code is up to standard for this project๐Ÿ˜… it was required for me to make a PR to a fork of the project, again sorry for all the confusion

lemusg avatar Feb 20 '26 19:02 lemusg

@lemusg No problem at all, thanks for clearing that up! Hope you get a great grade on your assignment ๐Ÿ‘.

rohitt-pandey avatar Feb 24 '26 05:02 rohitt-pandey