debian-mirror-gitlab/spec/features/issues/issue_state_spec.rb

88 lines
2.3 KiB
Ruby
Raw Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'issue state', :js, feature_category: :team_planning do
2021-02-22 17:27:13 +05:30
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
before do
project.add_developer(user)
sign_in(user)
end
shared_examples 'issue closed' do |selector|
it 'can close an issue' do
2021-03-08 18:12:59 +05:30
wait_for_requests
2021-02-22 17:27:13 +05:30
expect(find('.status-box')).to have_content 'Open'
within selector do
click_button 'Close issue'
2021-03-08 18:12:59 +05:30
wait_for_requests
2021-02-22 17:27:13 +05:30
end
expect(find('.status-box')).to have_content 'Closed'
end
end
shared_examples 'issue reopened' do |selector|
it 'can reopen an issue' do
2021-03-08 18:12:59 +05:30
wait_for_requests
2021-02-22 17:27:13 +05:30
expect(find('.status-box')).to have_content 'Closed'
within selector do
click_button 'Reopen issue'
2021-03-08 18:12:59 +05:30
wait_for_requests
2021-02-22 17:27:13 +05:30
end
expect(find('.status-box')).to have_content 'Open'
end
end
2021-03-08 18:12:59 +05:30
describe 'when open', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/297348' do
2021-03-11 19:13:27 +05:30
context 'when clicking the top `Close issue` button', :aggregate_failures do
2021-04-17 20:07:23 +05:30
let(:open_issue) { create(:issue, project: project) }
2021-02-22 17:27:13 +05:30
before do
visit project_issue_path(project, open_issue)
end
it_behaves_like 'issue closed', '.detail-page-header'
end
context 'when clicking the bottom `Close issue` button', :aggregate_failures do
2021-04-17 20:07:23 +05:30
let(:open_issue) { create(:issue, project: project) }
2021-02-22 17:27:13 +05:30
before do
visit project_issue_path(project, open_issue)
end
it_behaves_like 'issue closed', '.timeline-content-form'
end
end
2021-03-08 18:12:59 +05:30
describe 'when closed', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/297201' do
2021-03-11 19:13:27 +05:30
context 'when clicking the top `Reopen issue` button', :aggregate_failures do
2021-04-17 20:07:23 +05:30
let(:closed_issue) { create(:issue, project: project, state: 'closed') }
2021-02-22 17:27:13 +05:30
before do
visit project_issue_path(project, closed_issue)
end
it_behaves_like 'issue reopened', '.detail-page-header'
end
context 'when clicking the bottom `Reopen issue` button', :aggregate_failures do
2021-04-17 20:07:23 +05:30
let(:closed_issue) { create(:issue, project: project, state: 'closed') }
2021-02-22 17:27:13 +05:30
before do
visit project_issue_path(project, closed_issue)
end
it_behaves_like 'issue reopened', '.timeline-content-form'
end
end
end