diff options
Diffstat (limited to 'spec/features/issues/move_spec.rb')
-rw-r--r-- | spec/features/issues/move_spec.rb | 63 |
1 files changed, 26 insertions, 37 deletions
diff --git a/spec/features/issues/move_spec.rb b/spec/features/issues/move_spec.rb index 21a7637fe7f..3c01ff345fc 100644 --- a/spec/features/issues/move_spec.rb +++ b/spec/features/issues/move_spec.rb @@ -2,24 +2,24 @@ require 'rails_helper' feature 'issue move to another project' do let(:user) { create(:user) } - let(:old_project) { create(:project) } + let(:old_project) { create(:project, :repository) } let(:text) { 'Some issue description' } let(:issue) do create(:issue, description: text, project: old_project, author: user) end - background { gitlab_sign_in(user) } + background { sign_in(user) } context 'user does not have permission to move issue' do background do - old_project.team << [user, :guest] + old_project.add_guest(user) - edit_issue(issue) + visit issue_path(issue) end scenario 'moving issue to another project not allowed' do - expect(page).to have_no_selector('#move_to_project_id') + expect(page).to have_no_selector('.js-sidebar-move-issue-block') end end @@ -31,51 +31,49 @@ feature 'issue move to another project' do let(:cross_reference) { old_project.to_reference(new_project) } background do - old_project.team << [user, :reporter] - new_project.team << [user, :reporter] + old_project.add_reporter(user) + new_project.add_reporter(user) - edit_issue(issue) + visit issue_path(issue) end - scenario 'moving issue to another project', js: true do - find('#issuable-move', visible: false).set(new_project.id) - click_button('Save changes') - + scenario 'moving issue to another project', :js do + find('.js-move-issue').click wait_for_requests - - expect(current_url).to include project_path(new_project) + all('.js-move-issue-dropdown-item')[0].click + find('.js-move-issue-confirmation-button').click expect(page).to have_content("Text with #{cross_reference}#{mr.to_reference}") expect(page).to have_content("moved from #{cross_reference}#{issue.to_reference}") expect(page).to have_content(issue.title) + expect(page.current_path).to include project_path(new_project) end - scenario 'searching project dropdown', js: true do - new_project_search.team << [user, :reporter] + scenario 'searching project dropdown', :js do + new_project_search.add_reporter(user) - page.within '.detail-page-description' do - first('.select2-choice').click - end + find('.js-move-issue').click + wait_for_requests - fill_in('s2id_autogen1_search', with: new_project_search.name) + page.within '.js-sidebar-move-issue-block' do + fill_in('sidebar-move-issue-dropdown-search', with: new_project_search.name) - page.within '.select2-drop' do expect(page).to have_content(new_project_search.name) expect(page).not_to have_content(new_project.name) end end - context 'user does not have permission to move the issue to a project', js: true do + context 'user does not have permission to move the issue to a project', :js do let!(:private_project) { create(:project, :private) } let(:another_project) { create(:project) } - background { another_project.team << [user, :guest] } + background { another_project.add_guest(user) } scenario 'browsing projects in projects select' do - click_link 'Move to a different project' + find('.js-move-issue').click + wait_for_requests - page.within '.select2-results' do - expect(page).to have_content 'No project' - expect(page).to have_content new_project.name_with_namespace + page.within '.js-sidebar-move-issue-block' do + expect(page).to have_content new_project.full_name end end end @@ -92,16 +90,7 @@ feature 'issue move to another project' do end end - def edit_issue(issue) - visit issue_path(issue) - page.within('.issuable-actions') { first(:link, 'Edit').click } - end - def issue_path(issue) - namespace_project_issue_path(issue.project.namespace, issue.project, issue) - end - - def project_path(project) - namespace_project_path(new_project.namespace, new_project) + project_issue_path(issue.project, issue) end end |