diff options
Diffstat (limited to 'qa')
40 files changed, 219 insertions, 141 deletions
diff --git a/qa/Gemfile b/qa/Gemfile index c46be8a0362..53e7cc497e2 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -10,6 +10,7 @@ gem 'selenium-webdriver', '~> 3.12' gem 'airborne', '~> 0.2.13' gem 'nokogiri', '~> 1.10.3' gem 'rspec-retry', '~> 0.6.1' +gem 'rspec_junit_formatter', '~> 0.4.1' gem 'faker', '~> 1.6', '>= 1.6.6' gem 'knapsack', '~> 1.17' gem 'parallel_tests', '~> 2.29' diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock index 73aabf2c6ad..7d19366f83b 100644 --- a/qa/Gemfile.lock +++ b/qa/Gemfile.lock @@ -87,6 +87,8 @@ GEM rspec-retry (0.6.1) rspec-core (> 3.3) rspec-support (3.7.0) + rspec_junit_formatter (0.4.1) + rspec-core (>= 2, < 4, != 2.12.0) rubyzip (1.2.2) selenium-webdriver (3.141.0) childprocess (~> 0.5) @@ -116,6 +118,7 @@ DEPENDENCIES rake (~> 12.3.0) rspec (~> 3.7) rspec-retry (~> 0.6.1) + rspec_junit_formatter (~> 0.4.1) selenium-webdriver (~> 3.12) BUNDLED WITH diff --git a/qa/qa/ce/knapsack/nightly_master_report.json b/qa/qa/ce/knapsack/nightly_master_report.json new file mode 100644 index 00000000000..08694f706de --- /dev/null +++ b/qa/qa/ce/knapsack/nightly_master_report.json @@ -0,0 +1,46 @@ +{ + "qa/specs/features/api/1_manage/users_spec.rb": 0.6089541912078857, + "qa/specs/features/api/3_create/repository/files_spec.rb": 5.015859127044678, + "qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb": 1.0199065208435059, + "qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb": 33.54091453552246, + "qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb": 3.438166856765747, + "qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb": 20.58603596687317, + "qa/specs/features/browser_ui/1_manage/login/register_spec.rb": 22.320587396621704, + "qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb": 8.490083694458008, + "qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb": 10.214765310287476, + "qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb": 100.28881478309631, + "qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb": 7.882027864456177, + "qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb": 13.739388942718506, + "qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb": 13.403101205825806, + "qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb": 10.989444971084595, + "qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb": 10.811973810195923, + "qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb": 12.63524317741394, + "qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb": 11.280649185180664, + "qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb": 41.76726770401001, + "qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb": 32.5517954826355, + "qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb": 46.54227638244629, + "qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb": 27.943300485610962, + "qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb": 3.705310821533203, + "qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb": 40.09336972236633, + "qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb": 31.49540114402771, + "qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb": 16.18057894706726, + "qa/specs/features/browser_ui/3_create/repository/clone_spec.rb": 0.7397980690002441, + "qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb": 18.047621726989746, + "qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb": 9.48607873916626, + "qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb": 23.710937023162842, + "qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb": 19.459370374679565, + "qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb": 7.730542182922363, + "qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb": 29.76174831390381, + "qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb": 22.800872802734375, + "qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb": 6.731764793395996, + "qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb": 5.812374591827393, + "qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb": 25.460349321365356, + "qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb": 17.273863554000854, + "qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb": 8.31815505027771, + "qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb": 18.679633855819702, + "qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb": 15.342933893203735, + "qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb": 92.46774697303772, + "qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb": 20.252174615859985, + "qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb": 8.281434059143066, + "qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb": 8.810423135757446 +}
\ No newline at end of file diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 80ce23d5c38..45496c6b245 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -181,11 +181,11 @@ module QA return ["Page class does not have views / elements defined!"] end - views.map(&:errors).flatten + views.flat_map(&:errors) end def self.elements - views.map(&:elements).flatten + views.flat_map(&:elements) end def send_keys_to_element(name, keys) diff --git a/qa/qa/page/component/select2.rb b/qa/qa/page/component/select2.rb index 85d4abcde9b..d05c44d22b2 100644 --- a/qa/qa/page/component/select2.rb +++ b/qa/qa/page/component/select2.rb @@ -8,6 +8,10 @@ module QA find('.select2-result-label', text: item_text, match: :prefer_exact).click end + def current_selection + find('.select2-chosen').text + end + def clear_current_selection_if_present if has_css?('a > abbr.select2-search-choice-close', wait: 1.0) find('a > abbr.select2-search-choice-close').click diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 8970eeb6678..c2b0482d789 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -6,7 +6,7 @@ module QA class Login < Page::Base view 'app/views/devise/passwords/edit.html.haml' do element :password_field - element :password_confirmation + element :password_confirmation_field element :change_password_button end @@ -44,7 +44,7 @@ module QA def sign_in_using_credentials(user = nil) # Don't try to log-in if we're already logged-in - return if Page::Main::Menu.act { has_personal_area?(wait: 0) } + return if Page::Main::Menu.perform { |menu| menu.has_personal_area?(wait: 0) } using_wait_time 0 do set_initial_password_if_present @@ -58,7 +58,7 @@ module QA end end - Page::Main::Menu.act { has_personal_area? } + Page::Main::Menu.perform(&:has_personal_area?) end def sign_in_using_admin_credentials @@ -73,7 +73,7 @@ module QA sign_in_using_gitlab_credentials(admin) end - Page::Main::Menu.act { has_personal_area? } + Page::Main::Menu.perform(&:has_personal_area?) end def self.path @@ -154,7 +154,7 @@ module QA return unless has_content?('Change your password') fill_element :password_field, Runtime::User.password - fill_element :password_confirmation, Runtime::User.password + fill_element :password_confirmation_field, Runtime::User.password click_element :change_password_button end end diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index c98d85d7911..d86d554356e 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -6,7 +6,7 @@ module QA class Menu < Page::Base view 'app/views/layouts/header/_current_user_dropdown.html.haml' do element :sign_out_link - element :settings_link, 'link_to s_("CurrentUser|Settings")' # rubocop:disable QA/ElementWithPattern + element :settings_link end view 'app/views/layouts/header/_default.html.haml' do diff --git a/qa/qa/page/main/oauth.rb b/qa/qa/page/main/oauth.rb index 5f6ddb9a114..2b1a9ab2b6a 100644 --- a/qa/qa/page/main/oauth.rb +++ b/qa/qa/page/main/oauth.rb @@ -5,7 +5,7 @@ module QA module Main class OAuth < Page::Base view 'app/views/doorkeeper/authorizations/new.html.haml' do - element :authorization_button, 'submit_tag _("Authorize")' # rubocop:disable QA/ElementWithPattern + element :authorization_button end def needs_authorization? @@ -13,7 +13,7 @@ module QA end def authorize! - click_button 'Authorize' + click_element :authorization_button end end end diff --git a/qa/qa/page/main/sign_up.rb b/qa/qa/page/main/sign_up.rb index 46a105003d0..c47d2ce9c74 100644 --- a/qa/qa/page/main/sign_up.rb +++ b/qa/qa/page/main/sign_up.rb @@ -5,28 +5,28 @@ module QA module Main class SignUp < Page::Base view 'app/views/devise/shared/_signup_box.html.haml' do - element :new_user_name - element :new_user_username - element :new_user_email - element :new_user_email_confirmation - element :new_user_password + element :new_user_name_field + element :new_user_username_field + element :new_user_email_field + element :new_user_email_confirmation_field + element :new_user_password_field element :new_user_register_button - element :new_user_accept_terms + element :new_user_accept_terms_checkbox end def sign_up!(user) - fill_element :new_user_name, user.name - fill_element :new_user_username, user.username - fill_element :new_user_email, user.email - fill_element :new_user_email_confirmation, user.email - fill_element :new_user_password, user.password + fill_element :new_user_name_field, user.name + fill_element :new_user_username_field, user.username + fill_element :new_user_email_field, user.email + fill_element :new_user_email_confirmation_field, user.email + fill_element :new_user_password_field, user.password - check_element :new_user_accept_terms if has_element?(:new_user_accept_terms) + check_element :new_user_accept_terms_checkbox if has_element?(:new_user_accept_terms_checkbox) signed_in = retry_until do click_element :new_user_register_button - Page::Main::Menu.act { has_personal_area? } + Page::Main::Menu.perform(&:has_personal_area?) end raise "Failed to register and sign in" unless signed_in diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index b59540d0377..507dccb52d0 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -70,7 +70,10 @@ module QA end def select_labels_and_refresh(labels) - click_element(:edit_link_labels) + Support::Retrier.retry_until do + click_element(:edit_link_labels) + has_element?(:dropdown_menu_labels, text: labels.first) + end labels.each do |label| within_element(:dropdown_menu_labels, text: label) do diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 0918445d119..64aab9be056 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -59,7 +59,7 @@ module QA end def set_visibility(visibility) - choose visibility + choose visibility.capitalize end def click_github_link diff --git a/qa/qa/page/project/operations/kubernetes/show.rb b/qa/qa/page/project/operations/kubernetes/show.rb index 4f625c5f0f0..eb30e0ea02a 100644 --- a/qa/qa/page/project/operations/kubernetes/show.rb +++ b/qa/qa/page/project/operations/kubernetes/show.rb @@ -28,16 +28,12 @@ module QA end end - def await_installed(application_name, button_text: 'Installed') + def await_installed(application_name) within(".js-cluster-application-row-#{application_name}") do - page.has_text?(button_text, wait: 300) + page.has_text?(/Installed|Uninstall/, wait: 300) end end - def await_uninstallable(application_name) - await_installed(application_name, button_text: 'Uninstall') - end - def ingress_ip # We need to wait longer since it can take some time before the # ip address is assigned for the ingress controller diff --git a/qa/qa/page/project/sub_menus/common.rb b/qa/qa/page/project/sub_menus/common.rb index c94e1e85256..3c9e8085748 100644 --- a/qa/qa/page/project/sub_menus/common.rb +++ b/qa/qa/page/project/sub_menus/common.rb @@ -12,7 +12,11 @@ module QA end def within_submenu - within('.fly-out-list') do + if has_css?('.fly-out-list') + within('.fly-out-list') do + yield + end + else yield end end diff --git a/qa/qa/page/validator.rb b/qa/qa/page/validator.rb index edd12665f1e..9b2d0a1a41d 100644 --- a/qa/qa/page/validator.rb +++ b/qa/qa/page/validator.rb @@ -22,16 +22,14 @@ module QA end def descendants - @descendants ||= constants.map do |const| + @descendants ||= constants.flat_map do |const| case const when Class const if const < Page::Base when Module Page::Validator.new(const).descendants end - end - - @descendants.flatten.compact + end.compact end def errors diff --git a/qa/qa/resource/kubernetes_cluster.rb b/qa/qa/resource/kubernetes_cluster.rb index 1dd93dd5b88..27ab7b60211 100644 --- a/qa/qa/resource/kubernetes_cluster.rb +++ b/qa/qa/resource/kubernetes_cluster.rb @@ -47,7 +47,7 @@ module QA page.install!(:runner) if @install_runner page.await_installed(:ingress) if @install_ingress - page.await_uninstallable(:prometheus) if @install_prometheus + page.await_installed(:prometheus) if @install_prometheus page.await_installed(:runner) if @install_runner if @install_ingress diff --git a/qa/qa/resource/merge_request.rb b/qa/qa/resource/merge_request.rb index 45cb317e0eb..7969de726e4 100644 --- a/qa/qa/resource/merge_request.rb +++ b/qa/qa/resource/merge_request.rb @@ -9,6 +9,7 @@ module QA :description, :source_branch, :target_branch, + :target_new_branch, :assignee, :milestone, :labels, @@ -27,6 +28,7 @@ module QA Repository::ProjectPush.fabricate! do |resource| resource.project = project resource.branch_name = 'master' + resource.new_branch = @target_new_branch resource.remote_branch = target_branch end end @@ -52,6 +54,7 @@ module QA @labels = [] @file_name = "added_file.txt" @file_content = "File Added" + @target_new_branch = true end def fabricate! diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index c0a6004fe27..93a82094776 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -8,6 +8,7 @@ module QA include Events::Project attr_writer :initialize_with_readme + attr_writer :visibility attribute :id attribute :name @@ -44,6 +45,7 @@ module QA @standalone = false @description = 'My awesome project' @initialize_with_readme = false + @visibility = 'public' end def name=(raw_name) @@ -60,7 +62,7 @@ module QA page.choose_test_namespace page.choose_name(@name) page.add_description(@description) - page.set_visibility('Public') + page.set_visibility(@visibility) page.enable_initialize_with_readme if @initialize_with_readme page.create_new_project end @@ -88,7 +90,7 @@ module QA post_body = { name: name, description: description, - visibility: 'public', + visibility: @visibility, initialize_with_readme: @initialize_with_readme } diff --git a/qa/qa/scenario/test/sanity/selectors.rb b/qa/qa/scenario/test/sanity/selectors.rb index e05269e8d55..b4d70fc191a 100644 --- a/qa/qa/scenario/test/sanity/selectors.rb +++ b/qa/qa/scenario/test/sanity/selectors.rb @@ -14,7 +14,7 @@ module QA Page::Validator.new(pages) end - validators.map(&:errors).flatten.tap do |errors| + validators.flat_map(&:errors).tap do |errors| break if errors.none? warn <<~EOS diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb index 2363836d5e3..c9acd7df776 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb @@ -5,7 +5,7 @@ module QA describe 'Project transfer between groups' do it 'user transfers a project between groups' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) source_group = Resource::Group.fabricate_via_api! do |group| group.path = 'source-group' diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb index 09d1d3fe76e..6556c28ccab 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb @@ -5,7 +5,7 @@ module QA describe 'basic user login' do it 'user logs in using basic credentials and logs out' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Menu.perform do |menu| expect(menu).to have_personal_area diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb index 72dde4e5bd8..10cd8470a8f 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb @@ -5,7 +5,7 @@ module QA describe 'LDAP login' do it 'user logs into GitLab using LDAP credentials' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Menu.perform do |menu| expect(menu).to have_personal_area 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 87f0e9030d2..101143399f6 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 @@ -6,9 +6,9 @@ module QA it 'User logs in to gitlab with SAML SSO' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_with_saml } + Page::Main::Login.perform(&:sign_in_with_saml) - Vendor::SAMLIdp::Page::Login.act { login } + Vendor::SAMLIdp::Page::Login.perform(&:login) expect(page).to have_content('Welcome to GitLab') 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 6632c2977ef..fbe857dc2a5 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 @@ -5,7 +5,7 @@ module QA describe 'Project creation' do it 'user creates a new project' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) created_project = Resource::Project.fabricate_via_browser_ui! do |project| project.name = 'awesome-project' 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 a9eafd61a91..4f8c46cbd5f 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 @@ -24,16 +24,16 @@ module QA it 'user imports a GitHub repo' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) imported_project # import the project - Page::Main::Menu.act { go_to_projects } + Page::Main::Menu.perform(&:go_to_projects) Page::Dashboard::Projects.perform do |dashboard| dashboard.go_to_project(imported_project.name) end - Page::Project::Show.act { wait_for_import } + Page::Project::Show.perform(&:wait_for_import) verify_repository_import verify_issues_import @@ -50,7 +50,7 @@ module QA def verify_issues_import QA::Support::Retrier.retry_on_exception do - Page::Project::Menu.act { click_issues } + Page::Project::Menu.perform(&:click_issues) expect(page).to have_content('This is a sample issue') click_link 'This is a sample issue' @@ -73,7 +73,7 @@ module QA end def verify_merge_requests_import - Page::Project::Menu.act { click_merge_requests } + Page::Project::Menu.perform(&:click_merge_requests) expect(page).to have_content('Improve README.md') click_link 'Improve README.md' @@ -108,7 +108,7 @@ module QA end def verify_wiki_import - Page::Project::Menu.act { click_wiki } + Page::Project::Menu.perform(&:click_wiki) expect(page).to have_content('Welcome to the test-project wiki!') end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb index 5eceeb9661c..70c03e10449 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb @@ -3,17 +3,27 @@ module QA context 'Plan' do describe 'check xss occurence in @mentions in issues' do - let(:issue_title) { 'issue title' } - it 'user mentions a user in comment' do - Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.perform(&:sign_in_using_credentials) + QA::Runtime::Env.personal_access_token = QA::Runtime::Env.admin_personal_access_token + + unless QA::Runtime::Env.personal_access_token + Runtime::Browser.visit(:gitlab, Page::Main::Login) + Page::Main::Login.perform(&:sign_in_using_admin_credentials) + end user = Resource::User.fabricate_via_api! do |user| user.name = "eve <img src=x onerror=alert(2)<img src=x onerror=alert(1)>" user.password = "test1234" end + QA::Runtime::Env.personal_access_token = nil + + Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform { |p| p.has_personal_area?(wait: 0) } + + Runtime::Browser.visit(:gitlab, Page::Main::Login) + + Page::Main::Login.perform(&:sign_in_using_credentials) + project = Resource::Project.fabricate_via_api! do |resource| resource.name = 'xss-test-for-mentions-project' end @@ -25,17 +35,17 @@ module QA end issue = Resource::Issue.fabricate_via_api! do |issue| - issue.title = issue_title + issue.title = 'issue title' issue.project = project end issue.visit! - Page::Project::Issue::Show.perform do |show_page| - show_page.select_all_activities_filter - show_page.comment('cc-ing you here @eve') + Page::Project::Issue::Show.perform do |show| + show.select_all_activities_filter + show.comment('cc-ing you here @eve') expect do - expect(show_page).to have_content("cc-ing you here") + expect(show).to have_content("cc-ing you here") end.not_to raise_error # Selenium::WebDriver::Error::UnhandledAlertError end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb index 2101311f065..ad70f6813fb 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb @@ -3,39 +3,40 @@ module QA context 'Plan' do describe 'collapse comments in issue discussions' do - let(:issue_title) { 'issue title' } + let(:my_first_reply) { 'My first reply' } - it 'user collapses reply for comments in an issue' do + before do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) issue = Resource::Issue.fabricate_via_api! do |issue| - issue.title = issue_title + issue.title = 'issue title' end issue.visit! - expect(page).to have_content(issue_title) + Page::Project::Issue::Show.perform do |show| + my_first_discussion = 'My first discussion' - Page::Project::Issue::Show.perform do |show_page| - my_first_discussion = "My first discussion" - my_first_reply = "My First Reply" - one_reply = "1 reply" - - show_page.select_all_activities_filter - show_page.start_discussion(my_first_discussion) - expect(show_page).to have_content(my_first_discussion) + show.select_all_activities_filter + show.start_discussion(my_first_discussion) + page.assert_text(my_first_discussion) + show.reply_to_discussion(my_first_reply) + page.assert_text(my_first_reply) + end + end - show_page.reply_to_discussion(my_first_reply) - expect(show_page).to have_content(my_first_reply) + it 'user collapses and expands reply for comments in an issue' do + Page::Project::Issue::Show.perform do |show| + one_reply = "1 reply" - show_page.collapse_replies - expect(show_page).to have_content(one_reply) - expect(show_page).not_to have_content(my_first_reply) + show.collapse_replies + expect(show).to have_content(one_reply) + expect(show).not_to have_content(my_first_reply) - show_page.expand_replies - expect(show_page).to have_content(my_first_reply) - expect(show_page).not_to have_content(one_reply) + show.expand_replies + expect(show).to have_content(my_first_reply) + expect(show).not_to have_content(one_reply) end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb index a62a51b11f4..0b1bd00ac8d 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb @@ -3,27 +3,29 @@ module QA context 'Plan' do describe 'Issue comments' do - it 'user comments on an issue and edits the comment' do + before do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) issue = Resource::Issue.fabricate_via_api! do |issue| issue.title = 'issue title' end issue.visit! + end - Page::Project::Issue::Show.perform do |issue_show_page| + it 'user comments on an issue and edits the comment' do + Page::Project::Issue::Show.perform do |show| first_version_of_comment = 'First version of the comment' second_version_of_comment = 'Second version of the comment' - issue_show_page.comment(first_version_of_comment) + show.comment(first_version_of_comment) - expect(issue_show_page).to have_content(first_version_of_comment) + expect(show).to have_content(first_version_of_comment) - issue_show_page.edit_comment(second_version_of_comment) + show.edit_comment(second_version_of_comment) - expect(issue_show_page).to have_content(second_version_of_comment) - expect(issue_show_page).not_to have_content(first_version_of_comment) + expect(show).to have_content(second_version_of_comment) + expect(show).not_to have_content(first_version_of_comment) end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb index 1eea3efec7f..04ae4963d3a 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb @@ -5,23 +5,35 @@ module QA describe 'Issue creation' do let(:issue_title) { 'issue title' } + before do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + Page::Main::Login.perform(&:sign_in_using_credentials) + end + it 'user creates an issue' do - create_issue + Resource::Issue.fabricate_via_browser_ui! do |issue| + issue.title = issue_title + end - Page::Project::Menu.act { click_issues } + Page::Project::Menu.perform(&:click_issues) expect(page).to have_content(issue_title) end - # Failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/101 - context 'when using attachments in comments', :object_storage, :quarantine do + context 'when using attachments in comments', :object_storage do let(:file_to_attach) do File.absolute_path(File.join('spec', 'fixtures', 'banana_sample.gif')) end - it 'user comments on an issue with an attachment' do - create_issue + before do + issue = Resource::Issue.fabricate_via_api! do |issue| + issue.title = issue_title + end + + issue.visit! + end + it 'user comments on an issue with an attachment' do Page::Project::Issue::Show.perform do |show| show.comment('See attached banana for scale', attachment: file_to_attach) @@ -37,15 +49,6 @@ module QA end end end - - def create_issue - Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } - - Resource::Issue.fabricate_via_browser_ui! do |issue| - issue.title = issue_title - end - end end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb index 301836f5ce8..317e31feea8 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb @@ -5,37 +5,37 @@ module QA describe 'filter issue comments activities' do let(:issue_title) { 'issue title' } - it 'user filters comments and activities in an issue' do + before do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) issue = Resource::Issue.fabricate_via_api! do |issue| issue.title = issue_title end issue.visit! + end - expect(page).to have_content(issue_title) - - Page::Project::Issue::Show.perform do |show_page| + it 'user filters comments and activities in an issue' do + Page::Project::Issue::Show.perform do |show| my_own_comment = "My own comment" made_the_issue_confidential = "made the issue confidential" - show_page.comment('/confidential', filter: :comments_only) - show_page.comment(my_own_comment, filter: :comments_only) + show.comment('/confidential', filter: :comments_only) + show.comment(my_own_comment, filter: :comments_only) - expect(show_page).not_to have_content(made_the_issue_confidential) - expect(show_page).to have_content(my_own_comment) + expect(show).not_to have_content(made_the_issue_confidential) + expect(show).to have_content(my_own_comment) - show_page.select_all_activities_filter + show.select_all_activities_filter - expect(show_page).to have_content(made_the_issue_confidential) - expect(show_page).to have_content(my_own_comment) + expect(show).to have_content(made_the_issue_confidential) + expect(show).to have_content(my_own_comment) - show_page.select_history_only_filter + show.select_history_only_filter - expect(show_page).to have_content(made_the_issue_confidential) - expect(show_page).not_to have_content(my_own_comment) + expect(show).to have_content(made_the_issue_confidential) + expect(show).not_to have_content(my_own_comment) end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb index 24dcb32f63f..c42c2cedde0 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb @@ -5,7 +5,7 @@ module QA describe 'issue suggestions' do let(:issue_title) { 'Issue Lists are awesome' } - it 'user sees issue suggestions when creating a new issue' do + before do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) @@ -20,14 +20,16 @@ module QA end project.visit! + end + it 'user sees issue suggestions when creating a new issue' do Page::Project::Show.perform(&:go_to_new_issue) - Page::Project::Issue::New.perform do |new_issue_page| - new_issue_page.add_title("issue") - expect(new_issue_page).to have_content(issue_title) + Page::Project::Issue::New.perform do |new| + new.add_title("issue") + expect(new).to have_content(issue_title) - new_issue_page.add_title("Issue Board") - expect(new_issue_page).not_to have_content(issue_title) + new.add_title("Issue Board") + expect(new).not_to have_content(issue_title) end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb index 7a36f9ea420..3ce291bf8bc 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true module QA - context 'Create' do + # Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/66 + context 'Create', :quarantine do describe 'Merge request rebasing' do it 'user rebases source branch of merge request' do Runtime::Browser.visit(:gitlab, Page::Main::Login) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb index f41240b7605..56a7a04e840 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb @@ -7,7 +7,7 @@ module QA it 'user adds and then removes an SSH key', :smoke do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) key = Resource::SSHKey.fabricate! do |resource| resource.title = key_title @@ -16,8 +16,8 @@ module QA expect(page).to have_content("Title: #{key_title}") expect(page).to have_content(key.fingerprint) - Page::Main::Menu.act { click_settings_link } - Page::Profile::Menu.act { click_ssh_keys } + Page::Main::Menu.perform(&:click_settings_link) + Page::Profile::Menu.perform(&:click_ssh_keys) Page::Profile::SSHKeys.perform do |ssh_keys| ssh_keys.remove_key(key_title) 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 d345fbfe995..51a1c19f0f7 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 @@ -5,7 +5,7 @@ module QA describe 'Files management' do it 'user creates, edits and deletes a file via the Web' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) # Create file_name = 'QA Test - File name' @@ -27,7 +27,7 @@ module QA updated_file_content = 'QA Test - Updated file content' commit_message_for_update = 'QA Test - Update file' - Page::File::Show.act { click_edit } + Page::File::Show.perform(&:click_edit) Page::File::Form.act do remove_content diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb index 6aebd04af03..e159e517cbb 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb @@ -13,7 +13,7 @@ module QA before do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) end after do diff --git a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb index 3af7db751e7..33744236dd4 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb @@ -11,7 +11,7 @@ module QA it 'user registers a new specific runner' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) Resource::Runner.fabricate! do |runner| runner.name = executor diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb index aa01e5a618e..6f39a755392 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true module QA - # Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/26 - context 'Release', :quarantine do + context 'Release' do describe 'Deploy key creation' do it 'user adds a deploy key' do Runtime::Browser.visit(:gitlab, Page::Main::Login) diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb index 791dc62e32f..ec0c45652fd 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb @@ -5,7 +5,7 @@ module QA describe 'Deploy token creation' do it 'user adds a deploy token' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) deploy_token_name = 'deploy token name' one_week_from_now = Date.today + 7 diff --git a/qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb index 8383dcdb983..94d20106de4 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb @@ -5,8 +5,8 @@ module QA describe 'Mattermost support' do it 'user creates a group with a mattermost team' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } - Page::Main::Menu.act { go_to_groups } + Page::Main::Login.perform(&:sign_in_using_credentials) + Page::Main::Menu.perform(&:go_to_groups) Page::Dashboard::Groups.perform do |page| page.click_new_group diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index 21bfd2876a9..363980acc33 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -46,7 +46,7 @@ RSpec.configure do |config| if ENV['CI'] config.around do |example| - retry_times = example.metadata.keys.include?(:quarantine) ? 1 : 2 + retry_times = example.metadata.key?(:quarantine) ? 1 : 2 example.run_with_retry retry: retry_times end end diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb index 6c533c6dc7d..3d98f03a982 100644 --- a/qa/spec/specs/runner_spec.rb +++ b/qa/spec/specs/runner_spec.rb @@ -125,9 +125,9 @@ describe QA::Specs::Runner do end def excluded_feature_tags_except(tag) - QA::Runtime::Env.supported_features.except(tag).map do |tag, _| + QA::Runtime::Env.supported_features.except(tag).flat_map do |tag, _| ['--tag', "~requires_#{tag}"] - end.flatten + end end def expect_rspec_runner_arguments(arguments) |