Commit 97d7b5ab authored by Desiree Chevalier's avatar Desiree Chevalier Committed by Andrejs Cunskis

Add create cadence to iteration specs

Fixes stale iterations e2e test by adding cadence support
parent 5d85c6d9
......@@ -313,6 +313,7 @@ export default {
<gl-form-checkbox
id="cadence-automated-scheduling"
v-model="automatic"
data-qa-selector="iteration_cadence_automated_scheduling_checkbox"
:disabled="loadingCadence"
@change="updateAutomatic"
>
......@@ -340,7 +341,7 @@ export default {
required
:state="validationState.startDate"
:disabled="loadingCadence"
data-qa-selector="cadence_start_date"
data-qa-selector="iteration_cadence_start_date_field"
@blur="validate('startDate')"
/>
</gl-datepicker>
......@@ -361,7 +362,6 @@ export default {
:options="$options.availableDurations"
class="gl-form-input-md"
:required="automatic"
data-qa-selector="iteration_cadence_name_field"
:disabled="loadingCadence || !automatic"
@change="validate('durationInWeeks')"
/>
......@@ -395,7 +395,6 @@ export default {
:options="$options.availableFutureIterations"
:required="automatic"
class="gl-form-input-md"
data-qa-selector="iteration_cadence_name_field"
@change="validate('iterationsInAdvance')"
/>
</gl-form-group>
......@@ -407,7 +406,12 @@ export default {
label-class="text-right-md gl-pt-3!"
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>
<div class="form-actions gl-display-flex">
......@@ -415,7 +419,7 @@ export default {
:loading="loading"
data-testid="save-cadence"
variant="confirm"
data-qa-selector="save_cadence_button"
data-qa-selector="save_iteration_cadence_button"
@click="save"
>
{{ i18n[page].save }}
......
......@@ -250,8 +250,13 @@ export default {
right
text-sr-only
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') }}
</gl-dropdown-item>
......
......@@ -178,6 +178,7 @@ export default {
:title="cadence.title"
:iteration-state="state"
:show-state-badge="tabIndex === 2"
data-qa-selector="cadence_list_item_content"
@delete-cadence="deleteCadence"
/>
</ul>
......@@ -201,7 +202,7 @@ export default {
<li class="gl-ml-auto gl-display-flex gl-align-items-center">
<gl-button
variant="confirm"
data-qa-selector="create_cadence_button"
data-qa-selector="create_new_cadence_button"
:to="{
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
:start_date,
:due_date,
:created_at,
:updated_at
:updated_at,
:cadence
def initialize
@start_date = current_date_yyyy_mm_dd
......@@ -30,11 +31,17 @@ module QA
end
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::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|
iteration_page.fill_title(@title)
......
# frozen_string_literal: true
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
include Support::Dates
......@@ -10,16 +11,25 @@ module QA
let(:due_date) { next_month_yyyy_mm_dd }
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
Runtime::Feature.enable(:iteration_cadences, group: group)
Flow::Login.sign_in
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|
iteration.title = title
iteration.description = description
iteration.due_date = due_date
iteration.start_date = start_date
iteration.group = group
end
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