diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 06:09:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 06:09:49 +0300 |
commit | edf27428120b9726e34e577e5b1d3371c74baf1d (patch) | |
tree | 3e59d3def1ef3eb3ce5832f8daf6bbcd09acd841 /qa | |
parent | 73fd5a897364c6f91f86a0dd6d4b566c2574ca6e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
34 files changed, 248 insertions, 29 deletions
diff --git a/qa/.gitignore b/qa/.gitignore index 7bc4effd8a8..2095d5c722c 100644 --- a/qa/.gitignore +++ b/qa/.gitignore @@ -1,4 +1,5 @@ tmp/ .ruby-version +.tool-versions .ruby-gemset urls.yml diff --git a/qa/qa/page/component/design_management.rb b/qa/qa/page/component/design_management.rb index cccf1cf1a58..1f5620e30c7 100644 --- a/qa/qa/page/component/design_management.rb +++ b/qa/qa/page/component/design_management.rb @@ -108,6 +108,10 @@ module QA has_element?(:design_file_name, text: filename) end + def has_no_design?(filename) + has_no_element?(:design_file_name, text: filename) + end + def has_created_icon? has_element?(:design_status_icon, status: 'file-addition-solid') end diff --git a/qa/qa/page/component/issuable/sidebar.rb b/qa/qa/page/component/issuable/sidebar.rb index cc39260ce38..03c0811645f 100644 --- a/qa/qa/page/component/issuable/sidebar.rb +++ b/qa/qa/page/component/issuable/sidebar.rb @@ -69,7 +69,7 @@ module QA end end - def has_no_assignee_named?(username) + def has_no_assignee?(username) within_element(:assignee_block) do has_no_text?(username, wait: 120) end diff --git a/qa/qa/page/file/show.rb b/qa/qa/page/file/show.rb index 665b3c34dcc..28b6b3be154 100644 --- a/qa/qa/page/file/show.rb +++ b/qa/qa/page/file/show.rb @@ -46,8 +46,16 @@ module QA has_no_element?(:file_name_content, text: name) end - def has_file_content?(text) - has_element?(:file_content, text: text) + def has_file_content?(file_content, file_number = nil) + if file_number + within_element_by_index(:file_content, file_number - 1) do + has_text?(file_content) + end + else + within_element(:file_content) do + has_text?(file_content) + end + end end end end diff --git a/qa/qa/page/project/issue/index.rb b/qa/qa/page/project/issue/index.rb index 64bd62c2b54..e85d10e4eb8 100644 --- a/qa/qa/page/project/issue/index.rb +++ b/qa/qa/page/project/issue/index.rb @@ -79,6 +79,10 @@ module QA def has_issue?(issue) has_element? :issue_container, issue_title: issue.title end + + def has_no_issue?(issue) + has_no_element? :issue_container, issue_title: issue.title + end end end end diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index aff2378330a..bad492591ca 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -49,6 +49,10 @@ module QA has_element? :pipeline_url_link end + def has_no_pipeline? + has_no_element? :pipeline_url_link + end + def click_run_pipeline_button click_element :run_pipeline_button, Page::Project::Pipeline::New end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index b32d099d2b0..7f96b896c1d 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -72,6 +72,10 @@ module QA has_element? :child_pipeline end + def has_no_child_pipeline? + has_no_element? :child_pipeline + end + def click_job(job_name) click_element(:job_link, text: job_name) end diff --git a/qa/qa/page/project/wiki/show.rb b/qa/qa/page/project/wiki/show.rb index 61b0d202a76..d9e0783a581 100644 --- a/qa/qa/page/project/wiki/show.rb +++ b/qa/qa/page/project/wiki/show.rb @@ -59,6 +59,10 @@ module QA has_element?(:wiki_page_content, content) end + def has_no_content?(content) + has_no_element?(:wiki_page_content, content) + end + def has_no_page? has_element? :create_first_page_link end diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb index 82a06780830..2391154030b 100644 --- a/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb @@ -7,16 +7,18 @@ module QA # # git config --global receive.advertisepushoptions true - branch = "push-options-test-#{SecureRandom.hex(8)}" - title = "MR push options test #{SecureRandom.hex(8)}" - commit_message = 'Add README.md' + let(:branch) { "push-options-test-#{SecureRandom.hex(8)}" } + let(:title) { "MR push options test #{SecureRandom.hex(8)}" } + let(:commit_message) { 'Add README.md' } - project = Resource::Project.fabricate_via_api! do |project| - project.name = 'merge-request-push-options' - project.initialize_with_readme = true + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'merge-request-push-options' + project.initialize_with_readme = true + end end - it 'sets labels', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1032' do + def create_new_mr_via_push Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.commit_message = commit_message @@ -27,6 +29,10 @@ module QA label: %w[one two three] } end + end + + it 'sets labels', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1032' do + create_new_mr_via_push merge_request = project.merge_request_with_title(title) @@ -35,7 +41,11 @@ module QA end context 'when labels are set already' do - it 'removes them', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1033' do + before do + create_new_mr_via_push + end + + it 'removes them on subsequent push', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1033' do Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.file_content = "Unlabel test #{SecureRandom.hex(8)}" diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb index 26a83fc3caa..11f93d6a97e 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb @@ -40,12 +40,12 @@ module QA issue.set_issue_assignees(assignee_ids: [user2.id]) expect(show).to have_assignee(user2.name) - expect(show).to have_no_assignee_named(user1.name) + expect(show).not_to have_assignee(user1.name) issue.set_issue_assignees(assignee_ids: []) - expect(show).to have_no_assignee_named(user1.name) - expect(show).to have_no_assignee_named(user2.name) + expect(show).not_to have_assignee(user1.name) + expect(show).not_to have_assignee(user2.name) end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb index 13761244300..6a133540f87 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb @@ -37,7 +37,7 @@ module QA show.click_remove_related_issue_button - expect(show).to have_no_text(issue_2.title, wait: max_wait) + expect(show).not_to have_text(issue_2.title, wait: max_wait) end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb index d80fc4c5b95..5293fe71873 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb @@ -16,13 +16,13 @@ module QA Page::Dashboard::Snippet::Show.perform do |snippet| expect(snippet).to have_snippet_title('Project snippet') - expect(snippet).to have_no_snippet_description + expect(snippet).not_to have_snippet_description expect(snippet).to have_visibility_type(/private/i) expect(snippet).to have_file_name('markdown_file.md') expect(snippet).to have_file_content('Snippet heading') expect(snippet).to have_file_content('Gitlab link') - expect(snippet).to have_no_file_content('###') - expect(snippet).to have_no_file_content('https://gitlab.com/') + expect(snippet).not_to have_file_content('###') + expect(snippet).not_to have_file_content('https://gitlab.com/') end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb index ca6ea5db65d..8002e95cf0d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb @@ -46,8 +46,8 @@ module QA aggregate_failures 'file names and contents' do expect(snippet).to have_file_name('Original file name') expect(snippet).to have_file_content('Original file content') - expect(snippet).to have_no_file_name('Second file name') - expect(snippet).to have_no_file_content('Second file content') + expect(snippet).not_to have_file_name('Second file name') + expect(snippet).not_to have_file_content('Second file content') end end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb index ccd4d34a916..fcd8cb02870 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb @@ -19,7 +19,7 @@ module QA it 'user adds a CI variable', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/395' do Page::Project::Settings::CiVariables.perform do |ci_variable| expect(ci_variable).to have_text('VARIABLE_KEY') - expect(ci_variable).to have_no_text('some_CI_variable') + expect(ci_variable).not_to have_text('some_CI_variable') ci_variable.click_reveal_ci_variable_value_button diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb index 5a8aca9cd1e..b3967fc24c8 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb @@ -54,7 +54,7 @@ module QA Page::Project::Job::Show.perform do |job| aggregate_failures 'main CI is not overridden' do - expect(job.output).to have_no_content("#{unexpected_text}") + expect(job.output).not_to have_content("#{unexpected_text}") expect(job.output).to have_content("#{expected_text}") end end diff --git a/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb index 7783dba3fa7..49a52d25748 100644 --- a/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb @@ -112,7 +112,7 @@ module QA Page::Project::Packages::Index.perform do |index| aggregate_failures 'package deletion' do expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb index 2b06ba8646f..aa6cab8f5d6 100644 --- a/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb @@ -80,7 +80,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb index e163fcbe574..3da76259888 100644 --- a/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb @@ -118,7 +118,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb index 4ca356c9b65..5410b5023d9 100644 --- a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb @@ -96,7 +96,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb index 817e146adfe..fa88ace1556 100644 --- a/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb @@ -69,7 +69,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb index 0b70adf9ff6..54e28082436 100644 --- a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb @@ -84,7 +84,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb index 35c41bbb2b0..6afe086de98 100644 --- a/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb @@ -104,7 +104,7 @@ module QA Page::Project::Packages::Index.perform do |index| aggregate_failures do expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/spec/support/matchers/have_assignee.rb b/qa/spec/support/matchers/have_assignee.rb new file mode 100644 index 00000000000..5e7aa2162b2 --- /dev/null +++ b/qa/spec/support/matchers/have_assignee.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveAssignee + RSpec::Matchers.define :have_assignee do |assignee| + match do |page_object| + page_object.has_assignee?(assignee) + end + + match_when_negated do |page_object| + page_object.has_no_assignee?(assignee) + end + end + end +end diff --git a/qa/spec/support/matchers/have_child_pipeline.rb b/qa/spec/support/matchers/have_child_pipeline.rb new file mode 100644 index 00000000000..d05d9d4209a --- /dev/null +++ b/qa/spec/support/matchers/have_child_pipeline.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveChildPipeline + RSpec::Matchers.define :have_child_pipeline do + match do |page_object| + page_object.has_child_pipeline? + end + + match_when_negated do |page_object| + page_object.has_no_child_pipeline? + end + end + end +end diff --git a/qa/spec/support/matchers/have_content.rb b/qa/spec/support/matchers/have_content.rb new file mode 100644 index 00000000000..66b30b3b6e4 --- /dev/null +++ b/qa/spec/support/matchers/have_content.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveContent + RSpec::Matchers.define :have_content do |content| + match do |page_object| + page_object.has_content?(content) + end + + match_when_negated do |page_object| + page_object.has_no_content?(content) + end + end + end +end diff --git a/qa/spec/support/matchers/have_design.rb b/qa/spec/support/matchers/have_design.rb new file mode 100644 index 00000000000..85f1367297a --- /dev/null +++ b/qa/spec/support/matchers/have_design.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveDesign + RSpec::Matchers.define :have_design do |design| + match do |page_object| + page_object.has_design?(design) + end + + match_when_negated do |page_object| + page_object.has_no_design?(design) + end + end + end +end diff --git a/qa/spec/support/matchers/have_element.rb b/qa/spec/support/matchers/have_element.rb new file mode 100644 index 00000000000..bf74a78a3b5 --- /dev/null +++ b/qa/spec/support/matchers/have_element.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveElement + RSpec::Matchers.define :have_element do |element, **kwargs| + match do |page_object| + page_object.has_element?(element, **kwargs) + end + + match_when_negated do |page_object| + page_object.has_no_element?(element, **kwargs) + end + end + end +end diff --git a/qa/spec/support/matchers/have_file_content.rb b/qa/spec/support/matchers/have_file_content.rb new file mode 100644 index 00000000000..e42ece6d59e --- /dev/null +++ b/qa/spec/support/matchers/have_file_content.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveFileContent + RSpec::Matchers.define :have_file_content do |file_content, file_number| + match do |page_object| + page_object.has_file_content?(file_content, file_number) + end + + match_when_negated do |page_object| + page_object.has_no_file_content?(file_content, file_number) + end + end + end +end diff --git a/qa/spec/support/matchers/have_issue.rb b/qa/spec/support/matchers/have_issue.rb new file mode 100644 index 00000000000..7ef30f22726 --- /dev/null +++ b/qa/spec/support/matchers/have_issue.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveIssue + RSpec::Matchers.define :have_issue do |issue| + match do |page_object| + page_object.has_issue?(issue) + end + + match_when_negated do |page_object| + page_object.has_no_issue?(issue) + end + end + end +end diff --git a/qa/spec/support/matchers/have_job.rb b/qa/spec/support/matchers/have_job.rb new file mode 100644 index 00000000000..89829915fce --- /dev/null +++ b/qa/spec/support/matchers/have_job.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveJob + RSpec::Matchers.define :have_job do |job| + match do |page_object| + page_object.has_job?(job) + end + + match_when_negated do |page_object| + page_object.has_no_job?(job) + end + end + end +end diff --git a/qa/spec/support/matchers/have_package.rb b/qa/spec/support/matchers/have_package.rb new file mode 100644 index 00000000000..86e9bfee4d1 --- /dev/null +++ b/qa/spec/support/matchers/have_package.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HavePackage + RSpec::Matchers.define :have_package do |package| + match do |page_object| + page_object.has_package?(package) + end + + match_when_negated do |page_object| + page_object.has_no_package?(package) + end + end + end +end diff --git a/qa/spec/support/matchers/have_pipeline.rb b/qa/spec/support/matchers/have_pipeline.rb new file mode 100644 index 00000000000..2bfd49d671a --- /dev/null +++ b/qa/spec/support/matchers/have_pipeline.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HavePipeline + RSpec::Matchers.define :have_pipeline do + match do |page_object| + page_object.has_pipeline? + end + + match_when_negated do |page_object| + page_object.has_no_pipeline? + end + end + end +end diff --git a/qa/spec/support/matchers/have_related_issue_item.rb b/qa/spec/support/matchers/have_related_issue_item.rb new file mode 100644 index 00000000000..89403f2422a --- /dev/null +++ b/qa/spec/support/matchers/have_related_issue_item.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveRelatedIssueItem + RSpec::Matchers.define :have_related_issue_item do + match do |page_object| + page_object.has_related_issue_item? + end + + match_when_negated do |page_object| + page_object.has_no_related_issue_item? + end + end + end +end diff --git a/qa/spec/support/matchers/have_snippet_description.rb b/qa/spec/support/matchers/have_snippet_description.rb new file mode 100644 index 00000000000..7c407aefc83 --- /dev/null +++ b/qa/spec/support/matchers/have_snippet_description.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Matchers + module HaveSnippetDescription + RSpec::Matchers.define :have_snippet_description do |description| + match do |page_object| + page_object.has_snippet_description?(description) + end + + match_when_negated do |page_object| + page_object.has_no_snippet_description? + end + end + end +end |