Commit 2ef93665 authored by Donald Cook's avatar Donald Cook Committed by Enrique Alcántara

Iteration search uses cadence and iteration titles

Previously only search by iteration title was used. 
Now on the issue page and the list view, we’re searching 
through cadence titles also

Changelog: changed
EE: true
parent 9a3476f2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
query searchIterations($fullPath: ID!, $search: String, $id: ID, $isProject: Boolean = false) { query searchIterations($fullPath: ID!, $search: String, $id: ID, $isProject: Boolean = false) {
group(fullPath: $fullPath) @skip(if: $isProject) { group(fullPath: $fullPath) @skip(if: $isProject) {
id id
iterations(title: $search, id: $id, includeAncestors: true) { iterations(search: $search, in: [TITLE, CADENCE_TITLE], id: $id, includeAncestors: true) {
nodes { nodes {
...Iteration ...Iteration
} }
...@@ -11,7 +11,7 @@ query searchIterations($fullPath: ID!, $search: String, $id: ID, $isProject: Boo ...@@ -11,7 +11,7 @@ query searchIterations($fullPath: ID!, $search: String, $id: ID, $isProject: Boo
} }
project(fullPath: $fullPath) @include(if: $isProject) { project(fullPath: $fullPath) @include(if: $isProject) {
id id
iterations(title: $search, id: $id, includeAncestors: true) { iterations(search: $search, in: [TITLE, CADENCE_TITLE], id: $id, includeAncestors: true) {
nodes { nodes {
...Iteration ...Iteration
} }
......
...@@ -4,7 +4,7 @@ query issueIterationsAliased($fullPath: ID!, $title: String, $state: IterationSt ...@@ -4,7 +4,7 @@ query issueIterationsAliased($fullPath: ID!, $title: String, $state: IterationSt
workspace: group(fullPath: $fullPath) { workspace: group(fullPath: $fullPath) {
__typename __typename
id id
attributes: iterations(title: $title, state: $state) { attributes: iterations(search: $title, in: [TITLE, CADENCE_TITLE], state: $state) {
nodes { nodes {
...IterationFragment ...IterationFragment
state state
......
...@@ -190,6 +190,27 @@ RSpec.describe 'Issue Sidebar' do ...@@ -190,6 +190,27 @@ RSpec.describe 'Issue Sidebar' do
expect(page.find('[data-testid="select-iteration"]')).to have_content('None') expect(page.find('[data-testid="select-iteration"]')).to have_content('None')
end end
context 'when searching iteration by its cadence title', :aggregate_failures do
let_it_be(:plan_cadence) { create(:iterations_cadence, title: 'plan cadence', group: group, active: true) }
let_it_be(:plan_iteration) { create(:iteration, :with_due_date, iterations_cadence: plan_cadence, start_date: 1.week.from_now) }
it "returns the correct iteration" do
find_and_click_edit_iteration
within '[data-testid="iteration-edit"]' do
page.find(".gl-search-box-by-type-input").send_keys('plan')
wait_for_requests
expect(page).to have_text(plan_iteration.title)
expect(page).to have_text(plan_iteration.period)
expect(page).not_to have_text(iteration_cadence.title)
expect(page).not_to have_text(iteration.period)
expect(page).not_to have_text(iteration2.period)
end
end
end
it 'does not show closed iterations' do it 'does not show closed iterations' do
find_and_click_edit_iteration find_and_click_edit_iteration
...@@ -232,6 +253,27 @@ RSpec.describe 'Issue Sidebar' do ...@@ -232,6 +253,27 @@ RSpec.describe 'Issue Sidebar' do
expect(page.find('[data-testid="select-iteration"]')).to have_content('None') expect(page.find('[data-testid="select-iteration"]')).to have_content('None')
end end
context 'when searching iteration by its cadence title', :aggregate_failures do
let_it_be(:plan_cadence) { create(:iterations_cadence, title: 'plan cadence', group: group, active: true) }
let_it_be(:plan_iteration) { create(:iteration, :with_due_date, iterations_cadence: plan_cadence, start_date: 1.week.from_now) }
it "returns the correct iteration" do
find_and_click_edit_iteration
within '[data-testid="iteration-edit"]' do
page.find(".gl-search-box-by-type-input").send_keys('plan')
wait_for_requests
expect(page).to have_text(plan_cadence.title)
expect(page).to have_text(plan_iteration.period)
expect(page).not_to have_text(iteration_cadence.title)
expect(page).not_to have_text(iteration.period)
expect(page).not_to have_text(iteration2.period)
end
end
end
it 'does not show closed iterations' do it 'does not show closed iterations' do
find_and_click_edit_iteration find_and_click_edit_iteration
......
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