Commit 8e43527d authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'qa-add-assign-iteration-spec-phase1' into 'master'

Add e2e test for assigning a group iteration

See merge request gitlab-org/gitlab!41187
parents e86637cb c6abb581
......@@ -161,7 +161,7 @@ export default {
</script>
<template>
<div>
<div data-qa-selector="iteration_container">
<div v-gl-tooltip class="sidebar-collapsed-icon">
<gl-icon :size="16" :aria-label="$options.iterationText" name="iteration" />
<span class="collapse-truncated-title">{{ iterationTitle }}</span>
......@@ -176,13 +176,14 @@ export default {
data-track-label="right_sidebar"
data-track-property="iteration"
data-track-event="click_edit_button"
data-qa-selector="edit_iteration_link"
@click.stop="toggleDropdown"
>{{ __('Edit') }}</gl-button
>
</div>
<div data-testid="select-iteration" class="hide-collapsed">
<span v-if="showNoIterationContent" class="no-value">{{ $options.noIteration }}</span>
<gl-link v-else-if="!editing" :href="iterationUrl"
<gl-link v-else-if="!editing" data-qa-selector="iteration_link" :href="iterationUrl"
><strong>{{ iterationTitle }}</strong></gl-link
>
</div>
......
......@@ -12,26 +12,62 @@ module QA
super
base.class_eval do
view 'ee/app/assets/javascripts/sidebar/components/iteration_select.vue' do
element :edit_iteration_link
element :iteration_container
element :iteration_link
end
view 'ee/app/assets/javascripts/sidebar/components/weight/weight.vue' do
element :weight_label_value
element :edit_weight_link
element :remove_weight_link
element :weight_input_field
element :weight_label_value
element :weight_no_value_content
end
end
end
def assign_iteration(iteration)
click_element(:edit_iteration_link)
within_element(:iteration_container) do
click_on("#{iteration.title}")
end
wait_until(reload: false) do
has_element?(:iteration_container, text: iteration.title, wait: 0)
end
refresh
end
def click_remove_weight_link
click_element(:remove_weight_link)
end
def has_iteration?(iteration_title)
wait_until_iteration_container_loaded
within_element(:iteration_container) do
wait_until(reload: false) do
has_element?(:iteration_link, text: iteration_title, wait: 0)
end
end
end
def set_weight(weight)
click_element(:edit_weight_link)
fill_element(:weight_input_field, weight)
send_keys_to_element(:weight_input_field, :enter)
end
def wait_for_attachment_replication(image_url, max_wait: Runtime::Geo.max_file_replication_time)
QA::Runtime::Logger.debug(%Q[#{self.class.name} - wait_for_attachment_replication])
wait_until_geo_max_replication_time(max_wait: max_wait) do
asset_exists?(image_url)
end
end
def weight_label_value
find_element(:weight_label_value)
end
......@@ -40,16 +76,18 @@ module QA
find_element(:weight_no_value_content)
end
def wait_for_attachment_replication(image_url, max_wait: Runtime::Geo.max_file_replication_time)
QA::Runtime::Logger.debug(%Q[#{self.class.name} - wait_for_attachment_replication])
wait_until_geo_max_replication_time(max_wait: max_wait) do
asset_exists?(image_url)
end
end
private
def wait_until_geo_max_replication_time(max_wait: Runtime::Geo.max_file_replication_time)
wait_until(max_duration: max_wait) { yield }
end
def wait_until_iteration_container_loaded
wait_until(reload: false, max_duration: 10, sleep_interval: 1) do
has_element?(:iteration_container)
has_element?(:iteration_link)
end
end
end
end
end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Plan' do
describe 'Assign Iterations' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.group = @iteration.group
project.name = "project-to-test-iterations-#{SecureRandom.hex(8)}"
end
end
let(:issue) do
Resource::Issue.fabricate_via_api! do |issue|
issue.project = project
issue.title = "issue-to-test-iterations-#{SecureRandom.hex(8)}"
end
end
before do
Flow::Login.sign_in
end
it 'assigns a group iteration to an existing issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/958' do
@iteration = EE::Resource::GroupIteration.fabricate_via_browser_ui!
issue.visit!
Page::Project::Issue::Show.perform do |issue|
issue.assign_iteration(@iteration)
expect(issue).to have_iteration(@iteration.title)
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