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>2020-11-13 06:09:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-13 06:09:15 +0300
commita7364a04743746eab8b84c47900fbd04e1d45253 (patch)
tree6742fc3299a7f62f6c385fcd7edc428da93f3793 /qa
parentcf58163b565da802f152cc8f2d635fde3ef001ab (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb4
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb4
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb14
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb42
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb6
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb7
-rw-r--r--qa/spec/spec_helper.rb2
-rw-r--r--qa/spec/support/matchers/have_file.rb16
-rw-r--r--qa/spec/support/matchers/have_text.rb48
10 files changed, 105 insertions, 40 deletions
diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb
index f6aecff9f26..e4ac59cf5e0 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb
@@ -12,7 +12,9 @@ module QA
login_page.login('user1', 'user1pass')
end
- expect(page).to have_content('Welcome to GitLab')
+ Page::Dashboard::Welcome.perform do |welcome|
+ expect(welcome).to have_content('Welcome to GitLab')
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb
index 633e768dee6..e71cbeb9837 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb
@@ -15,9 +15,9 @@ module QA
Page::Project::Menu.perform(&:click_members)
Page::Project::Members.perform do |members|
members.add_member(user.username)
- end
- expect(page).to have_content(/@#{user.username}( Is using seat)?(\n| )?Given access/)
+ expect(members).to have_content(/@#{user.username}( Is using seat)?(\n| )?Given access/)
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb
index 65ca905d05f..c23d375e5f8 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb
@@ -11,12 +11,14 @@ module QA
project.description = 'create awesome project test'
end
- expect(page).to have_content(created_project.name)
- expect(page).to have_content(
- /Project \S?awesome-project\S+ was successfully created/
- )
- expect(page).to have_content('create awesome project test')
- expect(page).to have_content('The repository for this project is empty')
+ Page::Project::Show.perform do |project|
+ expect(project).to have_content(created_project.name)
+ expect(project).to have_content(
+ /Project \S?awesome-project\S+ was successfully created/
+ )
+ expect(project).to have_content('create awesome project test')
+ expect(project).to have_content('The repository for this project is empty')
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
index 8931becb322..d54ce0ac0fc 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
@@ -49,23 +49,26 @@ module QA
end
def verify_repository_import
- expect(page).to have_content('This test project is used for automated GitHub import by GitLab QA.')
- expect(page).to have_content(imported_project.name)
+ Page::Project::Show.perform do |project|
+ expect(project).to have_content('This test project is used for automated GitHub import by GitLab QA.')
+ expect(project).to have_content(imported_project.name)
+ end
end
def verify_issues_import
QA::Support::Retrier.retry_on_exception do
Page::Project::Menu.perform(&:click_issues)
- expect(page).to have_content('This is a sample issue')
- click_link 'This is a sample issue'
+ Page::Project::Issue::Show.perform do |issue_page|
+ expect(issue_page).to have_content('This is a sample issue')
- expect(page).to have_content('This is a sample first comment')
+ click_link 'This is a sample issue'
- # Comments
- comment_text = 'This is a comment from @sliaquat'
+ expect(issue_page).to have_content('This is a sample first comment')
+
+ # Comments
+ comment_text = 'This is a comment from @sliaquat'
- Page::Project::Issue::Show.perform do |issue_page|
expect(issue_page).to have_comment(comment_text)
expect(issue_page).to have_label('custom new label')
expect(issue_page).to have_label('help wanted')
@@ -76,20 +79,21 @@ module QA
def verify_merge_requests_import
Page::Project::Menu.perform(&:click_merge_requests)
- expect(page).to have_content('Improve readme')
- click_link 'Improve readme'
+ Page::MergeRequest::Show.perform do |merge_request|
+ expect(merge_request).to have_content('Improve readme')
- expect(page).to have_content('This improves the README file a bit.')
+ click_link 'Improve readme'
- # Comments
- expect(page).to have_content('[PR comment by @sliaquat] Nice work!')
+ expect(merge_request).to have_content('This improves the README file a bit.')
- # Diff comments
- expect(page).to have_content('[Single diff comment] Good riddance')
- expect(page).to have_content('[Single diff comment] Nice addition')
+ # Comments
+ expect(merge_request).to have_content('[PR comment by @sliaquat] Nice work!')
+
+ # Diff comments
+ expect(merge_request).to have_content('[Single diff comment] Good riddance')
+ expect(merge_request).to have_content('[Single diff comment] Nice addition')
- Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_label('bug')
expect(merge_request).to have_label('documentation')
end
@@ -108,7 +112,9 @@ module QA
def verify_wiki_import
Page::Project::Menu.perform(&:click_wiki)
- expect(page).to have_content('Welcome to the test-project wiki!')
+ Page::Project::Wiki::Show.perform do |wiki|
+ expect(wiki).to have_content('Welcome to the test-project wiki!')
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb
index fd6d26153ea..3609d083fde 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb
@@ -13,9 +13,11 @@ module QA
end.project.visit!
Page::Project::Menu.perform(&:click_activity)
- Page::Project::Activity.perform(&:click_push_events)
+ Page::Project::Activity.perform do |activity|
+ activity.click_push_events
- expect(page).to have_content('pushed new branch master')
+ expect(activity).to have_content('pushed new branch master')
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb
index d523ad0700b..062dd815c52 100644
--- a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
module QA
- include HaveFileMatcher
-
RSpec.describe 'Create' do
describe 'Files management' do
it 'user creates, edits and deletes a file via the Web', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/451' do
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb
index 00d4acbd1e1..f01a3b21eee 100644
--- a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb
@@ -35,8 +35,11 @@ module QA
# Check that the target project has the commit from the source
target_project.visit!
- expect(page).to have_content('README.md')
- expect(page).to have_content('This is a test project')
+
+ Page::Project::Show.perform do |project|
+ expect(project).to have_content('README.md')
+ expect(project).to have_content('This is a test project')
+ end
end
end
end
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb
index ff7717f1d1f..9785d0a9014 100644
--- a/qa/spec/spec_helper.rb
+++ b/qa/spec/spec_helper.rb
@@ -19,6 +19,8 @@ Dir[::File.join(__dir__, "support/shared_contexts/*.rb")].sort.each { |f| requir
Dir[::File.join(__dir__, "support/shared_examples/*.rb")].sort.each { |f| require f }
RSpec.configure do |config|
+ config.include ::Matchers
+
QA::Specs::Helpers::Quarantine.configure_rspec
config.before do |example|
diff --git a/qa/spec/support/matchers/have_file.rb b/qa/spec/support/matchers/have_file.rb
index c2bbf134e76..2ae295d5ca2 100644
--- a/qa/spec/support/matchers/have_file.rb
+++ b/qa/spec/support/matchers/have_file.rb
@@ -1,13 +1,15 @@
# frozen_string_literal: true
-module HaveFileMatcher
- RSpec::Matchers.define :have_file do |file|
- match do |page_object|
- page_object.has_file?(file)
- end
+module Matchers
+ module HaveFile
+ RSpec::Matchers.define :have_file do |file|
+ match do |page_object|
+ page_object.has_file?(file)
+ end
- match_when_negated do |page_object|
- page_object.has_no_file?(file)
+ match_when_negated do |page_object|
+ page_object.has_no_file?(file)
+ end
end
end
end
diff --git a/qa/spec/support/matchers/have_text.rb b/qa/spec/support/matchers/have_text.rb
new file mode 100644
index 00000000000..4e6fbf1f6d6
--- /dev/null
+++ b/qa/spec/support/matchers/have_text.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+module Matchers
+ class HaveText
+ def initialize(expected_text, **kwargs)
+ @expected_text = expected_text
+ @kwargs = kwargs
+ end
+
+ def matches?(actual)
+ @actual = wrap(actual)
+ @actual.has_text?(@expected_text, **@kwargs)
+ end
+
+ def does_not_match?(actual)
+ @actual = wrap(actual)
+ @actual.has_no_text?(@expected_text, **@kwargs)
+ end
+
+ def failure_message
+ "expected to find text \"#{@expected_text}\" in \"#{normalized_actual_text}\""
+ end
+
+ def failure_message_when_negated
+ "expected not to find text \"#{@expected_text}\" in \"#{normalized_actual_text}\""
+ end
+
+ def normalized_actual_text
+ @actual.text.gsub(/\s+/, " ")
+ end
+
+ # From https://github.com/teamcapybara/capybara/blob/fe5940c6afbfe32152df936ce03ad1371ae05354/lib/capybara/rspec/matchers/base.rb#L66
+ def wrap(actual)
+ actual = actual.to_capybara_node if actual.respond_to?(:to_capybara_node)
+ @context_el = if actual.respond_to?(:has_selector?)
+ actual
+ else
+ Capybara.string(actual.to_s)
+ end
+ end
+ end
+
+ def have_text(text, **kwargs) # rubocop:disable Naming/PredicateName
+ HaveText.new(text, **kwargs)
+ end
+
+ alias_method :have_content, :have_text
+end