Commit ebd5af6c authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'qa-create-iteration-spec' into 'master'

Add create group iteration e2e spec

See merge request gitlab-org/gitlab!40554
parents 3a1a4efb 5b429f4d
......@@ -154,7 +154,12 @@ export default {
<label for="iteration-title">{{ __('Title') }}</label>
</div>
<div class="col-sm-10">
<gl-form-input id="iteration-title" v-model="title" autocomplete="off" />
<gl-form-input
id="iteration-title"
v-model="title"
autocomplete="off"
data-qa-selector="iteration_title_field"
/>
</div>
</div>
......@@ -181,6 +186,7 @@ export default {
dir="auto"
data-supports-quick-actions="false"
:aria-label="__('Description')"
data-qa-selector="iteration_description_field"
>
</textarea>
</template>
......@@ -201,6 +207,7 @@ export default {
class="datepicker form-control"
:placeholder="__('Select start date')"
autocomplete="off"
data-qa-selector="iteration_start_date_field"
@change="updateStartDate"
/>
<a class="inline float-right gl-mt-2 js-clear-start-date" href="#">{{
......@@ -219,6 +226,7 @@ export default {
class="datepicker form-control"
:placeholder="__('Select due date')"
autocomplete="off"
data-qa-selector="iteration_due_date_field"
@change="updateDueDate"
/>
<a class="inline float-right gl-mt-2 js-clear-due-date" href="#">{{
......@@ -230,12 +238,18 @@ export default {
</gl-form>
<div class="form-actions d-flex">
<gl-button :loading="loading" data-testid="save-iteration" variant="success" @click="save">{{
isEditing ? __('Update iteration') : __('Create iteration')
}}</gl-button>
<gl-button class="ml-auto" data-testid="cancel-iteration" @click="cancel">{{
__('Cancel')
}}</gl-button>
<gl-button
:loading="loading"
data-testid="save-iteration"
variant="success"
data-qa-selector="save_iteration_button"
@click="save"
>
{{ isEditing ? __('Update iteration') : __('Create iteration') }}
</gl-button>
<gl-button class="ml-auto" data-testid="cancel-iteration" @click="cancel">
{{ __('Cancel') }}
</gl-button>
</div>
</div>
</template>
......@@ -193,12 +193,17 @@ export default {
:show-empty="true"
fixed
stacked="sm"
data-qa-selector="iteration_issues_container"
>
<template #cell(title)="{ item: { iid, title, webUrl } }">
<div class="gl-text-truncate">
<gl-link class="gl-text-gray-900 gl-font-weight-bold" :href="webUrl">{{
title
}}</gl-link>
<gl-link
class="gl-text-gray-900 gl-font-weight-bold"
:href="webUrl"
data-qa-selector="iteration_issue_link"
:data-qa-issue-title="title"
>{{ title }}</gl-link
>
<!-- TODO: add references.relative (project name) -->
<!-- Depends on https://gitlab.com/gitlab-org/gitlab/-/issues/222763 -->
<div class="gl-text-secondary">#{{ iid }}</div>
......
......@@ -166,7 +166,13 @@ export default {
</gl-tab>
<template v-if="canAdmin" #tabs-end>
<li class="gl-ml-auto gl-display-flex gl-align-items-center">
<gl-button variant="success" :href="newIterationPath">{{ __('New iteration') }}</gl-button>
<gl-button
variant="success"
data-qa-selector="new_iteration_button"
:href="newIterationPath"
>
{{ __('New iteration') }}
</gl-button>
</li>
</template>
</gl-tabs>
......
- if group_sidebar_link?(:iterations)
= nav_link(path: 'iterations#index') do
= link_to group_iterations_path(@group) do
= link_to group_iterations_path(@group), data: { qa_selector: 'group_iterations_link' } do
%span
= _('Iterations')
......@@ -38,6 +38,12 @@ module QA
autoload :Members, 'qa/ee/page/group/members'
autoload :ContributionAnalytics, 'qa/ee/page/group/contribution_analytics'
module Iteration
autoload :Index, 'qa/ee/page/group/iteration/index'
autoload :New, 'qa/ee/page/group/iteration/new'
autoload :Show, 'qa/ee/page/group/iteration/show'
end
module Settings
autoload :SamlSSO, 'qa/ee/page/group/settings/saml_sso'
autoload :LDAPSync, 'qa/ee/page/group/settings/ldap_sync'
......@@ -188,7 +194,8 @@ module QA
module Resource
autoload :License, 'qa/ee/resource/license'
autoload :Epic, 'qa/ee/resource/epic'
autoload :GroupLabel, 'qa/ee/resource/group_label.rb'
autoload :GroupLabel, 'qa/ee/resource/group_label'
autoload :GroupIteration, 'qa/ee/resource/group_iteration'
module Board
autoload :BaseBoard, 'qa/ee/resource/board/base_board'
......
# 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 Page
module Group
module Iteration
class New < QA::Page::Base
view 'ee/app/assets/javascripts/iterations/components/iteration_form.vue' do
element :iteration_description_field
element :iteration_due_date_field
element :iteration_start_date_field
element :iteration_title_field, required: true
element :save_iteration_button
end
def click_create_iteration_button
click_element(:save_iteration_button, EE::Page::Group::Iteration::Show)
end
def fill_description(description)
fill_element(:iteration_description_field, description)
end
def fill_due_date(due_date)
fill_element(:iteration_due_date_field, due_date)
end
def fill_start_date(start_date)
fill_element(:iteration_start_date_field, start_date)
end
def fill_title(title)
fill_element(:iteration_title_field, title)
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Page
module Group
module Iteration
class Show < QA::Page::Base
view 'ee/app/assets/javascripts/iterations/components/iteration_report_tabs.vue' do
element :iteration_issues_container, required: true
element :iteration_issue_link
end
def has_issue?(issue)
within_element(:iteration_issues_container) do
has_element?(:iteration_issue_link, issue_title: issue.title)
end
end
end
end
end
end
end
end
......@@ -13,6 +13,24 @@ module QA
base.class_eval do
prepend QA::Page::Group::SubMenus::Common
view 'app/views/layouts/nav/sidebar/_group.html.haml' do
element :group_issue_boards_link
element :group_issues_item
element :group_sidebar
element :group_sidebar_submenu
element :group_settings_item
end
view 'app/views/layouts/nav/sidebar/_wiki_link.html.haml' do
element :wiki_link
end
view 'ee/app/views/groups/ee/_administration_nav.html.haml' do
element :group_administration_link
element :group_sidebar_submenu_content
element :group_saml_sso_link
end
view 'ee/app/views/groups/ee/_settings_nav.html.haml' do
element :ldap_synchronization_link
element :audit_events_settings_link
......@@ -32,22 +50,8 @@ module QA
element :group_insights_link
end
view 'app/views/layouts/nav/sidebar/_group.html.haml' do
element :group_issue_boards_link
element :group_issues_item
element :group_sidebar
element :group_sidebar_submenu
element :group_settings_item
end
view 'ee/app/views/groups/ee/_administration_nav.html.haml' do
element :group_administration_link
element :group_sidebar_submenu_content
element :group_saml_sso_link
end
view 'app/views/layouts/nav/sidebar/_wiki_link.html.haml' do
element :wiki_link
view 'ee/app/views/layouts/nav/sidebar/_group_iterations_link.html.haml' do
element :group_iterations_link
end
end
end
......@@ -68,6 +72,14 @@ module QA
end
end
def go_to_group_iterations
hover_element(:group_issues_item) do
within_submenu(:group_issues_sidebar_submenu) do
click_element(:group_iterations_link)
end
end
end
def go_to_saml_sso_group_settings
hover_element(:group_administration_link) do
within_submenu(:group_sidebar_submenu_content) do
......
# frozen_string_literal: true
module QA
module EE
module Resource
class GroupIteration < QA::Resource::Base
include Support::Dates
attr_accessor :title
attribute :group do
QA::Resource::Group.fabricate_via_api!
end
attribute :id
attribute :start_date
attribute :due_date
attribute :description
attribute :title
def initialize
@start_date = current_date_yyyy_mm_dd
@due_date = next_month_yyyy_mm_dd
@title = "Iteration-#{SecureRandom.hex(8)}"
@description = "This is a test iteration."
end
def fabricate!
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::New.perform do |new|
new.fill_title(@title)
new.fill_description(@description)
new.fill_start_date(@start_date)
new.fill_due_date(@due_date)
new.click_create_iteration_button
end
end
end
end
end
end
# frozen_string_literal: true
module QA
RSpec.describe 'Plan' do
describe 'Group Iterations' do
include Support::Dates
let(:title) { "Group iteration created via GUI #{SecureRandom.hex(8)}" }
let(:start_date) { current_date_yyyy_mm_dd }
let(:due_date) { next_month_yyyy_mm_dd }
let(:description) { "This is a group test iteration." }
before do
Flow::Login.sign_in
end
it 'creates a group iteration', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/957' 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
end
EE::Page::Group::Iteration::Show.perform do |iteration|
aggregate_failures "iteration created successfully" do
expect(iteration).to have_content(title)
expect(iteration).to have_content(description)
expect(iteration).to have_content(format_date(start_date))
expect(iteration).to have_content(format_date(due_date))
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