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