Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-18 18:07:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-18 18:07:09 +0300
commit4717e30a236272bdee77735f310017d60b773b32 (patch)
tree9a2bbf4228a036483b31eb9000b97a6fa6b7f47e /qa
parentc864f4b8f7224fa3d8f8619c0a0df91c77b8360f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/element.rb15
-rw-r--r--qa/qa/page/project/secure/configuration_form.rb48
-rw-r--r--qa/qa/page/project/settings/protected_branches.rb6
-rw-r--r--qa/spec/page/element_spec.rb8
4 files changed, 31 insertions, 46 deletions
diff --git a/qa/qa/page/element.rb b/qa/qa/page/element.rb
index 6bfdf98587b..27886934e2e 100644
--- a/qa/qa/page/element.rb
+++ b/qa/qa/page/element.rb
@@ -13,9 +13,7 @@ module QA
@attributes[:pattern] ||= selector
options.each do |option|
- if option.is_a?(String) || option.is_a?(Regexp)
- @attributes[:pattern] = option
- end
+ @attributes[:pattern] = option if option.is_a?(String) || option.is_a?(Regexp)
end
end
@@ -28,7 +26,7 @@ module QA
end
def selector_css
- %Q([data-qa-selector="#{@name}"]#{additional_selectors},.#{selector})
+ %(#{qa_selector},.#{selector})
end
def expression
@@ -40,14 +38,19 @@ module QA
end
def matches?(line)
- !!(line =~ /["']#{name}['"]|#{expression}/)
+ !!(line =~ /["']#{name}['"]|["']#{name.to_s.tr('_', '-')}['"]|#{expression}/)
end
private
+ def qa_selector
+ %([data-testid="#{@name}"]#{additional_selectors},[data-testid="#{@name.to_s.tr('_',
+ '-')}"]#{additional_selectors},[data-qa-selector="#{@name}"]#{additional_selectors})
+ end
+
def additional_selectors
@attributes.dup.delete_if { |attr| attr == :pattern || attr == :required }.map do |key, value|
- %Q([data-qa-#{key.to_s.tr('_', '-')}="#{value}"])
+ %([data-qa-#{key.to_s.tr('_', '-')}="#{value}"])
end.join
end
end
diff --git a/qa/qa/page/project/secure/configuration_form.rb b/qa/qa/page/project/secure/configuration_form.rb
index 493ec08d023..70eff31bfa9 100644
--- a/qa/qa/page/project/secure/configuration_form.rb
+++ b/qa/qa/page/project/secure/configuration_form.rb
@@ -9,15 +9,13 @@ module QA
view 'app/assets/javascripts/security_configuration/components/app.vue' do
element :security_configuration_container
- element :security_configuration_history_link
+ element :security_view_history_link
end
view 'app/assets/javascripts/security_configuration/components/feature_card.vue' do
- element :dependency_scanning_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
- element :sast_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
+ element :feature_status
element :sast_enable_button, "`${feature.type}_enable_button`" # rubocop:disable QA/ElementWithPattern
element :dependency_scanning_mr_button, "`${feature.type}_mr_button`" # rubocop:disable QA/ElementWithPattern
- element :license_scanning_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
end
view 'app/assets/javascripts/security_configuration/components/auto_dev_ops_alert.vue' do
@@ -25,15 +23,15 @@ module QA
end
def has_security_configuration_history_link?
- has_element?(:security_configuration_history_link)
+ has_element?(:security_view_history_link)
end
def has_no_security_configuration_history_link?
- has_no_element?(:security_configuration_history_link)
+ has_no_element?(:security_view_history_link)
end
def click_security_configuration_history_link
- click_element(:security_configuration_history_link)
+ click_element(:security_view_history_link)
end
def click_sast_enable_button
@@ -44,40 +42,20 @@ module QA
click_element(:dependency_scanning_mr_button)
end
- def has_sast_status?(status_text)
- within_element(:sast_status) do
- has_text?(status_text)
- end
- end
-
- def has_no_sast_status?(status_text)
- within_element(:sast_status) do
- has_no_text?(status_text)
- end
- end
-
- def has_dependency_scanning_status?(status_text)
- within_element(:dependency_scanning_status) do
- has_text?(status_text)
- end
+ def has_true_sast_status?
+ has_element?(:feature_status, feature: 'sast_true_status')
end
- def has_no_dependency_scanning_status?(status_text)
- within_element(:dependency_scanning_status) do
- has_no_text?(status_text)
- end
+ def has_false_sast_status?
+ has_element?(:feature_status, feature: 'sast_false_status')
end
- def has_license_compliance_status?(status_text)
- within_element(:license_scanning_status) do
- has_text?(status_text)
- end
+ def has_true_dependency_scanning_status?
+ has_element?(:feature_status, feature: 'dependency_scanning_true_status')
end
- def has_no_license_compliance_status?(status_text)
- within_element(:license_scanning_status) do
- has_no_text?(status_text)
- end
+ def has_false_dependency_scanning_status?
+ has_element?(:feature_status, feature: 'dependency_scanning_false_status')
end
def has_auto_devops_container?
diff --git a/qa/qa/page/project/settings/protected_branches.rb b/qa/qa/page/project/settings/protected_branches.rb
index 3eddd0fd33a..e6b13ed77a0 100644
--- a/qa/qa/page/project/settings/protected_branches.rb
+++ b/qa/qa/page/project/settings/protected_branches.rb
@@ -11,9 +11,9 @@ module QA
end
view 'app/views/protected_branches/_create_protected_branch.html.haml' do
- element :allowed_to_push_dropdown
+ element :select_allowed_to_push_dropdown
element :allowed_to_push_dropdown_content
- element :allowed_to_merge_dropdown
+ element :select_allowed_to_merge_dropdown
element :allowed_to_merge_dropdown_content
end
@@ -45,7 +45,7 @@ module QA
private
def select_allowed(action, allowed)
- click_element :"allowed_to_#{action}_dropdown"
+ click_element :"select_allowed_to_#{action}_dropdown"
allowed[:roles] = Resource::ProtectedBranch::Roles::NO_ONE unless allowed.key?(:roles)
diff --git a/qa/spec/page/element_spec.rb b/qa/spec/page/element_spec.rb
index fbf58b5e18a..da1fd224564 100644
--- a/qa/spec/page/element_spec.rb
+++ b/qa/spec/page/element_spec.rb
@@ -73,7 +73,7 @@ RSpec.describe QA::Page::Element do
subject { described_class.new(:something, /link_to 'something'/) }
it 'has an attribute[pattern] of the pattern' do
- expect(subject.attributes[:pattern]).to eq /link_to 'something'/
+ expect(subject.attributes[:pattern]).to eq(/link_to 'something'/)
end
it 'is not required by default' do
@@ -98,7 +98,7 @@ RSpec.describe QA::Page::Element do
subject { described_class.new(:something, /link_to 'something_else_entirely'/, required: true) }
it 'has an attribute[pattern] of the passed pattern' do
- expect(subject.attributes[:pattern]).to eq /link_to 'something_else_entirely'/
+ expect(subject.attributes[:pattern]).to eq(/link_to 'something_else_entirely'/)
end
it 'is required' do
@@ -118,6 +118,10 @@ RSpec.describe QA::Page::Element do
expect(subject.selector_css).to include(%q([data-qa-selector="my_element"]))
end
+ it 'properly translates to a data-testid' do
+ expect(subject.selector_css).to include(%q([data-testid="my_element"]))
+ end
+
context 'additional selectors' do
let(:element) { described_class.new(:my_element, index: 3, another_match: 'something') }
let(:required_element) { described_class.new(:my_element, required: true, index: 3) }