diff options
author | Felipe Artur <fcardozo@gitlab.com> | 2019-08-16 06:34:55 +0000 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2019-08-16 06:34:55 +0000 |
commit | 01b2342292e34f15ae1e5b5d2f288043c8c0aef9 (patch) | |
tree | dbc0f792623c628015a709f5b9928446fb9381fd /spec | |
parent | 2be32287f56c333734d6bc1c2fdd7498ea70d1e6 (diff) | |
download | gitlab-ce-01b2342292e34f15ae1e5b5d2f288043c8c0aef9.tar.gz |
Add feature specs for multiple group issue boards
Add feature specs for multiple issue boards for groups
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/boards/multiple_boards_spec.rb | 15 | ||||
-rw-r--r-- | spec/support/shared_examples/boards/multiple_issue_boards_shared_examples.rb | 144 |
2 files changed, 159 insertions, 0 deletions
diff --git a/spec/features/boards/multiple_boards_spec.rb b/spec/features/boards/multiple_boards_spec.rb new file mode 100644 index 00000000000..9a2b7a80498 --- /dev/null +++ b/spec/features/boards/multiple_boards_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe 'Multiple Issue Boards', :js do + set(:user) { create(:user) } + set(:project) { create(:project, :public) } + set(:planning) { create(:label, project: project, name: 'Planning') } + set(:board) { create(:board, name: 'board1', project: project) } + set(:board2) { create(:board, name: 'board2', project: project) } + let(:parent) { project } + let(:boards_path) { project_boards_path(project) } + + it_behaves_like 'multiple issue boards' +end diff --git a/spec/support/shared_examples/boards/multiple_issue_boards_shared_examples.rb b/spec/support/shared_examples/boards/multiple_issue_boards_shared_examples.rb new file mode 100644 index 00000000000..76d82649c5f --- /dev/null +++ b/spec/support/shared_examples/boards/multiple_issue_boards_shared_examples.rb @@ -0,0 +1,144 @@ +# frozen_string_literal: true + +shared_examples_for 'multiple issue boards' do + dropdown_selector = '.js-boards-selector .dropdown-menu' + + context 'authorized user' do + before do + parent.add_maintainer(user) + + login_as(user) + + visit boards_path + wait_for_requests + end + + it 'shows current board name' do + page.within('.boards-switcher') do + expect(page).to have_content(board.name) + end + end + + it 'shows a list of boards' do + click_button board.name + + page.within(dropdown_selector) do + expect(page).to have_content(board.name) + expect(page).to have_content(board2.name) + end + end + + it 'switches current board' do + click_button board.name + + page.within(dropdown_selector) do + click_link board2.name + end + + wait_for_requests + + page.within('.boards-switcher') do + expect(page).to have_content(board2.name) + end + end + + it 'creates new board without detailed configuration' do + click_button board.name + + page.within(dropdown_selector) do + click_button 'Create new board' + end + + fill_in 'board-new-name', with: 'This is a new board' + click_button 'Create board' + wait_for_requests + + expect(page).to have_button('This is a new board') + end + + it 'deletes board' do + click_button board.name + + wait_for_requests + + page.within(dropdown_selector) do + click_button 'Delete board' + end + + expect(page).to have_content('Are you sure you want to delete this board?') + click_button 'Delete' + + click_button board2.name + page.within(dropdown_selector) do + expect(page).not_to have_content(board.name) + expect(page).to have_content(board2.name) + end + end + + it 'adds a list to the none default board' do + click_button board.name + + page.within(dropdown_selector) do + click_link board2.name + end + + wait_for_requests + + page.within('.boards-switcher') do + expect(page).to have_content(board2.name) + end + + click_button 'Add list' + + wait_for_requests + + page.within '.dropdown-menu-issues-board-new' do + click_link planning.title + end + + wait_for_requests + + expect(page).to have_selector('.board', count: 3) + + click_button board2.name + + page.within(dropdown_selector) do + click_link board.name + end + + wait_for_requests + + expect(page).to have_selector('.board', count: 2) + end + + it 'maintains sidebar state over board switch' do + assert_boards_nav_active + + find('.boards-switcher').click + wait_for_requests + click_link board2.name + + assert_boards_nav_active + end + end + + context 'unauthorized user' do + before do + visit boards_path + wait_for_requests + end + + it 'does not show action links' do + click_button board.name + + page.within(dropdown_selector) do + expect(page).not_to have_content('Create new board') + expect(page).not_to have_content('Delete board') + end + end + end + + def assert_boards_nav_active + expect(find('.nav-sidebar .active .active')).to have_selector('a', text: 'Boards') + end +end |