Skip to content

Add Test Coverage for Work Items Dates Widget

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.rb
    • ee/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

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-DD format
  • Dates persist on apply
  • Clear buttons remove set values
  • Calendar UI behaves as expected

User Preference Formatting

  • Dates display in MMM d, yyyy format
  • Formatting respects user locale settings
  • Supports alternate formats (e.g., DD/MM/YYYY, MM-DD-YYYY)

Accessibility

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

Merge request reports

Loading