diff options
Diffstat (limited to 'spec/features/boards/issue_ordering_spec.rb')
-rw-r--r-- | spec/features/boards/issue_ordering_spec.rb | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/spec/features/boards/issue_ordering_spec.rb b/spec/features/boards/issue_ordering_spec.rb index c50155a6d14..4cbb48e2e6e 100644 --- a/spec/features/boards/issue_ordering_spec.rb +++ b/spec/features/boards/issue_ordering_spec.rb @@ -1,10 +1,9 @@ require 'rails_helper' -describe 'Issue Boards', :feature, :js do - include WaitForVueResource +describe 'Issue Boards', :js do include DragTo - let(:project) { create(:empty_project, :public) } + let(:project) { create(:project, :public) } let(:board) { create(:board, project: project) } let(:user) { create(:user) } let(:label) { create(:label, project: project) } @@ -16,21 +15,21 @@ describe 'Issue Boards', :feature, :js do before do project.team << [user, :master] - login_as(user) + sign_in(user) end context 'un-ordered issues' do let!(:issue4) { create(:labeled_issue, project: project, labels: [label]) } before do - visit namespace_project_board_path(project.namespace, project, board) - wait_for_vue_resource + visit project_board_path(project, board) + wait_for_requests - expect(page).to have_selector('.board', count: 2) + expect(page).to have_selector('.board', count: 3) end it 'has un-ordered issue as last issue' do - page.within(first('.board')) do + page.within(find('.board:nth-child(2)')) do expect(all('.card').last).to have_content(issue4.title) end end @@ -38,7 +37,9 @@ describe 'Issue Boards', :feature, :js do it 'moves un-ordered issue to top of list' do drag(from_index: 3, to_index: 0) - page.within(first('.board')) do + wait_for_requests + + page.within(find('.board:nth-child(2)')) do expect(first('.card')).to have_content(issue4.title) end end @@ -46,16 +47,16 @@ describe 'Issue Boards', :feature, :js do context 'ordering in list' do before do - visit namespace_project_board_path(project.namespace, project, board) - wait_for_vue_resource + visit project_board_path(project, board) + wait_for_requests - expect(page).to have_selector('.board', count: 2) + expect(page).to have_selector('.board', count: 3) end it 'moves from middle to top' do drag(from_index: 1, to_index: 0) - wait_for_vue_resource + wait_for_requests expect(first('.card')).to have_content(issue2.title) end @@ -63,7 +64,7 @@ describe 'Issue Boards', :feature, :js do it 'moves from middle to bottom' do drag(from_index: 1, to_index: 2) - wait_for_vue_resource + wait_for_requests expect(all('.card').last).to have_content(issue2.title) end @@ -71,7 +72,7 @@ describe 'Issue Boards', :feature, :js do it 'moves from top to bottom' do drag(from_index: 0, to_index: 2) - wait_for_vue_resource + wait_for_requests expect(all('.card').last).to have_content(issue3.title) end @@ -79,7 +80,7 @@ describe 'Issue Boards', :feature, :js do it 'moves from bottom to top' do drag(from_index: 2, to_index: 0) - wait_for_vue_resource + wait_for_requests expect(first('.card')).to have_content(issue1.title) end @@ -87,7 +88,7 @@ describe 'Issue Boards', :feature, :js do it 'moves from top to middle' do drag(from_index: 0, to_index: 1) - wait_for_vue_resource + wait_for_requests expect(first('.card')).to have_content(issue2.title) end @@ -95,7 +96,7 @@ describe 'Issue Boards', :feature, :js do it 'moves from bottom to middle' do drag(from_index: 2, to_index: 1) - wait_for_vue_resource + wait_for_requests expect(all('.card').last).to have_content(issue2.title) end @@ -109,53 +110,53 @@ describe 'Issue Boards', :feature, :js do let!(:issue6) { create(:labeled_issue, project: project, title: 'testing 3', labels: [label2], relative_position: 1.0) } before do - visit namespace_project_board_path(project.namespace, project, board) - wait_for_vue_resource + visit project_board_path(project, board) + wait_for_requests - expect(page).to have_selector('.board', count: 3) + expect(page).to have_selector('.board', count: 4) end it 'moves to top of another list' do - drag(list_from_index: 0, list_to_index: 1) + drag(list_from_index: 1, list_to_index: 2) - wait_for_vue_resource + wait_for_requests - expect(first('.board')).to have_selector('.card', count: 2) - expect(all('.board')[1]).to have_selector('.card', count: 4) + expect(find('.board:nth-child(2)')).to have_selector('.card', count: 2) + expect(all('.board')[2]).to have_selector('.card', count: 4) - page.within(all('.board')[1]) do + page.within(all('.board')[2]) do expect(first('.card')).to have_content(issue3.title) end end it 'moves to bottom of another list' do - drag(list_from_index: 0, list_to_index: 1, to_index: 2) + drag(list_from_index: 1, list_to_index: 2, to_index: 2) - wait_for_vue_resource + wait_for_requests - expect(first('.board')).to have_selector('.card', count: 2) - expect(all('.board')[1]).to have_selector('.card', count: 4) + expect(find('.board:nth-child(2)')).to have_selector('.card', count: 2) + expect(all('.board')[2]).to have_selector('.card', count: 4) - page.within(all('.board')[1]) do + page.within(all('.board')[2]) do expect(all('.card').last).to have_content(issue3.title) end end it 'moves to index of another list' do - drag(list_from_index: 0, list_to_index: 1, to_index: 1) + drag(list_from_index: 1, list_to_index: 2, to_index: 1) - wait_for_vue_resource + wait_for_requests - expect(first('.board')).to have_selector('.card', count: 2) - expect(all('.board')[1]).to have_selector('.card', count: 4) + expect(find('.board:nth-child(2)')).to have_selector('.card', count: 2) + expect(all('.board')[2]).to have_selector('.card', count: 4) - page.within(all('.board')[1]) do + page.within(all('.board')[2]) do expect(all('.card')[1]).to have_content(issue3.title) end end end - def drag(selector: '.board-list', list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0) + def drag(selector: '.board-list', list_from_index: 1, from_index: 0, to_index: 0, list_to_index: 1) drag_to(selector: selector, scrollable: '#board-app', list_from_index: list_from_index, |