kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Convert setup wizard step unit tests to Vue Testing Library

Open rtibbles opened this issue 9 months ago • 11 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 individual setup wizard form components (CreateLearnerAccountForm.spec.js, PersonalDataConsentForm.spec.js, UserCredentialsForm.spec.js) currently use @vue/test-utils, which couples tests to component internals.

Related pages:

Setup wizard create super admin form

The Change

Refactor these test files to use Vue Testing Library (VTL) and write tests that reflect how a user interacts with each setup step:

  • kolibri/plugins/setup_wizard/frontend/views/__tests__/CreateLearnerAccountForm.spec.js
  • kolibri/plugins/setup_wizard/frontend/views/__tests__/PersonalDataConsentForm.spec.js
  • kolibri/plugins/setup_wizard/frontend/views/__tests__/UserCredentialsForm.spec.js

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

How to Get There

The setup wizard appears on first launch of an unprovisioned Kolibri device. To see it during development, start Kolibri with a fresh KOLIBRI_HOME:

export KOLIBRI_HOME=$(mktemp -d)
pnpm run devserver

Then navigate to http://localhost:8000/.

  • CreateLearnerAccountForm appears at step 3 of the "Create a new learning facility" flow ("Allow learners to join this facility?")
  • PersonalDataConsentForm appears at step 5 ("Responsibilities as an administrator")
  • UserCredentialsForm is the "Create super admin" form with Full name, Username, and Password fields

Acceptance Criteria

  • [ ] CreateLearnerAccountForm.spec.js, PersonalDataConsentForm.spec.js, and UserCredentialsForm.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 setup_wizard

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 , would love to work on this. can you assign this to me?

AadarshM07 avatar Feb 17 '26 02:02 AadarshM07

I have assigned you.

rtibbles avatar Feb 17 '26 02:02 rtibbles

Hi @AadarshM07 are you still working on this ??

ayushman1210 avatar Feb 23 '26 18:02 ayushman1210

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 23 '26 18:02 learning-equality-bot

Hi @AadarshM07 are you still working on this ??

Yes, I will be raising a PR shortly

AadarshM07 avatar Feb 23 '26 18:02 AadarshM07

@rtibbles I have done with the setup of this project locally and understood the codebase can you please assign this issue to me.

hk2166 avatar Mar 11 '26 23:03 hk2166

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 11 '26 23:03 learning-equality-bot

Hi @rtibbles , I noticed this issue was assigned a month ago and I didn’t see a PR linked yet. Is someone currently working on it? If not, I’d be happy to take a look and work on a fix.

rajeshuchil avatar Mar 14 '26 16:03 rajeshuchil

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 14 '26 16:03 learning-equality-bot

Hi @rtibbles , I have migrated the CreateLearnerAccountForm and UserCredentialsForm tests properly. But while migrating PersonalDataConsentForm, I ran into an issue like clicking Usage and privacy link does not produce any observable content in the testing DOM. It should be rendering the PrivacyInfoModal content. I tried Jest mocks, adding data-test attributes, and explicitly querying it in the DOM but even then the content from the modal is not being rendered.

I am not very sure why this is happening. Is there any previous instance of known fixes or references you can share? It would really help.

AadarshM07 avatar Apr 03 '26 16:04 AadarshM07

Hi @rtibbles , I have migrated the CreateLearnerAccountForm and UserCredentialsForm tests properly. But while migrating PersonalDataConsentForm, I ran into an issue like clicking Usage and privacy link does not produce any observable content in the testing DOM. It should be rendering the PrivacyInfoModal content. I tried Jest mocks, adding data-test attributes, and explicitly querying it in the DOM but even then the content from the modal is not being rendered.

I am not very sure why this is happening. Is there any previous instance of known fixes or references you can share? It would really help.

Hi, this issue is resolved from my side, found the fix. I will raise the PR shortly. Sorry for the delay.

AadarshM07 avatar Apr 13 '26 21:04 AadarshM07