Add Test Coverage for Work Items Dates Widget
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
Overview
This MR adds reusable feature test coverage for the Work Items Dates widget, supporting Issues, Key Results, and Objectives. The coverage includes default state behavior, interaction with date pickers, formatting based on user preferences, and accessibility compliance.
Summary of Changes
- Added shared examples in
spec/support/shared_examples/features/work_items/work_items_shared_examples.rb - Included shared examples in:
ee/spec/features/work_items/detail/work_item_detail_spec.rbee/spec/features/work_items/okr_spec.rb
- Covered:
- Default rendering state
- Start and due date picker interactions
- Date formatting according to user preferences
- Accessibility testing using
axe
Related Work
- Closes gitlab-org/gitlab#498758
- Follows shared example patterns from !173447 (merged) and !175435 (merged)
Test Coverage
Default State
- Widget displays "None" when no dates are set
- Edit button is visible and functional
- No date values rendered by default
Date Picker Interaction
- Start and due date pickers render correctly
- Inputs accept
YYYY-MM-DDformat - Dates persist on apply
- Clear buttons remove set values
- Calendar UI behaves as expected
User Preference Formatting
- Dates display in
MMM d, yyyyformat - Formatting respects user locale settings
- Supports alternate formats (e.g.,
DD/MM/YYYY,MM-DD-YYYY)
Accessibility
- Passes
axeautomated checks - Compliant in both collapsed and expanded states
- Follows GitLab Accessibility Guidelines
Modified Files
-
spec/support/shared_examples/features/work_items/work_items_shared_examples.rb- Added ~95 lines of shared examples
-
ee/spec/features/work_items/detail/work_item_detail_spec.rb- Included shared example
-
ee/spec/features/work_items/okr_spec.rb- Included shared example for Key Result tests
Test Commands
# Run full widget suite across specs
bundle exec rspec spec/features/work_items/detail/work_item_detail_spec.rb \
ee/spec/features/work_items/detail/work_item_detail_spec.rb \
ee/spec/features/work_items/okr_spec.rb \
-t "dates widget"
# Run shared examples only
bundle exec rspec spec/support/shared_examples/features/work_items/work_items_shared_examples.rb
# Run accessibility tests
bundle exec rspec -t "accessibility"
Edited by Mohammed Firdous