Commit a0e99f27 authored by Eulyeon Ko's avatar Eulyeon Ko Committed by Olena Horal-Koretska

List all projects when creating issues in group boards [RUN-AS-IF-FOSS]

parent 0289efc2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
query getGroupProjects($fullPath: ID!, $search: String, $after: String) { query getGroupProjects($fullPath: ID!, $search: String, $after: String) {
group(fullPath: $fullPath) { group(fullPath: $fullPath) {
projects(search: $search, after: $after, first: 100) { projects(search: $search, after: $after, first: 100, includeSubgroups: true) {
nodes { nodes {
id id
name name
......
---
title: Display descendant projects of a group when creating issues in epic swimlanes
merge_request: 61456
author:
type: fixed
...@@ -10,6 +10,9 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -10,6 +10,9 @@ RSpec.describe 'Issue Boards new issue', :js do
let_it_be(:list) { create(:list, board: board, label: label, position: 0) } let_it_be(:list) { create(:list, board: board, label: label, position: 0) }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:board_list_header) { first('[data-testid="board-list-header"]') }
let(:project_select_dropdown) { find('[data-testid="project-select-dropdown"]') }
context 'authorized user' do context 'authorized user' do
before do before do
project.add_maintainer(user) project.add_maintainer(user)
...@@ -24,18 +27,18 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -24,18 +27,18 @@ RSpec.describe 'Issue Boards new issue', :js do
end end
it 'displays new issue button' do it 'displays new issue button' do
expect(first('.board')).to have_selector('.issue-count-badge-add-button', count: 1) expect(first('.board')).to have_button('New issue', count: 1)
end end
it 'does not display new issue button in closed list' do it 'does not display new issue button in closed list' do
page.within('.board:nth-child(3)') do page.within('.board:nth-child(3)') do
expect(page).not_to have_selector('.issue-count-badge-add-button') expect(page).not_to have_button('New issue')
end end
end end
it 'shows form when clicking button' do it 'shows form when clicking button' do
page.within(first('.board')) do page.within(first('.board')) do
find('.issue-count-badge-add-button').click click_button 'New issue'
expect(page).to have_selector('.board-new-issue-form') expect(page).to have_selector('.board-new-issue-form')
end end
...@@ -43,7 +46,7 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -43,7 +46,7 @@ RSpec.describe 'Issue Boards new issue', :js do
it 'hides form when clicking cancel' do it 'hides form when clicking cancel' do
page.within(first('.board')) do page.within(first('.board')) do
find('.issue-count-badge-add-button').click click_button 'New issue'
expect(page).to have_selector('.board-new-issue-form') expect(page).to have_selector('.board-new-issue-form')
...@@ -55,7 +58,7 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -55,7 +58,7 @@ RSpec.describe 'Issue Boards new issue', :js do
it 'creates new issue' do it 'creates new issue' do
page.within(first('.board')) do page.within(first('.board')) do
find('.issue-count-badge-add-button').click click_button 'New issue'
end end
page.within(first('.board-new-issue-form')) do page.within(first('.board-new-issue-form')) do
...@@ -80,7 +83,7 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -80,7 +83,7 @@ RSpec.describe 'Issue Boards new issue', :js do
# TODO https://gitlab.com/gitlab-org/gitlab/-/issues/323446 # TODO https://gitlab.com/gitlab-org/gitlab/-/issues/323446
xit 'shows sidebar when creating new issue' do xit 'shows sidebar when creating new issue' do
page.within(first('.board')) do page.within(first('.board')) do
find('.issue-count-badge-add-button').click click_button 'New issue'
end end
page.within(first('.board-new-issue-form')) do page.within(first('.board-new-issue-form')) do
...@@ -95,7 +98,7 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -95,7 +98,7 @@ RSpec.describe 'Issue Boards new issue', :js do
it 'successfuly loads labels to be added to newly created issue' do it 'successfuly loads labels to be added to newly created issue' do
page.within(first('.board')) do page.within(first('.board')) do
find('.issue-count-badge-add-button').click click_button 'New issue'
end end
page.within(first('.board-new-issue-form')) do page.within(first('.board-new-issue-form')) do
...@@ -109,12 +112,12 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -109,12 +112,12 @@ RSpec.describe 'Issue Boards new issue', :js do
find('.board-card').click find('.board-card').click
end end
page.within(first('[data-testid="issue-boards-sidebar"]')) do page.within('[data-testid="sidebar-labels"]') do
find('.labels [data-testid="edit-button"]').click click_button 'Edit'
wait_for_requests wait_for_requests
expect(page).to have_selector('.labels-select-contents-list .dropdown-content li a') expect(page).to have_content 'Label 1'
end end
end end
end end
...@@ -126,70 +129,94 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -126,70 +129,94 @@ RSpec.describe 'Issue Boards new issue', :js do
end end
it 'displays new issue button in open list' do it 'displays new issue button in open list' do
expect(first('.board')).to have_selector('.issue-count-badge-add-button', count: 1) expect(first('.board')).to have_button('New issue', count: 1)
end end
it 'does not display new issue button in label list' do it 'does not display new issue button in label list' do
page.within('.board:nth-child(2)') do page.within('.board:nth-child(2)') do
expect(page).not_to have_selector('.issue-count-badge-add-button') expect(page).not_to have_button('New issue')
end end
end end
end end
context 'group boards' do context 'group boards' do
let_it_be(:group) { create(:group, :public) } let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project, :public, namespace: group) } let_it_be(:project) { create(:project, namespace: group, name: "root project") }
let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:subproject1) { create(:project, group: subgroup, name: "sub project1") }
let_it_be(:subproject2) { create(:project, group: subgroup, name: "sub project2") }
let_it_be(:group_board) { create(:board, group: group) } let_it_be(:group_board) { create(:board, group: group) }
let_it_be(:project_label) { create(:label, project: project, name: 'label') } let_it_be(:project_label) { create(:label, project: project, name: 'label') }
let_it_be(:list) { create(:list, board: group_board, label: project_label, position: 0) } let_it_be(:list) { create(:list, board: group_board, label: project_label, position: 0) }
context 'for unauthorized users' do context 'for unauthorized users' do
context 'when backlog does not exist' do
before do before do
sign_in(user)
visit group_board_path(group, group_board) visit group_board_path(group, group_board)
wait_for_requests wait_for_requests
end end
context 'when backlog does not exist' do
it 'does not display new issue button in label list' do it 'does not display new issue button in label list' do
page.within('.board.is-draggable') do page.within('.board.is-draggable') do
expect(page).not_to have_selector('.issue-count-badge-add-button') expect(page).not_to have_button('New issue')
end end
end end
end end
context 'when backlog list already exists' do context 'when backlog list already exists' do
let!(:backlog_list) { create(:backlog_list, board: group_board) } let_it_be(:backlog_list) { create(:backlog_list, board: group_board) }
before do
sign_in(user)
visit group_board_path(group, group_board)
wait_for_requests
end
it 'displays new issue button in open list' do it 'displays new issue button in open list' do
expect(first('.board')).to have_selector('.issue-count-badge-add-button', count: 1) expect(first('.board')).to have_button('New issue', count: 1)
end end
it 'does not display new issue button in label list' do it 'does not display new issue button in label list' do
page.within('.board.is-draggable') do page.within('.board.is-draggable') do
expect(page).not_to have_selector('.issue-count-badge-add-button') expect(page).not_to have_button('New issue')
end end
end end
end end
end end
context 'for authorized users' do context 'for authorized users' do
it 'display new issue button in label list' do before do
project = create(:project, namespace: group)
project.add_reporter(user) project.add_reporter(user)
subproject1.add_reporter(user)
sign_in(user) sign_in(user)
visit group_board_path(group, group_board) visit group_board_path(group, group_board)
wait_for_requests wait_for_requests
end
page.within('.board.is-draggable') do context 'when backlog does not exist' do
expect(page).to have_selector('.issue-count-badge-add-button') it 'display new issue button in label list' do
expect(board_list_header).to have_button('New issue')
end
end
context 'project select dropdown' do
let_it_be(:backlog_list) { create(:backlog_list, board: group_board) }
before do
page.within(board_list_header) do
click_button 'New issue'
end
project_select_dropdown.click
wait_for_requests
end
it 'lists a project which is a direct descendant of the top-level group' do
expect(project_select_dropdown).to have_button("root project")
end
it 'lists a project that belongs to a subgroup' do
expect(project_select_dropdown).to have_button("sub project1")
end
it "does not list projects to which user doesn't have access" do
expect(project_select_dropdown).not_to have_button("sub project2")
end end
end 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