2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 03:56:52 -04:00
|
|
|
require 'spec_helper'
|
2018-08-01 12:17:56 -04:00
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Group Boards' do
|
2021-08-18 08:11:19 -04:00
|
|
|
include DragTo
|
|
|
|
include MobileHelpers
|
|
|
|
include BoardHelpers
|
2018-08-01 12:17:56 -04:00
|
|
|
|
2021-08-18 08:11:19 -04:00
|
|
|
let_it_be(:group) { create(:group) }
|
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
|
|
|
|
context 'Creates an issue', :js do
|
|
|
|
let_it_be(:project) { create(:project_empty_repo, group: group) }
|
2018-08-01 12:17:56 -04:00
|
|
|
|
|
|
|
before do
|
2021-08-18 08:11:19 -04:00
|
|
|
group.add_maintainer(user)
|
|
|
|
|
|
|
|
sign_in(user)
|
|
|
|
|
2018-08-01 12:17:56 -04:00
|
|
|
visit group_boards_path(group)
|
|
|
|
end
|
|
|
|
|
2020-12-09 13:09:48 -05:00
|
|
|
it 'adds an issue to the backlog' do
|
2018-08-01 12:17:56 -04:00
|
|
|
page.within(find('.board', match: :first)) do
|
|
|
|
issue_title = 'New Issue'
|
2021-09-29 17:12:32 -04:00
|
|
|
click_button 'New issue'
|
2020-12-23 04:10:13 -05:00
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
2018-08-01 12:17:56 -04:00
|
|
|
expect(find('.board-new-issue-form')).to be_visible
|
|
|
|
|
|
|
|
fill_in 'issue_title', with: issue_title
|
|
|
|
|
2020-12-23 04:10:13 -05:00
|
|
|
page.within("[data-testid='project-select-dropdown']") do
|
|
|
|
find('button.gl-dropdown-toggle').click
|
|
|
|
|
|
|
|
find('.gl-new-dropdown-item button').click
|
|
|
|
end
|
2018-08-01 12:17:56 -04:00
|
|
|
|
2021-04-01 08:08:56 -04:00
|
|
|
click_button 'Create issue'
|
2018-08-01 12:17:56 -04:00
|
|
|
|
|
|
|
expect(page).to have_content(issue_title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-08-18 08:11:19 -04:00
|
|
|
|
|
|
|
context "when user is a Reporter in one of the group's projects", :js do
|
|
|
|
let_it_be(:board) { create(:board, group: group) }
|
|
|
|
|
|
|
|
let_it_be(:backlog_list) { create(:backlog_list, board: board) }
|
|
|
|
let_it_be(:group_label1) { create(:group_label, title: "bug", group: group) }
|
|
|
|
let_it_be(:group_label2) { create(:group_label, title: "dev", group: group) }
|
|
|
|
let_it_be(:list1) { create(:list, board: board, label: group_label1, position: 0) }
|
|
|
|
let_it_be(:list2) { create(:list, board: board, label: group_label2, position: 1) }
|
|
|
|
|
|
|
|
let_it_be(:project1) { create(:project_empty_repo, :private, group: group) }
|
|
|
|
let_it_be(:project2) { create(:project_empty_repo, :private, group: group) }
|
|
|
|
let_it_be(:issue1) { create(:issue, title: 'issue1', project: project1, labels: [group_label2]) }
|
|
|
|
let_it_be(:issue2) { create(:issue, title: 'issue2', project: project2) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project1.add_guest(user)
|
|
|
|
project2.add_reporter(user)
|
|
|
|
|
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
|
|
|
|
visit group_boards_path(group)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'allows user to move issue of project where they are a Reporter' do
|
|
|
|
expect(find('.board:nth-child(1)')).to have_content(issue2.title)
|
|
|
|
|
|
|
|
drag(list_from_index: 0, from_index: 0, list_to_index: 1)
|
|
|
|
|
|
|
|
expect(find('.board:nth-child(2)')).to have_content(issue2.title)
|
|
|
|
expect(issue2.reload.labels).to contain_exactly(group_label1)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not allow user to move issue of project where they are a Guest' do
|
|
|
|
expect(find('.board:nth-child(3)')).to have_content(issue1.title)
|
|
|
|
|
|
|
|
drag(list_from_index: 2, from_index: 0, list_to_index: 1)
|
|
|
|
|
|
|
|
expect(find('.board:nth-child(3)')).to have_content(issue1.title)
|
|
|
|
expect(issue1.reload.labels).to contain_exactly(group_label2)
|
|
|
|
expect(issue2.reload.labels).to eq([])
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not allow user to re-position lists' do
|
|
|
|
drag(list_from_index: 1, list_to_index: 2, selector: '.board-header')
|
|
|
|
|
|
|
|
expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(group_label1.title)
|
|
|
|
expect(find('.board:nth-child(3) [data-testid="board-list-header"]')).to have_content(group_label2.title)
|
|
|
|
expect(list1.reload.position).to eq(0)
|
|
|
|
expect(list2.reload.position).to eq(1)
|
|
|
|
end
|
|
|
|
end
|
2018-08-01 12:17:56 -04:00
|
|
|
end
|