From 9bb08a7e53b22d7af8484e3921b6fe51996ca981 Mon Sep 17 00:00:00 2001 From: YarNayar Date: Tue, 31 Jan 2017 16:27:29 +0300 Subject: Adds /target_branch slash command functionality for merge requests Allows to use slash command /target_branch in merge requests notes and description. Command allows to specify target branch for current merge request. Proposed in #23619 --- .../user_uses_slash_commands_spec.rb | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'spec/features') diff --git a/spec/features/merge_requests/user_uses_slash_commands_spec.rb b/spec/features/merge_requests/user_uses_slash_commands_spec.rb index b13674b4db9..cf56715f508 100644 --- a/spec/features/merge_requests/user_uses_slash_commands_spec.rb +++ b/spec/features/merge_requests/user_uses_slash_commands_spec.rb @@ -120,5 +120,79 @@ feature 'Merge Requests > User uses slash commands', feature: true, js: true do expect(page).not_to have_content '/due 2016-08-28' end end + + describe '/target_branch command in merge request' do + let(:another_project) { create(:project, :public) } + let(:new_url_opts) { { merge_request: { source_branch: 'feature' } } } + + before do + logout + another_project.team << [user, :master] + login_with(user) + end + + it 'changes target_branch in new merge_request' do + visit new_namespace_project_merge_request_path(another_project.namespace, another_project, new_url_opts) + fill_in "merge_request_title", with: 'My brand new feature' + fill_in "merge_request_description", with: "le feature \n/target_branch fix\nFeature description:" + click_button "Submit merge request" + + merge_request = another_project.merge_requests.first + expect(merge_request.description).to eq "le feature \nFeature description:" + expect(merge_request.target_branch).to eq 'fix' + end + + it 'does not change target branch when merge request is edited' do + new_merge_request = create(:merge_request, source_project: another_project) + + visit edit_namespace_project_merge_request_path(another_project.namespace, another_project, new_merge_request) + fill_in "merge_request_description", with: "Want to update target branch\n/target_branch fix\n" + click_button "Save changes" + + new_merge_request = another_project.merge_requests.first + expect(new_merge_request.description).to include('/target_branch') + expect(new_merge_request.target_branch).not_to eq('fix') + end + end + + describe '/target_branch command from note' do + context 'when the current user can change target branch' do + it 'changes target branch from a note' do + write_note("message start \n/target_branch merge-test\n message end.") + + expect(page).not_to have_content('/target_branch') + expect(page).to have_content('message start') + expect(page).to have_content('message end.') + + expect(merge_request.reload.target_branch).to eq 'merge-test' + end + + it 'does not fail when target branch does not exists' do + write_note('/target_branch totally_not_existing_branch') + + expect(page).not_to have_content('/target_branch') + + expect(merge_request.target_branch).to eq 'feature' + end + end + + context 'when current user can not change target branch' do + let(:guest) { create(:user) } + before do + project.team << [guest, :guest] + logout + login_with(guest) + visit namespace_project_merge_request_path(project.namespace, project, merge_request) + end + + it 'does not change target branch' do + write_note('/target_branch merge-test') + + expect(page).not_to have_content '/target_branch merge-test' + + expect(merge_request.target_branch).to eq 'feature' + end + end + end end end -- cgit v1.2.1 From 6adb6caed9c6a25aa68ee9ceb37419543bb49e23 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 25 Jan 2017 16:53:09 +0000 Subject: Started tests --- spec/features/boards/add_issues_modal_spec.rb | 210 ++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 spec/features/boards/add_issues_modal_spec.rb (limited to 'spec/features') diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb new file mode 100644 index 00000000000..e6065c0740d --- /dev/null +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -0,0 +1,210 @@ +require 'rails_helper' + +describe 'Issue Boards add issue modal', :feature, :js do + include WaitForAjax + include WaitForVueResource + + let(:project) { create(:empty_project, :public) } + let(:board) { create(:board, project: project) } + let(:user) { create(:user) } + let!(:planning) { create(:label, project: project, name: 'Planning') } + let!(:label) { create(:label, project: project) } + let!(:list1) { create(:list, board: board, label: planning, position: 0) } + let!(:issue) { create(:issue, project: project) } + let!(:issue2) { create(:issue, project: project) } + + before do + project.team << [user, :master] + + login_as(user) + + visit namespace_project_board_path(project.namespace, project, board) + wait_for_vue_resource + end + + context 'modal interaction' do + it 'opens modal' do + click_button('Add issues') + + expect(page).to have_selector('.add-issues-modal') + end + + it 'closes modal' do + click_button('Add issues') + + page.within('.add-issues-modal') do + find('.close').click + end + + expect(page).not_to have_selector('.add-issues-modal') + end + + it 'closes modal if cancel button clicked' do + click_button('Add issues') + + page.within('.add-issues-modal') do + click_button 'Cancel' + end + + expect(page).not_to have_selector('.add-issues-modal') + end + end + + context 'issues list' do + before do + click_button('Add issues') + + wait_for_vue_resource + end + + it 'loads issues' do + page.within('.add-issues-modal') do + page.within('.nav-links') do + expect(page).to have_content('2') + end + + expect(page).to have_selector('.card', count: 2) + end + end + + it 'shows selected issues' do + page.within('.add-issues-modal') do + click_link 'Selected issues' + + expect(page).not_to have_selector('.card') + end + end + + context 'search' do + it 'returns issues' do + page.within('.add-issues-modal') do + find('.form-control').native.send_keys(issue.title) + + expect(page).to have_selector('.card', count: 1) + end + end + + it 'returns no issues' do + page.within('.add-issues-modal') do + find('.form-control').native.send_keys('testing search') + + expect(page).not_to have_selector('.card') + end + end + end + + context 'selecing issues' do + it 'selects single issue' do + page.within('.add-issues-modal') do + first('.card').click + + page.within('.nav-links') do + expect(page).to have_content('Selected issues 1') + end + end + end + + it 'changes button text' do + page.within('.add-issues-modal') do + first('.card').click + + expect(first('.add-issues-footer .btn')).to have_content('Add 1 issue') + end + end + + it 'changes button text with plural' do + page.within('.add-issues-modal') do + all('.card').each do |el| + el.click + end + + expect(first('.add-issues-footer .btn')).to have_content('Add 2 issues') + end + end + + it 'shows only selected issues on selected tab' do + page.within('.add-issues-modal') do + first('.card').click + + click_link 'Selected issues' + + expect(page).to have_selector('.card', count: 1) + end + end + + it 'selects all issues' do + page.within('.add-issues-modal') do + click_button 'Select all' + + expect(page).to have_selector('.is-active', count: 2) + end + end + + it 'un-selects all issues' do + page.within('.add-issues-modal') do + click_button 'Select all' + + expect(page).to have_selector('.is-active', count: 2) + + click_button 'Un-select all' + + expect(page).not_to have_selector('.is-active') + end + end + + it 'selects all that arent already selected' do + page.within('.add-issues-modal') do + first('.card').click + + expect(page).to have_selector('.is-active', count: 1) + + click_button 'Select all' + + expect(page).to have_selector('.is-active', count: 2) + end + end + + it 'unselects from selected tab' do + page.within('.add-issues-modal') do + first('.card').click + + click_link 'Selected issues' + + first('.card').click + + expect(page).not_to have_selector('.card') + end + end + end + + context 'adding issues' do + it 'adds to board' do + page.within('.add-issues-modal') do + first('.card').click + + click_button 'Add 1 issue' + end + + page.within(first('.board')) do + expect(page).to have_selector('.card') + end + end + + it 'adds to second list' do + page.within('.add-issues-modal') do + first('.card').click + + click_button planning.title + + click_link label.title + + click_button 'Add 1 issue' + end + + page.within(find('.board:nth-child(2)')) do + expect(page).to have_selector('.card') + end + end + end + end +end -- cgit v1.2.1 From 8a2ecebe439629239ffe3e414477b7fe6a033177 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Fri, 27 Jan 2017 03:28:06 -0200 Subject: Fix feature spec to create new issue on issue boards --- spec/features/boards/new_issue_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/new_issue_spec.rb b/spec/features/boards/new_issue_spec.rb index a03cd6fbf2d..6d14a8cf483 100644 --- a/spec/features/boards/new_issue_spec.rb +++ b/spec/features/boards/new_issue_spec.rb @@ -6,6 +6,7 @@ describe 'Issue Boards new issue', feature: true, js: true do let(:project) { create(:empty_project, :public) } let(:board) { create(:board, project: project) } + let!(:list) { create(:list, board: board, position: 0) } let(:user) { create(:user) } context 'authorized user' do @@ -17,7 +18,7 @@ describe 'Issue Boards new issue', feature: true, js: true do visit namespace_project_board_path(project.namespace, project, board) wait_for_vue_resource - expect(page).to have_selector('.board', count: 3) + expect(page).to have_selector('.board', count: 2) end it 'displays new issue button' do @@ -25,7 +26,7 @@ describe 'Issue Boards new issue', feature: true, js: true do end it 'does not display new issue button in done list' do - page.within('.board:nth-child(3)') do + page.within('.board:nth-child(2)') do expect(page).not_to have_selector('.board-issue-count-holder .btn') end end -- cgit v1.2.1 From f99a1edf705c26cb9602596e18a9213857894cab Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Fri, 27 Jan 2017 03:28:45 -0200 Subject: Fix feature spec for issue sidebar on issue boards --- spec/features/boards/sidebar_spec.rb | 63 +++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 30 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index c28bb0dcdae..a0f32d2ab76 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -4,14 +4,17 @@ describe 'Issue Boards', feature: true, js: true do include WaitForAjax include WaitForVueResource - let(:project) { create(:empty_project, :public) } - let(:board) { create(:board, project: project) } - let(:user) { create(:user) } - let!(:label) { create(:label, project: project) } - let!(:label2) { create(:label, project: project) } - let!(:milestone) { create(:milestone, project: project) } - let!(:issue2) { create(:labeled_issue, project: project, assignee: user, milestone: milestone, labels: [label]) } - let!(:issue) { create(:issue, project: project) } + let(:user) { create(:user) } + let(:project) { create(:empty_project, :public) } + let!(:milestone) { create(:milestone, project: project) } + let!(:development) { create(:label, project: project, name: 'Development') } + let!(:bug) { create(:label, project: project, name: 'Bug') } + let!(:regression) { create(:label, project: project, name: 'Regression') } + let!(:stretch) { create(:label, project: project, name: 'Stretch') } + let!(:issue1) { create(:labeled_issue, project: project, assignee: user, milestone: milestone, labels: [development]) } + let!(:issue2) { create(:labeled_issue, project: project, labels: [development, stretch]) } + let(:board) { create(:board, project: project) } + let!(:list) { create(:list, board: board, label: development, position: 0) } before do project.team << [user, :master] @@ -62,8 +65,8 @@ describe 'Issue Boards', feature: true, js: true do end page.within('.issue-boards-sidebar') do - expect(page).to have_content(issue.title) - expect(page).to have_content(issue.to_reference) + expect(page).to have_content(issue2.title) + expect(page).to have_content(issue2.to_reference) end end @@ -244,22 +247,22 @@ describe 'Issue Boards', feature: true, js: true do wait_for_ajax - click_link label.title + click_link bug.title wait_for_vue_resource find('.dropdown-menu-close-icon').click page.within('.value') do - expect(page).to have_selector('.label', count: 1) - expect(page).to have_content(label.title) + expect(page).to have_selector('.label', count: 3) + expect(page).to have_content(bug.title) end end page.within(first('.board')) do page.within(first('.card')) do - expect(page).to have_selector('.label', count: 1) - expect(page).to have_content(label.title) + expect(page).to have_selector('.label', count: 2) + expect(page).to have_content(bug.title) end end end @@ -274,32 +277,32 @@ describe 'Issue Boards', feature: true, js: true do wait_for_ajax - click_link label.title - click_link label2.title + click_link bug.title + click_link regression.title wait_for_vue_resource find('.dropdown-menu-close-icon').click page.within('.value') do - expect(page).to have_selector('.label', count: 2) - expect(page).to have_content(label.title) - expect(page).to have_content(label2.title) + expect(page).to have_selector('.label', count: 4) + expect(page).to have_content(bug.title) + expect(page).to have_content(regression.title) end end page.within(first('.board')) do page.within(first('.card')) do - expect(page).to have_selector('.label', count: 2) - expect(page).to have_content(label.title) - expect(page).to have_content(label2.title) + expect(page).to have_selector('.label', count: 3) + expect(page).to have_content(bug.title) + expect(page).to have_content(regression.title) end end end it 'removes a label' do page.within(first('.board')) do - find('.card:nth-child(2)').click + first('.card').click end page.within('.labels') do @@ -307,22 +310,22 @@ describe 'Issue Boards', feature: true, js: true do wait_for_ajax - click_link label.title + click_link stretch.title wait_for_vue_resource find('.dropdown-menu-close-icon').click page.within('.value') do - expect(page).to have_selector('.label', count: 0) - expect(page).not_to have_content(label.title) + expect(page).to have_selector('.label', count: 1) + expect(page).not_to have_content(stretch.title) end end page.within(first('.board')) do - page.within(find('.card:nth-child(2)')) do - expect(page).not_to have_selector('.label', count: 1) - expect(page).not_to have_content(label.title) + page.within(first('.card')) do + expect(page).not_to have_selector('.label') + expect(page).not_to have_content(stretch.title) end end end -- cgit v1.2.1 From c4fc17f258d10ec86d0023c44126362ca8fa63c4 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 27 Jan 2017 11:14:50 +0000 Subject: Boards spec update to take into account removed backlog --- spec/features/boards/boards_spec.rb | 217 ++++++++++++------------------------ 1 file changed, 72 insertions(+), 145 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index bfac5a1b8ab..34f47daf0e5 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -20,7 +20,7 @@ describe 'Issue Boards', feature: true, js: true do before do visit namespace_project_board_path(project.namespace, project, board) wait_for_vue_resource - expect(page).to have_selector('.board', count: 3) + expect(page).to have_selector('.board', count: 2) end it 'shows blank state' do @@ -31,18 +31,18 @@ describe 'Issue Boards', feature: true, js: true do page.within(find('.board-blank-state')) do click_button("Nevermind, I'll use my own") end - expect(page).to have_selector('.board', count: 2) + expect(page).to have_selector('.board', count: 1) end it 'creates default lists' do - lists = ['Backlog', 'To Do', 'Doing', 'Done'] + lists = ['To Do', 'Doing', 'Done'] page.within(find('.board-blank-state')) do click_button('Add default lists') end wait_for_vue_resource - expect(page).to have_selector('.board', count: 4) + expect(page).to have_selector('.board', count: 3) page.all('.board').each_with_index do |list, i| expect(list.find('.board-title')).to have_content(lists[i]) @@ -64,42 +64,41 @@ describe 'Issue Boards', feature: true, js: true do let!(:list1) { create(:list, board: board, label: planning, position: 0) } let!(:list2) { create(:list, board: board, label: development, position: 1) } - let!(:confidential_issue) { create(:issue, :confidential, project: project, author: user) } - let!(:issue1) { create(:issue, project: project, assignee: user) } - let!(:issue2) { create(:issue, project: project, author: user2) } - let!(:issue3) { create(:issue, project: project) } - let!(:issue4) { create(:issue, project: project) } + let!(:confidential_issue) { create(:labeled_issue, :confidential, project: project, author: user, labels: [planning]) } + let!(:issue1) { create(:labeled_issue, project: project, assignee: user, labels: [planning]) } + let!(:issue2) { create(:labeled_issue, project: project, author: user2, labels: [planning]) } + let!(:issue3) { create(:labeled_issue, project: project, labels: [planning]) } + let!(:issue4) { create(:labeled_issue, project: project, labels: [planning]) } let!(:issue5) { create(:labeled_issue, project: project, labels: [planning], milestone: milestone) } let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development]) } let!(:issue7) { create(:labeled_issue, project: project, labels: [development]) } let!(:issue8) { create(:closed_issue, project: project) } - let!(:issue9) { create(:labeled_issue, project: project, labels: [testing, bug, accepting]) } + let!(:issue9) { create(:labeled_issue, project: project, labels: [planning, testing, bug, accepting]) } before do visit namespace_project_board_path(project.namespace, project, board) wait_for_vue_resource - expect(page).to have_selector('.board', count: 4) + expect(page).to have_selector('.board', count: 3) expect(find('.board:nth-child(1)')).to have_selector('.card') expect(find('.board:nth-child(2)')).to have_selector('.card') expect(find('.board:nth-child(3)')).to have_selector('.card') - expect(find('.board:nth-child(4)')).to have_selector('.card') end it 'shows lists' do - expect(page).to have_selector('.board', count: 4) + expect(page).to have_selector('.board', count: 3) end it 'shows description tooltip on list title' do - page.within('.board:nth-child(2)') do + page.within('.board:nth-child(1)') do expect(find('.board-title span.has-tooltip')[:title]).to eq('Test') end end it 'shows issues in lists' do + wait_for_board_cards(1, 8) wait_for_board_cards(2, 2) - wait_for_board_cards(3, 2) end it 'shows confidential issues with icon' do @@ -108,19 +107,6 @@ describe 'Issue Boards', feature: true, js: true do end end - it 'search backlog list' do - page.within('#js-boards-search') do - find('.form-control').set(issue1.title) - end - - wait_for_vue_resource - - expect(find('.board:nth-child(1)')).to have_selector('.card', count: 1) - expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0) - expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0) - expect(find('.board:nth-child(4)')).to have_selector('.card', count: 0) - end - it 'search done list' do page.within('#js-boards-search') do find('.form-control').set(issue8.title) @@ -130,8 +116,7 @@ describe 'Issue Boards', feature: true, js: true do expect(find('.board:nth-child(1)')).to have_selector('.card', count: 0) expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0) - expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0) - expect(find('.board:nth-child(4)')).to have_selector('.card', count: 1) + expect(find('.board:nth-child(3)')).to have_selector('.card', count: 1) end it 'search list' do @@ -141,157 +126,135 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource - expect(find('.board:nth-child(1)')).to have_selector('.card', count: 0) - expect(find('.board:nth-child(2)')).to have_selector('.card', count: 1) + expect(find('.board:nth-child(1)')).to have_selector('.card', count: 1) + expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0) expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0) - expect(find('.board:nth-child(4)')).to have_selector('.card', count: 0) end it 'allows user to delete board' do - page.within(find('.board:nth-child(2)')) do + page.within(find('.board:nth-child(1)')) do find('.board-delete').click end wait_for_vue_resource - expect(page).to have_selector('.board', count: 3) + expect(page).to have_selector('.board', count: 2) end it 'removes checkmark in new list dropdown after deleting' do click_button 'Add list' wait_for_ajax - page.within(find('.board:nth-child(2)')) do + page.within(find('.board:nth-child(1)')) do find('.board-delete').click end wait_for_vue_resource - expect(page).to have_selector('.board', count: 3) - expect(find(".js-board-list-#{planning.id}", visible: false)).not_to have_css('.is-active') + expect(page).to have_selector('.board', count: 2) end it 'infinite scrolls list' do 50.times do - create(:issue, project: project) + create(:labeled_issue, project: project, labels: [planning]) end visit namespace_project_board_path(project.namespace, project, board) wait_for_vue_resource page.within(find('.board', match: :first)) do - expect(page.find('.board-header')).to have_content('56') + expect(page.find('.board-header')).to have_content('58') expect(page).to have_selector('.card', count: 20) - expect(page).to have_content('Showing 20 of 56 issues') + expect(page).to have_content('Showing 20 of 58 issues') evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight") wait_for_vue_resource expect(page).to have_selector('.card', count: 40) - expect(page).to have_content('Showing 40 of 56 issues') + expect(page).to have_content('Showing 40 of 58 issues') evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight") wait_for_vue_resource - expect(page).to have_selector('.card', count: 56) + expect(page).to have_selector('.card', count: 58) expect(page).to have_content('Showing all issues') end end - context 'backlog' do - it 'shows issues in backlog with no labels' do - wait_for_board_cards(1, 6) - end - - it 'moves issue from backlog into list' do - drag_to(list_to_index: 1) - - wait_for_vue_resource - wait_for_board_cards(1, 5) - wait_for_board_cards(2, 3) - end - end - context 'done' do it 'shows list of done issues' do - wait_for_board_cards(4, 1) + wait_for_board_cards(3, 1) wait_for_ajax end it 'moves issue to done' do - drag_to(list_from_index: 0, list_to_index: 3) + drag_to(list_from_index: 0, list_to_index: 2) - wait_for_board_cards(1, 5) + wait_for_board_cards(1, 7) wait_for_board_cards(2, 2) wait_for_board_cards(3, 2) - wait_for_board_cards(4, 2) expect(find('.board:nth-child(1)')).not_to have_content(issue9.title) - expect(find('.board:nth-child(4)')).to have_selector('.card', count: 2) - expect(find('.board:nth-child(4)')).to have_content(issue9.title) - expect(find('.board:nth-child(4)')).not_to have_content(planning.title) + expect(find('.board:nth-child(3)')).to have_selector('.card', count: 2) + expect(find('.board:nth-child(3)')).to have_content(issue9.title) + expect(find('.board:nth-child(3)')).not_to have_content(planning.title) end it 'removes all of the same issue to done' do - drag_to(list_from_index: 1, list_to_index: 3) + drag_to(list_from_index: 0, list_to_index: 2) - wait_for_board_cards(1, 6) - wait_for_board_cards(2, 1) - wait_for_board_cards(3, 1) - wait_for_board_cards(4, 2) + wait_for_board_cards(1, 7) + wait_for_board_cards(2, 2) + wait_for_board_cards(3, 2) - expect(find('.board:nth-child(2)')).not_to have_content(issue6.title) - expect(find('.board:nth-child(4)')).to have_content(issue6.title) - expect(find('.board:nth-child(4)')).not_to have_content(planning.title) + expect(find('.board:nth-child(1)')).not_to have_content(issue9.title) + expect(find('.board:nth-child(3)')).to have_content(issue9.title) + expect(find('.board:nth-child(3)')).not_to have_content(planning.title) end end context 'lists' do it 'changes position of list' do - drag_to(list_from_index: 1, list_to_index: 2, selector: '.board-header') + drag_to(list_from_index: 1, list_to_index: 0, selector: '.board-header') - wait_for_board_cards(1, 6) - wait_for_board_cards(2, 2) - wait_for_board_cards(3, 2) - wait_for_board_cards(4, 1) + wait_for_board_cards(1, 2) + wait_for_board_cards(2, 8) + wait_for_board_cards(3, 1) - expect(find('.board:nth-child(2)')).to have_content(development.title) - expect(find('.board:nth-child(2)')).to have_content(planning.title) + expect(find('.board:nth-child(1)')).to have_content(development.title) + expect(find('.board:nth-child(1)')).to have_content(planning.title) end it 'issue moves between lists' do - drag_to(list_from_index: 1, card_index: 1, list_to_index: 2) + drag_to(list_from_index: 0, card_index: 1, list_to_index: 1) - wait_for_board_cards(1, 6) - wait_for_board_cards(2, 1) - wait_for_board_cards(3, 3) - wait_for_board_cards(4, 1) + wait_for_board_cards(1, 7) + wait_for_board_cards(2, 2) + wait_for_board_cards(3, 1) - expect(find('.board:nth-child(3)')).to have_content(issue6.title) - expect(find('.board:nth-child(3)').all('.card').last).not_to have_content(development.title) + expect(find('.board:nth-child(2)')).to have_content(issue6.title) + expect(find('.board:nth-child(2)').all('.card').last).not_to have_content(development.title) end it 'issue moves between lists' do - drag_to(list_from_index: 2, list_to_index: 1) + drag_to(list_from_index: 1, list_to_index: 0) - wait_for_board_cards(1, 6) - wait_for_board_cards(2, 3) + wait_for_board_cards(1, 9) + wait_for_board_cards(2, 1) wait_for_board_cards(3, 1) - wait_for_board_cards(4, 1) - expect(find('.board:nth-child(2)')).to have_content(issue7.title) - expect(find('.board:nth-child(2)').all('.card').first).not_to have_content(planning.title) + expect(find('.board:nth-child(1)')).to have_content(issue7.title) + expect(find('.board:nth-child(1)').all('.card').first).not_to have_content(planning.title) end it 'issue moves from done' do - drag_to(list_from_index: 3, list_to_index: 1) + drag_to(list_from_index: 2, list_to_index: 1) expect(find('.board:nth-child(2)')).to have_content(issue8.title) - wait_for_board_cards(1, 6) + wait_for_board_cards(1, 8) wait_for_board_cards(2, 3) - wait_for_board_cards(3, 2) - wait_for_board_cards(4, 0) + wait_for_board_cards(3, 0) end context 'issue card' do @@ -324,7 +287,7 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource - expect(page).to have_selector('.board', count: 5) + expect(page).to have_selector('.board', count: 4) end it 'creates new list for Backlog label' do @@ -337,7 +300,7 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource - expect(page).to have_selector('.board', count: 5) + expect(page).to have_selector('.board', count: 4) end it 'creates new list for Done label' do @@ -350,7 +313,7 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource - expect(page).to have_selector('.board', count: 5) + expect(page).to have_selector('.board', count: 4) end it 'keeps dropdown open after adding new list' do @@ -366,21 +329,6 @@ describe 'Issue Boards', feature: true, js: true do expect(find('.issue-boards-search')).to have_selector('.open') end - it 'moves issues from backlog into new list' do - wait_for_board_cards(1, 6) - - click_button 'Add list' - wait_for_ajax - - page.within('.dropdown-menu-issues-board-new') do - click_link testing.title - end - - wait_for_vue_resource - - wait_for_board_cards(1, 5) - end - it 'creates new list from a new label' do click_button 'Add list' @@ -397,7 +345,7 @@ describe 'Issue Boards', feature: true, js: true do wait_for_ajax wait_for_vue_resource - expect(page).to have_selector('.board', count: 5) + expect(page).to have_selector('.board', count: 4) end end end @@ -418,7 +366,7 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource wait_for_board_cards(1, 1) - wait_for_empty_boards((2..4)) + wait_for_empty_boards((2..3)) end it 'filters by assignee' do @@ -437,7 +385,7 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource wait_for_board_cards(1, 1) - wait_for_empty_boards((2..4)) + wait_for_empty_boards((2..3)) end it 'filters by milestone' do @@ -454,10 +402,9 @@ describe 'Issue Boards', feature: true, js: true do end wait_for_vue_resource - wait_for_board_cards(1, 0) - wait_for_board_cards(2, 1) + wait_for_board_cards(1, 1) + wait_for_board_cards(2, 0) wait_for_board_cards(3, 0) - wait_for_board_cards(4, 0) end it 'filters by label' do @@ -474,7 +421,7 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource wait_for_board_cards(1, 1) - wait_for_empty_boards((2..4)) + wait_for_empty_boards((2..3)) end it 'filters by label with space after reload' do @@ -530,7 +477,7 @@ describe 'Issue Boards', feature: true, js: true do it 'infinite scrolls list with label filter' do 50.times do - create(:labeled_issue, project: project, labels: [testing]) + create(:labeled_issue, project: project, labels: [planning, testing]) end page.within '.issues-filters' do @@ -580,32 +527,12 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource wait_for_board_cards(1, 1) - wait_for_empty_boards((2..4)) - end - - it 'filters by no label' do - page.within '.issues-filters' do - click_button('Label') - wait_for_ajax - - page.within '.dropdown-menu-labels' do - click_link("No Label") - wait_for_vue_resource - find('.dropdown-menu-close').click - end - end - - wait_for_vue_resource - - wait_for_board_cards(1, 5) - wait_for_board_cards(2, 0) - wait_for_board_cards(3, 0) - wait_for_board_cards(4, 1) + wait_for_empty_boards((2..3)) end it 'filters by clicking label button on issue' do page.within(find('.board', match: :first)) do - expect(page).to have_selector('.card', count: 6) + expect(page).to have_selector('.card', count: 8) expect(find('.card', match: :first)).to have_content(bug.title) click_button(bug.title) wait_for_vue_resource @@ -614,7 +541,7 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource wait_for_board_cards(1, 1) - wait_for_empty_boards((2..4)) + wait_for_empty_boards((2..3)) page.within('.labels-filter') do expect(find('.dropdown-toggle-text')).to have_content(bug.title) -- cgit v1.2.1 From a943241056961c7b820adfd8fd08edd25c3a563a Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 27 Jan 2017 16:49:56 +0000 Subject: Some styling updates Does not remove the issue from the selected tab when it it de-selected, it instead gets purged when changing tab --- spec/features/boards/add_issues_modal_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index e6065c0740d..5ba044a4f3c 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -10,6 +10,7 @@ describe 'Issue Boards add issue modal', :feature, :js do let!(:planning) { create(:label, project: project, name: 'Planning') } let!(:label) { create(:label, project: project) } let!(:list1) { create(:list, board: board, label: planning, position: 0) } + let!(:list2) { create(:list, board: board, label: label, position: 1) } let!(:issue) { create(:issue, project: project) } let!(:issue2) { create(:issue, project: project) } @@ -172,7 +173,7 @@ describe 'Issue Boards add issue modal', :feature, :js do first('.card').click - expect(page).not_to have_selector('.card') + expect(page).not_to have_selector('.is-active') end end end -- cgit v1.2.1 From 954deefa2253dae2c65246a19d6c7202b07715e1 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 30 Jan 2017 17:11:08 +0000 Subject: Added remove button --- spec/features/boards/sidebar_spec.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'spec/features') diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index a0f32d2ab76..ea135d0cc95 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -70,6 +70,38 @@ describe 'Issue Boards', feature: true, js: true do end end + it 'removes card from board when clicking remove button' do + page.within(first('.board')) do + first('.card').click + end + + page.within('.issue-boards-sidebar') do + click_button 'Remove from board' + end + + page.within(first('.board')) do + expect(page).to have_selector('.card', count: 1) + end + end + + it 'does not show remove issue button when issue is closed' do + page.within(first('.board')) do + first('.card').click + end + + page.within('.issue-boards-sidebar') do + click_button 'Remove from board' + end + + page.within(find('.board:nth-child(2)')) do + first('.card').click + end + + page.within('.issue-boards-sidebar') do + expect(page).not_to have_button 'Remove from board' + end + end + context 'assignee' do it 'updates the issues assignee' do page.within(first('.board')) do -- cgit v1.2.1 From 39fbd18951e7c6bd4b403cd82dd4e008fd00d6fe Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 31 Jan 2017 10:39:44 +0000 Subject: Fixed bug with empty state showing after search Fixed users href path being incorrect --- spec/features/boards/add_issues_modal_spec.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/features') diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index 5ba044a4f3c..ae245d7469b 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -90,6 +90,7 @@ describe 'Issue Boards add issue modal', :feature, :js do find('.form-control').native.send_keys('testing search') expect(page).not_to have_selector('.card') + expect(page).not_to have_content("You haven't added any issues to your project yet") end end end -- cgit v1.2.1 From cf5396d4b7158a97a49b3a75c6ebc8938954bd2b Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 31 Jan 2017 16:35:04 +0000 Subject: Fixed up specs --- spec/features/boards/add_issues_modal_spec.rb | 4 ++-- spec/features/boards/sidebar_spec.rb | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index ae245d7469b..b953480cec2 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -142,13 +142,13 @@ describe 'Issue Boards add issue modal', :feature, :js do end end - it 'un-selects all issues' do + it 'deselects all issues' do page.within('.add-issues-modal') do click_button 'Select all' expect(page).to have_selector('.is-active', count: 2) - click_button 'Un-select all' + click_button 'Deselect all' expect(page).not_to have_selector('.is-active') end diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index ea135d0cc95..9cc50167395 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -84,24 +84,6 @@ describe 'Issue Boards', feature: true, js: true do end end - it 'does not show remove issue button when issue is closed' do - page.within(first('.board')) do - first('.card').click - end - - page.within('.issue-boards-sidebar') do - click_button 'Remove from board' - end - - page.within(find('.board:nth-child(2)')) do - first('.card').click - end - - page.within('.issue-boards-sidebar') do - expect(page).not_to have_button 'Remove from board' - end - end - context 'assignee' do it 'updates the issues assignee' do page.within(first('.board')) do -- cgit v1.2.1 From fee064be01e6e37076b9af4028ade12a2ce0180a Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 3 Feb 2017 14:48:31 +0000 Subject: Fixed modal lists dropdown not updating when list is deleted --- spec/features/boards/add_issues_modal_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'spec/features') diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index b953480cec2..2875fc1e533 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -76,6 +76,27 @@ describe 'Issue Boards add issue modal', :feature, :js do end end + context 'list dropdown' do + it 'resets after deleting list' do + page.within('.add-issues-modal') do + expect(find('.add-issues-footer')).to have_button(planning.title) + + click_button 'Cancel' + end + + first('.board-delete').click + + click_button('Add issues') + + wait_for_vue_resource + + page.within('.add-issues-modal') do + expect(find('.add-issues-footer')).not_to have_button(planning.title) + expect(find('.add-issues-footer')).to have_button(label.title) + end + end + end + context 'search' do it 'returns issues' do page.within('.add-issues-modal') do -- cgit v1.2.1 From 9c60e8fb5963c55e1ea6cf28e3851d822f0bb540 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Fri, 3 Feb 2017 13:51:56 -0600 Subject: Fix slash commands spec error --- spec/features/merge_requests/user_uses_slash_commands_spec.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'spec/features') diff --git a/spec/features/merge_requests/user_uses_slash_commands_spec.rb b/spec/features/merge_requests/user_uses_slash_commands_spec.rb index 2b454b38231..2f3c3e45ae6 100644 --- a/spec/features/merge_requests/user_uses_slash_commands_spec.rb +++ b/spec/features/merge_requests/user_uses_slash_commands_spec.rb @@ -133,6 +133,8 @@ feature 'Merge Requests > User uses slash commands', feature: true, js: true do it 'changes target_branch in new merge_request' do visit new_namespace_project_merge_request_path(another_project.namespace, another_project, new_url_opts) + click_button "Compare branches and continue" + fill_in "merge_request_title", with: 'My brand new feature' fill_in "merge_request_description", with: "le feature \n/target_branch fix\nFeature description:" click_button "Submit merge request" -- cgit v1.2.1 From b63d7d4f8965597fd0a7291830ad391d1c74334e Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 3 Feb 2017 17:02:05 +0000 Subject: Change window size before visiting page, to get correct scroll position --- spec/features/merge_requests/toggler_behavior_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/toggler_behavior_spec.rb b/spec/features/merge_requests/toggler_behavior_spec.rb index 44a9b545ff8..a2cf9b18bf2 100644 --- a/spec/features/merge_requests/toggler_behavior_spec.rb +++ b/spec/features/merge_requests/toggler_behavior_spec.rb @@ -10,8 +10,8 @@ feature 'toggler_behavior', js: true, feature: true do before do login_as :admin project = merge_request.source_project - visit "#{namespace_project_merge_request_path(project.namespace, project, merge_request)}#{fragment_id}" page.current_window.resize_to(1000, 300) + visit "#{namespace_project_merge_request_path(project.namespace, project, merge_request)}#{fragment_id}" end describe 'scroll position' do -- cgit v1.2.1