Commit e3d3f0fe authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '222763-show-ancestor-iterations-in-subgroups' into 'master'

Show ancestor iterations in subgroups

See merge request gitlab-org/gitlab!40990
parents c4c1814e 61fbacea
...@@ -13,7 +13,6 @@ query Iterations( ...@@ -13,7 +13,6 @@ query Iterations(
group(fullPath: $fullPath) @include(if: $isGroup) { group(fullPath: $fullPath) @include(if: $isGroup) {
iterations( iterations(
state: $state state: $state
includeAncestors: false
before: $beforeCursor before: $beforeCursor
after: $afterCursor after: $afterCursor
first: $firstPageSize first: $firstPageSize
......
---
title: Show ancestor iterations in subgroups
merge_request: 40990
author:
type: changed
...@@ -5,45 +5,91 @@ require 'spec_helper' ...@@ -5,45 +5,91 @@ require 'spec_helper'
RSpec.describe 'Iterations list', :js do RSpec.describe 'Iterations list', :js do
let(:now) { Time.now } let(:now) { Time.now }
let_it_be(:group) { create(:group) } let_it_be(:group) { create(:group) }
let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let!(:started_iteration) { create(:iteration, :skip_future_date_validation, group: group, start_date: now - 1.day, due_date: now, title: 'Started iteration') } let!(:started_iteration) { create(:iteration, :skip_future_date_validation, group: group, start_date: now - 1.day, due_date: now, title: 'Started iteration') }
let!(:upcoming_iteration) { create(:iteration, group: group, start_date: now + 1.day, due_date: now + 2.days) } let!(:upcoming_iteration) { create(:iteration, group: group, start_date: now + 1.day, due_date: now + 2.days) }
let!(:closed_iteration) { create(:closed_iteration, :skip_future_date_validation, group: group, start_date: now - 3.days, due_date: now - 2.days) } let!(:closed_iteration) { create(:closed_iteration, :skip_future_date_validation, group: group, start_date: now - 3.days, due_date: now - 2.days) }
let!(:subgroup_iteration) { create(:iteration, :skip_future_date_validation, group: subgroup, start_date: now - 5.days, due_date: now - 4.days) }
context 'as guest' do context 'as guest' do
before do context 'when in group' do
visit group_iterations_path(group) before do
end visit group_iterations_path(group)
end
it 'hides New iteration button' do it 'hides New iteration button' do
expect(page).not_to have_link('New iteration', href: new_group_iteration_path(group)) expect(page).not_to have_link('New iteration', href: new_group_iteration_path(group))
end end
it 'shows iterations on each tab' do it 'shows iterations on each tab' do
expect(page).to have_link(started_iteration.title) aggregate_failures do
expect(page).to have_link(upcoming_iteration.title) expect(page).to have_link(started_iteration.title)
expect(page).not_to have_link(closed_iteration.title) expect(page).to have_link(upcoming_iteration.title)
expect(page).not_to have_link(closed_iteration.title)
expect(page).not_to have_link(subgroup_iteration.title)
end
click_link('Closed') click_link('Closed')
expect(page).to have_link(closed_iteration.title) aggregate_failures do
expect(page).not_to have_link(started_iteration.title) expect(page).to have_link(closed_iteration.title)
expect(page).not_to have_link(upcoming_iteration.title) expect(page).not_to have_link(started_iteration.title)
expect(page).not_to have_link(upcoming_iteration.title)
expect(page).not_to have_link(subgroup_iteration.title)
end
click_link('All') click_link('All')
aggregate_failures do
expect(page).to have_link(started_iteration.title)
expect(page).to have_link(upcoming_iteration.title)
expect(page).to have_link(closed_iteration.title)
expect(page).not_to have_link(subgroup_iteration.title)
end
end
expect(page).to have_link(started_iteration.title) context 'when an iteration is clicked' do
expect(page).to have_link(upcoming_iteration.title) it 'redirects to an iteration report within the group context' do
expect(page).to have_link(closed_iteration.title) click_link('Started iteration')
wait_for_requests
expect(page).to have_current_path(group_iteration_path(group, started_iteration.iid))
end
end
end end
context 'when an iteration is clicked' do context 'when in subgroup' do
it 'redirects to an iteration report within the group context' do before do
click_link('Started iteration') visit group_iterations_path(subgroup)
end
it 'shows iterations on each tab including ancestor iterations' do
aggregate_failures do
expect(page).to have_link(started_iteration.title)
expect(page).to have_link(upcoming_iteration.title)
expect(page).not_to have_link(closed_iteration.title)
expect(page).to have_link(subgroup_iteration.title)
end
click_link('Closed')
aggregate_failures do
expect(page).to have_link(closed_iteration.title)
expect(page).not_to have_link(started_iteration.title)
expect(page).not_to have_link(upcoming_iteration.title)
expect(page).not_to have_link(subgroup_iteration.title)
end
wait_for_requests click_link('All')
expect(page).to have_current_path(group_iteration_path(group, started_iteration.iid)) aggregate_failures do
expect(page).to have_link(started_iteration.title)
expect(page).to have_link(upcoming_iteration.title)
expect(page).to have_link(closed_iteration.title)
expect(page).to have_link(subgroup_iteration.title)
end
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