debian-mirror-gitlab/spec/features/incidents/user_creates_new_incident_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.4 KiB
Ruby
Raw Permalink Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Incident Management index', :js, feature_category: :incident_management do
2021-01-03 14:25:43 +05:30
let_it_be(:project) { create(:project) }
2021-12-11 22:18:48 +05:30
let_it_be(:reporter) { create(:user) }
2021-01-03 14:25:43 +05:30
let_it_be(:guest) { create(:user) }
let_it_be(:incident) { create(:incident, project: project) }
before_all do
2021-12-11 22:18:48 +05:30
project.add_reporter(reporter)
2021-01-03 14:25:43 +05:30
project.add_guest(guest)
end
2021-12-11 22:18:48 +05:30
before do
sign_in(user)
2021-01-03 14:25:43 +05:30
2021-12-11 22:18:48 +05:30
visit project_incidents_path(project)
wait_for_all_requests
end
2021-01-03 14:25:43 +05:30
2021-12-11 22:18:48 +05:30
describe 'incident list is visited' do
context 'by reporter' do
let(:user) { reporter }
2021-01-03 14:25:43 +05:30
2021-12-11 22:18:48 +05:30
it 'shows the create new incident button' do
expect(page).to have_selector('.create-incident-button')
2021-01-03 14:25:43 +05:30
end
2021-12-11 22:18:48 +05:30
it 'when clicked shows the create issue page with the Incident type pre-selected' do
find('.create-incident-button').click
wait_for_all_requests
2021-01-03 14:25:43 +05:30
2021-12-11 22:18:48 +05:30
expect(page).to have_selector('.dropdown-menu-toggle')
expect(page).to have_selector('.js-issuable-type-filter-dropdown-wrap')
2021-01-03 14:25:43 +05:30
2021-12-11 22:18:48 +05:30
page.within('.js-issuable-type-filter-dropdown-wrap') do
expect(page).to have_content('Incident')
end
end
end
2021-01-03 14:25:43 +05:30
end
2021-12-11 22:18:48 +05:30
context 'by guest' do
let(:user) { guest }
2021-01-03 14:25:43 +05:30
2021-12-11 22:18:48 +05:30
it 'does not show new incident button' do
expect(page).not_to have_selector('.create-incident-button')
2021-01-03 14:25:43 +05:30
end
end
end