Commit b668e07f authored by Michael Kozono's avatar Michael Kozono Committed by Douglas Barbosa Alexandre

Fix usages of boards dropdown

parent d92be5a6
# frozen_string_literal: true # frozen_string_literal: true
shared_examples_for 'multiple issue boards' do shared_examples_for 'multiple issue boards' do
dropdown_selector = '.js-boards-selector .dropdown-menu'
context 'authorized user' do context 'authorized user' do
before do before do
parent.add_maintainer(user) parent.add_maintainer(user)
...@@ -20,18 +18,14 @@ shared_examples_for 'multiple issue boards' do ...@@ -20,18 +18,14 @@ shared_examples_for 'multiple issue boards' do
end end
it 'shows a list of boards' do it 'shows a list of boards' do
click_button board.name in_boards_switcher_dropdown do
page.within(dropdown_selector) do
expect(page).to have_content(board.name) expect(page).to have_content(board.name)
expect(page).to have_content(board2.name) expect(page).to have_content(board2.name)
end end
end end
it 'switches current board' do it 'switches current board' do
click_button board.name in_boards_switcher_dropdown do
page.within(dropdown_selector) do
click_link board2.name click_link board2.name
end end
...@@ -43,9 +37,7 @@ shared_examples_for 'multiple issue boards' do ...@@ -43,9 +37,7 @@ shared_examples_for 'multiple issue boards' do
end end
it 'creates new board without detailed configuration' do it 'creates new board without detailed configuration' do
click_button board.name in_boards_switcher_dropdown do
page.within(dropdown_selector) do
click_button 'Create new board' click_button 'Create new board'
end end
...@@ -57,28 +49,23 @@ shared_examples_for 'multiple issue boards' do ...@@ -57,28 +49,23 @@ shared_examples_for 'multiple issue boards' do
end end
it 'deletes board' do it 'deletes board' do
click_button board.name in_boards_switcher_dropdown do
wait_for_requests
page.within(dropdown_selector) do
click_button 'Delete board' click_button 'Delete board'
end end
expect(page).to have_content('Are you sure you want to delete this board?') expect(page).to have_content('Are you sure you want to delete this board?')
click_button 'Delete' click_button 'Delete'
click_button board2.name wait_for_requests
page.within(dropdown_selector) do
in_boards_switcher_dropdown do
expect(page).not_to have_content(board.name) expect(page).not_to have_content(board.name)
expect(page).to have_content(board2.name) expect(page).to have_content(board2.name)
end end
end end
it 'adds a list to the none default board' do it 'adds a list to the none default board' do
click_button board.name in_boards_switcher_dropdown do
page.within(dropdown_selector) do
click_link board2.name click_link board2.name
end end
...@@ -100,9 +87,7 @@ shared_examples_for 'multiple issue boards' do ...@@ -100,9 +87,7 @@ shared_examples_for 'multiple issue boards' do
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 3)
click_button board2.name in_boards_switcher_dropdown do
page.within(dropdown_selector) do
click_link board.name click_link board.name
end end
...@@ -114,9 +99,9 @@ shared_examples_for 'multiple issue boards' do ...@@ -114,9 +99,9 @@ shared_examples_for 'multiple issue boards' do
it 'maintains sidebar state over board switch' do it 'maintains sidebar state over board switch' do
assert_boards_nav_active assert_boards_nav_active
find('.boards-switcher').click in_boards_switcher_dropdown do
wait_for_requests click_link board2.name
click_link board2.name end
assert_boards_nav_active assert_boards_nav_active
end end
...@@ -129,15 +114,24 @@ shared_examples_for 'multiple issue boards' do ...@@ -129,15 +114,24 @@ shared_examples_for 'multiple issue boards' do
end end
it 'does not show action links' do it 'does not show action links' do
click_button board.name in_boards_switcher_dropdown do
page.within(dropdown_selector) do
expect(page).not_to have_content('Create new board') expect(page).not_to have_content('Create new board')
expect(page).not_to have_content('Delete board') expect(page).not_to have_content('Delete board')
end end
end end
end end
def in_boards_switcher_dropdown
find('.boards-switcher').click
wait_for_requests
dropdown_selector = '.js-boards-selector .dropdown-menu'
page.within(dropdown_selector) do
yield
end
end
def assert_boards_nav_active def assert_boards_nav_active
expect(find('.nav-sidebar .active .active')).to have_selector('a', text: 'Boards') expect(find('.nav-sidebar .active .active')).to have_selector('a', text: 'Boards')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment