Commit 9cd04e14 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Make all scoped_issues_board_spec integration tests GREEN

parent 7b93b8ae
...@@ -46,7 +46,7 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({ ...@@ -46,7 +46,7 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
let assigneeIds = issue.assignees let assigneeIds = issue.assignees
.map(assignee => assignee.id) .map(assignee => assignee.id)
.filter(id => id !== board.assignee_id); .filter(id => id !== board.assignee.id);
if (assigneeIds.length === 0) { if (assigneeIds.length === 0) {
// for backend to explicitly set No Assignee // for backend to explicitly set No Assignee
assigneeIds = ['0']; assigneeIds = ['0'];
......
...@@ -6,5 +6,10 @@ module Boards ...@@ -6,5 +6,10 @@ module Boards
def initialize(parent, user, params = {}) def initialize(parent, user, params = {})
@parent, @current_user, @params = parent, user, params.dup @parent, @current_user, @params = parent, user, params.dup
end end
def set_assignee
assignee = User.find_by(id: params.delete(:assignee_id))
params.merge!(assignee: assignee)
end
end end
end end
...@@ -13,6 +13,7 @@ module Boards ...@@ -13,6 +13,7 @@ module Boards
end end
def create_board! def create_board!
set_assignee
board = parent.boards.create(params) board = parent.boards.create(params)
if board.persisted? if board.persisted?
......
...@@ -12,10 +12,5 @@ module Boards ...@@ -12,10 +12,5 @@ module Boards
board.update(params) board.update(params)
end end
def set_assignee
assignee = User.find_by(id: params.delete(:assignee_id))
params.merge!(assignee: assignee)
end
end end
end end
...@@ -24,7 +24,6 @@ describe 'Scoped issue boards', :js do ...@@ -24,7 +24,6 @@ describe 'Scoped issue boards', :js do
before do before do
allow_any_instance_of(ApplicationHelper).to receive(:collapsed_sidebar?).and_return(true) allow_any_instance_of(ApplicationHelper).to receive(:collapsed_sidebar?).and_return(true)
stub_licensed_features(multiple_issue_boards: true) stub_licensed_features(multiple_issue_boards: true)
stub_licensed_features(group_issue_boards: true)
stub_licensed_features(scoped_issue_boards: true) stub_licensed_features(scoped_issue_boards: true)
end end
...@@ -52,7 +51,6 @@ describe 'Scoped issue boards', :js do ...@@ -52,7 +51,6 @@ describe 'Scoped issue boards', :js do
it 'creates board to filtering by Any Milestone' do it 'creates board to filtering by Any Milestone' do
create_board_milestone('Any Milestone') create_board_milestone('Any Milestone')
expect(page).to have_css('.js-visual-token')
expect(find('.tokens-container')).to have_content("") expect(find('.tokens-container')).to have_content("")
expect(page).to have_selector('.card', count: 3) expect(page).to have_selector('.card', count: 3)
end end
...@@ -82,7 +80,9 @@ describe 'Scoped issue boards', :js do ...@@ -82,7 +80,9 @@ describe 'Scoped issue boards', :js do
expect(page).to have_selector('.card', count: 1) expect(page).to have_selector('.card', count: 1)
end end
xit 'only shows group labels in list on group boards' do it 'only shows group labels in list on group boards' do
stub_licensed_features(group_issue_boards: true)
visit group_boards_path(group) visit group_boards_path(group)
wait_for_requests wait_for_requests
...@@ -92,8 +92,10 @@ describe 'Scoped issue boards', :js do ...@@ -92,8 +92,10 @@ describe 'Scoped issue boards', :js do
click_link 'Create new board' click_link 'Create new board'
end end
click_button 'Expand'
page.within('.labels') do page.within('.labels') do
click_link 'Edit' click_button 'Edit'
page.within('.dropdown') do page.within('.dropdown') do
expect(page).to have_content(group_label.title) expect(page).to have_content(group_label.title)
expect(page).not_to have_content(project_label.title) expect(page).not_to have_content(project_label.title)
...@@ -183,7 +185,6 @@ describe 'Scoped issue boards', :js do ...@@ -183,7 +185,6 @@ describe 'Scoped issue boards', :js do
it 'sets board milestone' do it 'sets board milestone' do
update_board_milestone(milestone.title) update_board_milestone(milestone.title)
expect(page).to have_css('.js-visual-token')
expect(find('.tokens-container')).to have_content(milestone.title) expect(find('.tokens-container')).to have_content(milestone.title)
expect(page).to have_selector('.card', count: 1) expect(page).to have_selector('.card', count: 1)
end end
...@@ -191,7 +192,6 @@ describe 'Scoped issue boards', :js do ...@@ -191,7 +192,6 @@ describe 'Scoped issue boards', :js do
it 'sets board to any milestone' do it 'sets board to any milestone' do
update_board_milestone('Any Milestone') update_board_milestone('Any Milestone')
expect(page).not_to have_css('.js-visual-token')
expect(find('.tokens-container')).not_to have_content(milestone.title) expect(find('.tokens-container')).not_to have_content(milestone.title)
find('.card', match: :first) find('.card', match: :first)
...@@ -272,11 +272,13 @@ describe 'Scoped issue boards', :js do ...@@ -272,11 +272,13 @@ describe 'Scoped issue boards', :js do
context 'group board' do context 'group board' do
it 'only shows group labels in list' do it 'only shows group labels in list' do
stub_licensed_features(group_issue_boards: true)
visit group_boards_path(group) visit group_boards_path(group)
edit_board.click edit_board.click
page.within(".labels") do page.within('.labels') do
click_link 'Edit' click_button 'Edit'
page.within('.dropdown') do page.within('.dropdown') do
expect(page).to have_content(group_label.title) expect(page).to have_content(group_label.title)
expect(page).not_to have_content(project_label.title) expect(page).not_to have_content(project_label.title)
...@@ -325,7 +327,7 @@ describe 'Scoped issue boards', :js do ...@@ -325,7 +327,7 @@ describe 'Scoped issue boards', :js do
end end
it 'sets board to Any weight' do it 'sets board to Any weight' do
update_board_weight('Any weight') update_board_weight('Any Weight')
expect(page).to have_selector('.card', count: 4) expect(page).to have_selector('.card', count: 4)
end end
...@@ -347,6 +349,7 @@ describe 'Scoped issue boards', :js do ...@@ -347,6 +349,7 @@ describe 'Scoped issue boards', :js do
let!(:list) { create(:list, board: board, label: project_label, position: 0) } let!(:list) { create(:list, board: board, label: project_label, position: 0) }
it 'removes issues milestone when removing from the board' do it 'removes issues milestone when removing from the board' do
board.update(milestone: milestone, assignee: user)
visit project_boards_path(project) visit project_boards_path(project)
wait_for_requests wait_for_requests
...@@ -466,6 +469,8 @@ describe 'Scoped issue boards', :js do ...@@ -466,6 +469,8 @@ describe 'Scoped issue boards', :js do
end end
end end
click_on_board_modal
click_button 'Create' click_button 'Create'
expect(page).to have_selector('.board-list-loading') expect(page).to have_selector('.board-list-loading')
expect(page).not_to have_selector('.board-list-loading') expect(page).not_to have_selector('.board-list-loading')
...@@ -475,12 +480,20 @@ describe 'Scoped issue boards', :js do ...@@ -475,12 +480,20 @@ describe 'Scoped issue boards', :js do
edit_board.click edit_board.click
page.within(".#{filter}") do page.within(".#{filter}") do
click_link 'Edit' click_button 'Edit'
click_link value click_link value
end end
click_on_board_modal
click_button 'Save' click_button 'Save'
expect(page).to have_selector('.board-list-loading') expect(page).to have_selector('.board-list-loading')
expect(page).not_to have_selector('.board-list-loading') expect(page).not_to have_selector('.board-list-loading')
end end
# Click on modal to make sure the dropdown is closed (e.g. label scenario)
#
def click_on_board_modal
find('.board-config-modal').click
end
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