diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/support/shared_examples/quick_actions/issuable/time_tracking_quick_action_shared_examples.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/support/shared_examples/quick_actions/issuable/time_tracking_quick_action_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/quick_actions/issuable/time_tracking_quick_action_shared_examples.rb | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/spec/support/shared_examples/quick_actions/issuable/time_tracking_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/time_tracking_quick_action_shared_examples.rb index f414500f202..18304951e41 100644 --- a/spec/support/shared_examples/quick_actions/issuable/time_tracking_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issuable/time_tracking_quick_action_shared_examples.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true RSpec.shared_examples 'issuable time tracker' do |issuable_type| + let_it_be(:time_tracker_selector) { '[data-testid="time-tracker"]' } + before do project.add_maintainer(maintainer) gitlab_sign_in(maintainer) @@ -12,6 +14,14 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| wait_for_requests end + def open_time_tracking_report + page.within time_tracker_selector do + click_link 'Time tracking report' + + wait_for_requests + end + end + it 'renders the sidebar component empty state' do page.within '[data-testid="noTrackingPane"]' do expect(page).to have_content 'No estimate or time spent' @@ -50,7 +60,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| submit_time('/estimate 3w 1d 1h') submit_time('/remove_estimate') - page.within '.time-tracking-component-wrap' do + page.within time_tracker_selector do expect(page).to have_content 'No estimate or time spent' end end @@ -59,13 +69,13 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| submit_time('/spend 3w 1d 1h') submit_time('/remove_time_spent') - page.within '.time-tracking-component-wrap' do + page.within time_tracker_selector do expect(page).to have_content 'No estimate or time spent' end end it 'shows the help state when icon is clicked' do - page.within '.time-tracking-component-wrap' do + page.within time_tracker_selector do find('[data-testid="helpButton"]').click expect(page).to have_content 'Track time with quick actions' expect(page).to have_content 'Learn more' @@ -78,11 +88,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| wait_for_requests - page.within '.time-tracking-component-wrap' do - click_link 'Time tracking report' - - wait_for_requests - end + open_time_tracking_report page.within '#time-tracking-report' do expect(find('tbody')).to have_content maintainer.name @@ -90,8 +96,36 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| end end + it 'removes time log when delete is clicked in time tracking report' do + submit_time('/estimate 1w') + submit_time('/spend 1d') + submit_time('/spend 3d') + + wait_for_requests + + open_time_tracking_report + + page.within '#time-tracking-report tbody tr:nth-child(2)' do + click_button test_id: 'deleteButton' + + wait_for_requests + end + + # Assert that 2nd row was removed + expect(all('#time-tracking-report tbody tr').length).to eq(1) + expect(find('#time-tracking-report tbody')).not_to have_content('3d') + + # Assert that summary line was updated + expect(find('#time-tracking-report tfoot')).to have_content('1d', exact: true) + + # Assert that the time tracking widget was reactively updated + page.within '[data-testid="timeTrackingComparisonPane"]' do + expect(page).to have_content '1d' + end + end + it 'hides the help state when close icon is clicked' do - page.within '.time-tracking-component-wrap' do + page.within time_tracker_selector do find('[data-testid="helpButton"]').click find('[data-testid="closeHelpButton"]').click @@ -101,7 +135,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| end it 'displays the correct help url' do - page.within '.time-tracking-component-wrap' do + page.within time_tracker_selector do find('[data-testid="helpButton"]').click expect(find_link('Learn more')[:href]).to have_content('/help/user/project/time_tracking.md') |