Commit 44b0c1f4 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'qa-fix-stale-iteration-spec' into 'master'

Add create cadence to iteration specs

See merge request gitlab-org/gitlab!69014
parents 14512bdb 97d7b5ab
...@@ -313,6 +313,7 @@ export default { ...@@ -313,6 +313,7 @@ export default {
<gl-form-checkbox <gl-form-checkbox
id="cadence-automated-scheduling" id="cadence-automated-scheduling"
v-model="automatic" v-model="automatic"
data-qa-selector="iteration_cadence_automated_scheduling_checkbox"
:disabled="loadingCadence" :disabled="loadingCadence"
@change="updateAutomatic" @change="updateAutomatic"
> >
...@@ -340,7 +341,7 @@ export default { ...@@ -340,7 +341,7 @@ export default {
required required
:state="validationState.startDate" :state="validationState.startDate"
:disabled="loadingCadence" :disabled="loadingCadence"
data-qa-selector="cadence_start_date" data-qa-selector="iteration_cadence_start_date_field"
@blur="validate('startDate')" @blur="validate('startDate')"
/> />
</gl-datepicker> </gl-datepicker>
...@@ -361,7 +362,6 @@ export default { ...@@ -361,7 +362,6 @@ export default {
:options="$options.availableDurations" :options="$options.availableDurations"
class="gl-form-input-md" class="gl-form-input-md"
:required="automatic" :required="automatic"
data-qa-selector="iteration_cadence_name_field"
:disabled="loadingCadence || !automatic" :disabled="loadingCadence || !automatic"
@change="validate('durationInWeeks')" @change="validate('durationInWeeks')"
/> />
...@@ -395,7 +395,6 @@ export default { ...@@ -395,7 +395,6 @@ export default {
:options="$options.availableFutureIterations" :options="$options.availableFutureIterations"
:required="automatic" :required="automatic"
class="gl-form-input-md" class="gl-form-input-md"
data-qa-selector="iteration_cadence_name_field"
@change="validate('iterationsInAdvance')" @change="validate('iterationsInAdvance')"
/> />
</gl-form-group> </gl-form-group>
...@@ -407,7 +406,12 @@ export default { ...@@ -407,7 +406,12 @@ export default {
label-class="text-right-md gl-pt-3!" label-class="text-right-md gl-pt-3!"
label-for="cadence-description" label-for="cadence-description"
> >
<gl-form-textarea id="cadence-description" v-model="description" class="w-100" /> <gl-form-textarea
id="cadence-description"
v-model="description"
class="w-100"
data-qa-selector="iteration_cadence_description_field"
/>
</gl-form-group> </gl-form-group>
<div class="form-actions gl-display-flex"> <div class="form-actions gl-display-flex">
...@@ -415,7 +419,7 @@ export default { ...@@ -415,7 +419,7 @@ export default {
:loading="loading" :loading="loading"
data-testid="save-cadence" data-testid="save-cadence"
variant="confirm" variant="confirm"
data-qa-selector="save_cadence_button" data-qa-selector="save_iteration_cadence_button"
@click="save" @click="save"
> >
{{ i18n[page].save }} {{ i18n[page].save }}
......
...@@ -250,8 +250,13 @@ export default { ...@@ -250,8 +250,13 @@ export default {
right right
text-sr-only text-sr-only
no-caret no-caret
data-qa-selector="cadence_options_button"
> >
<gl-dropdown-item v-if="!automatic" :to="newIteration"> <gl-dropdown-item
v-if="!automatic"
:to="newIteration"
data-qa-selector="new_iteration_button"
>
{{ s__('Iterations|Add iteration') }} {{ s__('Iterations|Add iteration') }}
</gl-dropdown-item> </gl-dropdown-item>
......
...@@ -178,6 +178,7 @@ export default { ...@@ -178,6 +178,7 @@ export default {
:title="cadence.title" :title="cadence.title"
:iteration-state="state" :iteration-state="state"
:show-state-badge="tabIndex === 2" :show-state-badge="tabIndex === 2"
data-qa-selector="cadence_list_item_content"
@delete-cadence="deleteCadence" @delete-cadence="deleteCadence"
/> />
</ul> </ul>
...@@ -201,7 +202,7 @@ export default { ...@@ -201,7 +202,7 @@ export default {
<li class="gl-ml-auto gl-display-flex gl-align-items-center"> <li class="gl-ml-auto gl-display-flex gl-align-items-center">
<gl-button <gl-button
variant="confirm" variant="confirm"
data-qa-selector="create_cadence_button" data-qa-selector="create_new_cadence_button"
:to="{ :to="{
name: 'new', name: 'new',
}" }"
......
# frozen_string_literal: true
module QA
module EE
module Page
module Group
module Iteration
module Cadence
class Index < QA::Page::Base
view 'ee/app/assets/javascripts/iterations/components/iterations.vue' do
element :new_iteration_button
end
view 'ee/app/assets/javascripts/iterations/components/iteration_cadences_list.vue' do
element :cadence_list_item_content
element :create_new_cadence_button, required: true
end
view 'ee/app/assets/javascripts/iterations/components/iteration_cadence_list_item.vue' do
element :cadence_options_button
end
def click_new_iteration_cadence_button
click_element(:create_new_cadence_button)
end
def click_new_iteration_button(cadence_title)
cadence = find_element(:cadence_list_item_content, text: cadence_title)
within cadence do
click_element(:cadence_options_button)
click_element(:new_iteration_button)
end
end
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Page
module Group
module Iteration
module Cadence
class New < QA::Page::Base
view 'ee/app/assets/javascripts/iterations/components/iteration_cadence_form.vue' do
element :iteration_cadence_description_field
element :iteration_cadence_start_date_field
element :iteration_cadence_title_field, required: true
element :iteration_cadence_automated_scheduling_checkbox
element :save_iteration_cadence_button
end
def click_create_iteration_cadence_button
click_element(:save_iteration_cadence_button)
end
def fill_description(description)
fill_element(:iteration_cadence_description_field, description)
end
def fill_start_date(start_date)
fill_element(:iteration_cadence_start_date_field, start_date)
end
def fill_title(title)
fill_element(:iteration_cadence_title_field, title)
end
def uncheck_automatic_scheduling
uncheck_element(:iteration_cadence_automated_scheduling_checkbox, true)
end
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Page
module Group
module Iteration
class Index < QA::Page::Base
view 'ee/app/assets/javascripts/iterations/components/iterations.vue' do
element :new_iteration_button
end
def click_new_iteration_button
click_element(:new_iteration_button, EE::Page::Group::Iteration::New)
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Resource
class GroupCadence < QA::Resource::Base
include Support::Dates
attr_accessor :title, :group
attribute :group do
QA::Resource::Group.fabricate_via_api! do |group|
group.path = "group-to-test-iterations-#{SecureRandom.hex(8)}"
end
end
attribute :id
attribute :start_date
attribute :description
attribute :title
def initialize
@start_date = current_date_yyyy_mm_dd
@description = "This is a test cadence."
@title = "Iteration Cadence #{SecureRandom.hex(8)}"
@automatic = false
end
def fabricate!
group.visit!
QA::Page::Group::Menu.perform(&:go_to_group_iterations)
QA::EE::Page::Group::Iteration::Cadence::Index.perform(&:click_new_iteration_cadence_button)
QA::EE::Page::Group::Iteration::Cadence::New.perform do |new|
new.fill_title(@title)
new.uncheck_automatic_scheduling
new.fill_start_date(@start_date)
new.click_create_iteration_cadence_button
end
end
def api_get_path
"gid://gitlab/Cadence/#{id}"
end
def api_post_path
"/graphql"
end
def api_post_body
<<~GQL
mutation {
iterationCadenceCreate(input: {
groupPath: "#{group.full_path}"
title: "#{@title}"
description: "#{@description}"
startDate: "#{@start_date}"
automatic: #{@automatic}
active: true
}) {
iterationCadence {
id
title
description
startDate
}
errors
}
}
GQL
end
end
end
end
end
...@@ -20,7 +20,8 @@ module QA ...@@ -20,7 +20,8 @@ module QA
:start_date, :start_date,
:due_date, :due_date,
:created_at, :created_at,
:updated_at :updated_at,
:cadence
def initialize def initialize
@start_date = current_date_yyyy_mm_dd @start_date = current_date_yyyy_mm_dd
...@@ -30,11 +31,17 @@ module QA ...@@ -30,11 +31,17 @@ module QA
end end
def fabricate! def fabricate!
group.visit! @cadence ||= QA::EE::Resource::GroupCadence.fabricate_via_browser_ui! do |cadence|
cadence.group = group
end
@cadence.group.visit!
QA::Page::Group::Menu.perform(&:go_to_group_iterations) QA::Page::Group::Menu.perform(&:go_to_group_iterations)
QA::EE::Page::Group::Iteration::Index.perform(&:click_new_iteration_button) QA::EE::Page::Group::Iteration::Cadence::Index.perform do |cadence_list|
cadence_list.click_new_iteration_button(@cadence.title)
end
QA::EE::Page::Group::Iteration::New.perform do |iteration_page| QA::EE::Page::Group::Iteration::New.perform do |iteration_page|
iteration_page.fill_title(@title) iteration_page.fill_title(@title)
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
RSpec.describe 'Plan', :reliable do # TODO: Remove :requires_admin when the `Runtime::Feature.enable` method call is removed
RSpec.describe 'Plan', :requires_admin do
describe 'Group Iterations' do describe 'Group Iterations' do
include Support::Dates include Support::Dates
...@@ -10,16 +11,25 @@ module QA ...@@ -10,16 +11,25 @@ module QA
let(:due_date) { next_month_yyyy_mm_dd } let(:due_date) { next_month_yyyy_mm_dd }
let(:description) { "This is a group test iteration." } let(:description) { "This is a group test iteration." }
let(:group) do
QA::Resource::Group.fabricate_via_api! do |group|
group.path = "group-to-test-iterations-cadences-#{SecureRandom.hex(8)}"
end
end
before do before do
Runtime::Feature.enable(:iteration_cadences, group: group)
Flow::Login.sign_in Flow::Login.sign_in
end end
it 'creates a group iteration', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1623', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/334252', type: :stale } do it 'creates a group iteration', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1623' do
EE::Resource::GroupIteration.fabricate_via_browser_ui! do |iteration| EE::Resource::GroupIteration.fabricate_via_browser_ui! do |iteration|
iteration.title = title iteration.title = title
iteration.description = description iteration.description = description
iteration.due_date = due_date iteration.due_date = due_date
iteration.start_date = start_date iteration.start_date = start_date
iteration.group = group
end end
EE::Page::Group::Iteration::Show.perform do |iteration| EE::Page::Group::Iteration::Show.perform do |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