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-19 00:08:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-19 00:08:58 +0300
commitacc1c1c468a8a75b4ab75133e95d41005543bb32 (patch)
treed6193050b3ba4fff230c53e7c449bc9b77f6c0e6 /qa
parente69b62ceed2f15335d9526923f8f72f5ca5ea6aa (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/file/edit.rb6
-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/qa/specs/features/browser_ui/3_create/source_editor/source_editor_toolbar_spec.rb18
-rw-r--r--qa/spec/page/element_spec.rb8
6 files changed, 52 insertions, 49 deletions
diff --git a/qa/qa/page/element.rb b/qa/qa/page/element.rb
index 27886934e2e..6bfdf98587b 100644
--- a/qa/qa/page/element.rb
+++ b/qa/qa/page/element.rb
@@ -13,7 +13,9 @@ module QA
@attributes[:pattern] ||= selector
options.each do |option|
- @attributes[:pattern] = option if option.is_a?(String) || option.is_a?(Regexp)
+ if option.is_a?(String) || option.is_a?(Regexp)
+ @attributes[:pattern] = option
+ end
end
end
@@ -26,7 +28,7 @@ module QA
end
def selector_css
- %(#{qa_selector},.#{selector})
+ %Q([data-qa-selector="#{@name}"]#{additional_selectors},.#{selector})
end
def expression
@@ -38,19 +40,14 @@ module QA
end
def matches?(line)
- !!(line =~ /["']#{name}['"]|["']#{name.to_s.tr('_', '-')}['"]|#{expression}/)
+ !!(line =~ /["']#{name}['"]|#{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|
- %([data-qa-#{key.to_s.tr('_', '-')}="#{value}"])
+ %Q([data-qa-#{key.to_s.tr('_', '-')}="#{value}"])
end.join
end
end
diff --git a/qa/qa/page/file/edit.rb b/qa/qa/page/file/edit.rb
index ccf163cd1b4..665fef0d794 100644
--- a/qa/qa/page/file/edit.rb
+++ b/qa/qa/page/file/edit.rb
@@ -14,10 +14,8 @@ module QA
end
end
- def wait_for_markdown_preview(component, content)
- return if has_markdown_preview?(component, content)
-
- raise ElementNotFound, %("Couldn't find #{component} element with content '#{content}')
+ def preview
+ click_link('Preview')
end
end
end
diff --git a/qa/qa/page/project/secure/configuration_form.rb b/qa/qa/page/project/secure/configuration_form.rb
index 70eff31bfa9..493ec08d023 100644
--- a/qa/qa/page/project/secure/configuration_form.rb
+++ b/qa/qa/page/project/secure/configuration_form.rb
@@ -9,13 +9,15 @@ module QA
view 'app/assets/javascripts/security_configuration/components/app.vue' do
element :security_configuration_container
- element :security_view_history_link
+ element :security_configuration_history_link
end
view 'app/assets/javascripts/security_configuration/components/feature_card.vue' do
- element :feature_status
+ element :dependency_scanning_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
+ element :sast_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
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
@@ -23,15 +25,15 @@ module QA
end
def has_security_configuration_history_link?
- has_element?(:security_view_history_link)
+ has_element?(:security_configuration_history_link)
end
def has_no_security_configuration_history_link?
- has_no_element?(:security_view_history_link)
+ has_no_element?(:security_configuration_history_link)
end
def click_security_configuration_history_link
- click_element(:security_view_history_link)
+ click_element(:security_configuration_history_link)
end
def click_sast_enable_button
@@ -42,20 +44,40 @@ module QA
click_element(:dependency_scanning_mr_button)
end
- def has_true_sast_status?
- has_element?(:feature_status, feature: 'sast_true_status')
+ 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
end
- def has_false_sast_status?
- has_element?(:feature_status, feature: 'sast_false_status')
+ def has_no_dependency_scanning_status?(status_text)
+ within_element(:dependency_scanning_status) do
+ has_no_text?(status_text)
+ end
end
- def has_true_dependency_scanning_status?
- has_element?(:feature_status, feature: 'dependency_scanning_true_status')
+ def has_license_compliance_status?(status_text)
+ within_element(:license_scanning_status) do
+ has_text?(status_text)
+ end
end
- def has_false_dependency_scanning_status?
- has_element?(:feature_status, feature: 'dependency_scanning_false_status')
+ def has_no_license_compliance_status?(status_text)
+ within_element(:license_scanning_status) do
+ has_no_text?(status_text)
+ end
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 e6b13ed77a0..3eddd0fd33a 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 :select_allowed_to_push_dropdown
+ element :allowed_to_push_dropdown
element :allowed_to_push_dropdown_content
- element :select_allowed_to_merge_dropdown
+ element :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 :"select_allowed_to_#{action}_dropdown"
+ click_element :"allowed_to_#{action}_dropdown"
allowed[:roles] = Resource::ProtectedBranch::Roles::NO_ONE unless allowed.key?(:roles)
diff --git a/qa/qa/specs/features/browser_ui/3_create/source_editor/source_editor_toolbar_spec.rb b/qa/qa/specs/features/browser_ui/3_create/source_editor/source_editor_toolbar_spec.rb
index 435b9321601..ffe340eb0dd 100644
--- a/qa/qa/specs/features/browser_ui/3_create/source_editor/source_editor_toolbar_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/source_editor/source_editor_toolbar_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-# tagged transient due to feature-flag caching flakiness. Remove tag along with feature flag removal.
+
module QA
- RSpec.describe 'Create', feature_flag: { name: 'source_editor_toolbar', scope: :global } do
+ RSpec.describe 'Create' do
describe 'Source editor toolbar preview', product_group: :source_code do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
@@ -13,14 +13,9 @@ module QA
let(:edited_readme_content) { 'Here is the edited content.' }
before do
- Runtime::Feature.enable(:source_editor_toolbar)
Flow::Login.sign_in
end
- after do
- Runtime::Feature.disable(:source_editor_toolbar)
- end
-
it 'can preview markdown side-by-side while editing',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/367749' do
project.visit!
@@ -30,16 +25,11 @@ module QA
Page::File::Show.perform(&:click_edit)
- # wait_until required due to feature_caching. Remove along with feature flag removal.
Page::File::Edit.perform do |file|
- Support::Waiter.wait_until(sleep_interval: 2, max_duration: 60, reload_page: page,
- retry_on_exception: true) do
- expect(file).to have_element(:editor_toolbar_button)
- end
file.remove_content
- file.click_editor_toolbar
file.add_content('# ' + edited_readme_content)
- file.wait_for_markdown_preview('h1', edited_readme_content)
+ file.preview
+ expect(file.has_markdown_preview?('h1', edited_readme_content)).to be true
file.commit_changes
end
diff --git a/qa/spec/page/element_spec.rb b/qa/spec/page/element_spec.rb
index da1fd224564..fbf58b5e18a 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,10 +118,6 @@ 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) }