Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-24 15:09:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-24 15:09:24 +0300
commit17c1c66eefd05243dd8ed2c8fd49d17ab1a52522 (patch)
treea6f7c103902284c8245bc1991769916139f60aa9 /spec/features/incidents
parent3a4363e0098b1ff7689247e55da416848ac51050 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/incidents')
-rw-r--r--spec/features/incidents/incident_timeline_events_spec.rb168
1 files changed, 49 insertions, 119 deletions
diff --git a/spec/features/incidents/incident_timeline_events_spec.rb b/spec/features/incidents/incident_timeline_events_spec.rb
index 45518671c57..ffab23c58bc 100644
--- a/spec/features/incidents/incident_timeline_events_spec.rb
+++ b/spec/features/incidents/incident_timeline_events_spec.rb
@@ -4,171 +4,101 @@ require 'spec_helper'
RSpec.describe 'Incident timeline events', :js, feature_category: :incident_management do
let_it_be(:project) { create(:project) }
- let_it_be(:developer) { create(:user) }
+ let_it_be(:user) { create(:user, developer_projects: [project]) }
let_it_be(:incident) { create(:incident, project: project) }
- before_all do
- project.add_developer(developer)
- end
-
- before do
- sign_in(developer)
-
- visit incident_project_issues_path(project, incident)
- wait_for_requests
- click_link s_('Incident|Timeline')
- end
-
- context 'when add event is clicked' do
- it 'submits event data when save is clicked' do
- click_button s_('Incident|Add new timeline event')
-
- expect(page).to have_selector('.common-note-form')
-
- fill_in _('Description'), with: 'Event note goes here'
- fill_in 'timeline-input-hours', with: '07'
- fill_in 'timeline-input-minutes', with: '25'
-
- click_button _('Save')
+ shared_examples 'add, edit, and delete timeline events' do
+ it 'submits event data on save' do
+ # Add event
+ click_button(s_('Incident|Add new timeline event'))
+ complete_form('Event note goes here', '07', '25')
expect(page).to have_selector('.incident-timeline-events')
-
page.within '.timeline-event-note' do
expect(page).to have_content('Event note goes here')
expect(page).to have_content('07:25')
end
- end
- end
-
- context 'when add event is clicked and feature flag enabled' do
- before do
- stub_feature_flags(incident_event_tags: true)
- end
-
- it 'submits event data with tags when save is clicked' do
- click_button s_('Incident|Add new timeline event')
-
- expect(page).to have_selector('.common-note-form')
- fill_in _('Description'), with: 'Event note goes here'
- fill_in 'timeline-input-hours', with: '07'
- fill_in 'timeline-input-minutes', with: '25'
-
- click_button _('Select tags')
-
- page.within '.gl-dropdown-inner' do
- expect(page).to have_content(_('Start time'))
- page.find('.gl-dropdown-item-text-wrapper', text: _('Start time')).click
- end
-
- click_button _('Save')
-
- expect(page).to have_selector('.incident-timeline-events')
+ # Edit event
+ trigger_dropdown_action(_('Edit'))
+ complete_form('Edited event note goes here', '08', '30')
page.within '.timeline-event-note' do
- expect(page).to have_content('Event note goes here')
- expect(page).to have_content('07:25')
- expect(page).to have_content('Start time')
+ expect(page).to have_content('Edited event note goes here')
+ expect(page).to have_content('08:30')
end
- end
- end
- context 'when edit is clicked' do
- before do
- click_button 'Add new timeline event'
- fill_in 'Description', with: 'Event note to edit'
- click_button _('Save')
- end
+ # Delete event
+ trigger_dropdown_action(_('Delete'))
- it 'shows the confirmation modal and edits the event' do
- click_button _('More actions')
-
- page.within '.gl-dropdown-contents' do
- expect(page).to have_content(_('Edit'))
- page.find('.gl-dropdown-item-text-primary', text: _('Edit')).click
+ page.within '.modal' do
+ expect(page).to have_content(s_('Incident|Delete event'))
end
- expect(page).to have_selector('.common-note-form')
-
- fill_in _('Description'), with: 'Event note goes here'
- fill_in 'timeline-input-hours', with: '07'
- fill_in 'timeline-input-minutes', with: '25'
-
- click_button _('Save')
-
+ click_button s_('Incident|Delete event')
wait_for_requests
- page.within '.timeline-event-note' do
- expect(page).to have_content('Event note goes here')
- expect(page).to have_content('07:25')
- end
+ expect(page).to have_content(s_('Incident|No timeline items have been added yet.'))
end
- end
- context 'when edit is clicked and feature flag enabled' do
- before do
+ it 'submits event data on save with feature flag on' do
stub_feature_flags(incident_event_tags: true)
- click_button 'Add new timeline event'
- fill_in 'Description', with: 'Event note to edit'
- click_button _('Select tags')
+ # Add event
+ click_button(s_('Incident|Add new timeline event'))
+
+ click_button _('Select tags')
page.within '.gl-dropdown-inner' do
+ expect(page).to have_content(_('Start time'))
page.find('.gl-dropdown-item-text-wrapper', text: _('Start time')).click
end
- click_button _('Save')
- end
- it 'shows the confirmation modal and edits the event tags' do
- click_button _('More actions')
+ complete_form('Event note goes here', '07', '25')
- page.within '.gl-dropdown-contents' do
- expect(page).to have_content(_('Edit'))
- page.find('.gl-dropdown-item-text-primary', text: _('Edit')).click
+ expect(page).to have_selector('.incident-timeline-events')
+ page.within '.timeline-event-note' do
+ expect(page).to have_content('Event note goes here')
+ expect(page).to have_content('07:25')
+ expect(page).to have_content('Start time')
end
- expect(page).to have_selector('.common-note-form')
-
- click_button s_('Start time')
+ # Edit event
+ trigger_dropdown_action(_('Edit'))
+ click_button _('Start time')
page.within '.gl-dropdown-inner' do
- expect(page).to have_content(_('Start time'))
page.find('.gl-dropdown-item-text-wrapper', text: _('Start time')).click
end
-
- click_button _('Save')
-
- wait_for_requests
+ complete_form('Edited event note goes here', '08', '30')
page.within '.timeline-event-note' do
+ expect(page).to have_content('Edited event note goes here')
+ expect(page).to have_content('08:30')
expect(page).not_to have_content('Start time')
end
end
- end
- context 'when delete is clicked' do
- before do
- click_button s_('Incident|Add new timeline event')
- fill_in _('Description'), with: 'Event note to delete'
+ private
+
+ def complete_form(title, hours, minutes)
+ fill_in _('Description'), with: title
+ fill_in 'timeline-input-hours', with: hours
+ fill_in 'timeline-input-minutes', with: minutes
+
click_button _('Save')
+ wait_for_requests
end
- it 'shows the confirmation modal and deletes the event' do
+ def trigger_dropdown_action(text)
click_button _('More actions')
page.within '.gl-dropdown-contents' do
- expect(page).to have_content(_('Delete'))
- page.find('.gl-dropdown-item-text-primary', text: 'Delete').click
+ page.find('.gl-dropdown-item', text: text).click
end
-
- page.within '.modal' do
- expect(page).to have_content(s_('Incident|Delete event'))
- end
-
- click_button s_('Incident|Delete event')
-
- wait_for_requests
-
- expect(page).to have_content(s_('Incident|No timeline items have been added yet.'))
end
end
+
+ it_behaves_like 'for each incident details route',
+ 'add, edit, and delete timeline events',
+ tab_text: s_('Incident|Timeline')
end