Commit 61288c53 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '351858-allow-iteration-search-by-cadence-title' into 'master'

Resolve "Allow iteration search by cadence title"

See merge request gitlab-org/gitlab!81615
parents da5354ea 2ef93665
......@@ -3,7 +3,7 @@
query searchIterations($fullPath: ID!, $search: String, $id: ID, $isProject: Boolean = false) {
group(fullPath: $fullPath) @skip(if: $isProject) {
id
iterations(title: $search, id: $id, includeAncestors: true) {
iterations(search: $search, in: [TITLE, CADENCE_TITLE], id: $id, includeAncestors: true) {
nodes {
...Iteration
}
......@@ -11,7 +11,7 @@ query searchIterations($fullPath: ID!, $search: String, $id: ID, $isProject: Boo
}
project(fullPath: $fullPath) @include(if: $isProject) {
id
iterations(title: $search, id: $id, includeAncestors: true) {
iterations(search: $search, in: [TITLE, CADENCE_TITLE], id: $id, includeAncestors: true) {
nodes {
...Iteration
}
......
......@@ -4,7 +4,7 @@ query issueIterationsAliased($fullPath: ID!, $title: String, $state: IterationSt
workspace: group(fullPath: $fullPath) {
__typename
id
attributes: iterations(title: $title, state: $state) {
attributes: iterations(search: $title, in: [TITLE, CADENCE_TITLE], state: $state) {
nodes {
...IterationFragment
state
......
......@@ -190,6 +190,27 @@ RSpec.describe 'Issue Sidebar' do
expect(page.find('[data-testid="select-iteration"]')).to have_content('None')
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
find_and_click_edit_iteration
......@@ -232,6 +253,27 @@ RSpec.describe 'Issue Sidebar' do
expect(page.find('[data-testid="select-iteration"]')).to have_content('None')
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
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