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:
Diffstat (limited to 'spec/features/issues/issue_detail_spec.rb')
-rw-r--r--spec/features/issues/issue_detail_spec.rb63
1 files changed, 58 insertions, 5 deletions
diff --git a/spec/features/issues/issue_detail_spec.rb b/spec/features/issues/issue_detail_spec.rb
index 1c8da227412..a942a1a44f6 100644
--- a/spec/features/issues/issue_detail_spec.rb
+++ b/spec/features/issues/issue_detail_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe 'Issue Detail', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let(:issue) { create(:issue, project: project, author: user) }
+ let(:incident) { create(:incident, project: project, author: user) }
context 'when user displays the issue' do
before do
@@ -21,10 +22,8 @@ RSpec.describe 'Issue Detail', :js do
end
context 'when user displays the issue as an incident' do
- let(:issue) { create(:incident, project: project, author: user) }
-
before do
- visit project_issue_path(project, issue)
+ visit project_issue_path(project, incident)
wait_for_requests
end
@@ -58,9 +57,9 @@ RSpec.describe 'Issue Detail', :js do
visit project_issue_path(project, issue)
wait_for_requests
- page.find('.js-issuable-edit').click
+ click_button 'Edit title and description'
fill_in 'issuable-title', with: 'issue title'
- click_button 'Save'
+ click_button 'Save changes'
wait_for_requests
Users::DestroyService.new(user).execute(user)
@@ -74,4 +73,58 @@ RSpec.describe 'Issue Detail', :js do
end
end
end
+
+ describe 'user updates `issue_type` via the issue type dropdown' do
+ context 'when an issue `issue_type` is edited by a signed in user' do
+ before do
+ sign_in(user)
+
+ visit project_issue_path(project, issue)
+ wait_for_requests
+ end
+
+ it 'routes the user to the incident details page when the `issue_type` is set to incident' do
+ open_issue_edit_form
+
+ page.within('[data-testid="issuable-form"]') do
+ update_type_select('Issue', 'Incident')
+
+ expect(page).to have_current_path(project_issues_incident_path(project, issue))
+ end
+ end
+ end
+
+ context 'when an incident `issue_type` is edited by a signed in user' do
+ before do
+ sign_in(user)
+
+ visit project_issue_path(project, incident)
+ wait_for_requests
+ end
+
+ it 'routes the user to the issue details page when the `issue_type` is set to issue' do
+ open_issue_edit_form
+
+ page.within('[data-testid="issuable-form"]') do
+ update_type_select('Incident', 'Issue')
+
+ expect(page).to have_current_path(project_issue_path(project, incident))
+ end
+ end
+ end
+ end
+
+ def update_type_select(from, to)
+ click_button from
+ click_button to
+ click_button 'Save changes'
+
+ wait_for_requests
+ end
+
+ def open_issue_edit_form
+ wait_for_requests
+ click_button 'Edit title and description'
+ wait_for_requests
+ end
end