Skip to content

Fix Work item unit tests for Vue 3 mode

Natalia Tepluhina requested to merge fix-more-vue-3-tests into master

What does this MR do and why?

This merge request fixes Work item unit tests for Vue 3 mode. The changes primarily focus on updating the test files to ensure compatibility with Vue 3 and improving the overall test coverage for the Work Items feature.

Specifically, this MR:

  1. Adds data-testid attributes to various components in the work_item_time_tracking.vue file to improve test selectability.
  2. Updates the work_item_labels_spec.js file to use a more accurate method of checking for scoped labels.
  3. Modifies the todos_toggle_spec.js and work_item_drawer_spec.js files to use component stubs, which can help isolate component behavior in tests.
  4. Significantly refactors the work_item_time_tracking_spec.js file to use shallowMount instead of mount, updates import statements, and modifies test selectors to use the newly added data-testid attributes.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

No visual changes

How to set up and validate locally

Run the following tests in Vue 3 mode:

VUE_VERSION=3 yarn jest ee/spec/frontend/work_items/components/work_item_labels_spec.js
VUE_VERSION=3 yarn jest spec/frontend/work_items/components/shared/todos_toggle_spec.js
VUE_VERSION=3 yarn jest spec/frontend/work_items/components/work_item_drawer_spec.js
VUE_VERSION=3 yarn jest spec/frontend/work_items/components/work_item_time_tracking_spec.js
Edited by Natalia Tepluhina

Merge request reports

Loading