Commit e8a2a4e3 authored by Désirée Chevalier's avatar Désirée Chevalier Committed by Mark Lapierre

Update scoped label e2e with labels_widget ff

parent 03275c17
......@@ -22,20 +22,16 @@ module QA
element :labels_block
end
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_value.vue' do
element :selected_label_content
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue' do
element :dropdown_input_field
end
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents.vue' do
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/dropdown_contents.vue' do
element :labels_dropdown_content
end
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_title.vue' do
element :labels_edit_button
end
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue' do
element :dropdown_input_field
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/dropdown_value.vue' do
element :selected_label_content
end
base.view 'app/views/shared/issuable/_sidebar.html.haml' do
......@@ -53,7 +49,7 @@ module QA
end
def assign_milestone(milestone)
within_element(:milestone_block) do
wait_milestone_block_finish_loading do
click_element(:edit_link)
click_on(milestone.title)
end
......@@ -70,14 +66,14 @@ module QA
end
def has_assignee?(username)
within_element(:assignee_block) do
has_text?(username, wait: 1)
wait_assignees_block_finish_loading do
has_text?(username)
end
end
def has_no_assignee?(username)
within_element(:assignee_block) do
has_no_text?(username, wait: 1)
wait_assignees_block_finish_loading do
has_no_text?(username)
end
end
......@@ -88,8 +84,14 @@ module QA
end
def has_label?(label)
within_element(:labels_block) do
!!has_element?(:selected_label_content, label_name: label)
wait_labels_block_finish_loading do
has_element?(:selected_label_content, label_name: label)
end
end
def has_no_label?(label)
wait_labels_block_finish_loading do
has_no_element?(:selected_label_content, label_name: label)
end
end
......@@ -103,27 +105,19 @@ module QA
find_element(:more_assignees_link)
end
def select_labels_and_refresh(labels)
Support::Retrier.retry_until do
click_element(:labels_edit_button)
has_element?(:labels_dropdown_content, text: labels.first)
end
def select_labels(labels)
within_element(:labels_block) do
click_element(:edit_link)
labels.each do |label|
within_element(:labels_dropdown_content) do
send_keys_to_element(:dropdown_input_field, [label, :enter])
labels.each do |label|
within_element(:labels_dropdown_content) do
fill_element(:dropdown_input_field, label)
click_button(text: label)
end
end
end
click_element(:labels_edit_button)
labels.each do |label|
has_element?(:labels_block, text: label, wait: 0)
end
refresh
wait_for_requests
click_element(:title) # to blur dropdown
end
def toggle_more_assignees_link
......@@ -141,6 +135,15 @@ module QA
end
end
def wait_labels_block_finish_loading
within_element(:labels_block) do
wait_until(reload: false, max_duration: 10, sleep_interval: 1) do
finished_loading_block?
yield
end
end
end
def wait_milestone_block_finish_loading
within_element(:milestone_block) do
wait_until(reload: false, max_duration: 10, sleep_interval: 1) do
......
# 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', :reliable, :requires_admin do
describe 'Editing scoped labels on issues' do
let(:initial_label) { 'animal::fox' }
let(:new_label_same_scope) { 'animal::dolphin' }
......@@ -11,12 +12,16 @@ module QA
let(:new_label_same_scope_multi_colon) { 'group::car::porsche' }
let(:new_label_different_scope_multi_colon) { 'group::truck::mercedes-bens' }
before do
Flow::Login.sign_in
issue = Resource::Issue.fabricate_via_api! do |issue|
let!(:issue) do
Resource::Issue.fabricate_via_api! do |issue|
issue.labels = [initial_label, initial_label_multi_colon]
end
end
before do
Runtime::Feature.enable(:labels_widget, project: issue.project)
Flow::Login.sign_in
[
new_label_same_scope,
......@@ -38,7 +43,7 @@ module QA
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1181'
) do
Page::Project::Issue::Show.perform do |show|
show.select_labels_and_refresh(
show.select_labels(
[
new_label_same_scope,
new_label_different_scope,
......
......@@ -19,6 +19,7 @@ module QA
related_issue_item
snippet_description
tag
label
].each do |predicate|
RSpec::Matchers.define "have_#{predicate}" do |*args, **kwargs|
match do |page_object|
......
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