summaryrefslogtreecommitdiff
path: root/spec/features/incidents/incident_timeline_events_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/incidents/incident_timeline_events_spec.rb')
-rw-r--r--spec/features/incidents/incident_timeline_events_spec.rb73
1 files changed, 73 insertions, 0 deletions
diff --git a/spec/features/incidents/incident_timeline_events_spec.rb b/spec/features/incidents/incident_timeline_events_spec.rb
index 3a73ea50247..80b46078389 100644
--- a/spec/features/incidents/incident_timeline_events_spec.rb
+++ b/spec/features/incidents/incident_timeline_events_spec.rb
@@ -40,6 +40,39 @@ RSpec.describe 'Incident timeline events', :js, feature_category: :incident_mana
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')
+
+ 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
+ end
+ end
+
context 'when edit is clicked' do
before do
click_button 'Add new timeline event'
@@ -72,6 +105,46 @@ RSpec.describe 'Incident timeline events', :js, feature_category: :incident_mana
end
end
+ context 'when edit is clicked and feature flag enabled' do
+ before 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')
+
+ page.within '.gl-dropdown-inner' do
+ 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')
+
+ page.within '.gl-dropdown-contents' do
+ expect(page).to have_content(_('Edit'))
+ page.find('.gl-dropdown-item-text-primary', text: _('Edit')).click
+ end
+
+ expect(page).to have_selector('.common-note-form')
+
+ click_button s_('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
+
+ page.within '.timeline-event-note' do
+ 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')