diff options
Diffstat (limited to 'qa')
19 files changed, 141 insertions, 71 deletions
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/note.rb b/qa/qa/page/component/note.rb index fe324574f4d..34fde045091 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -20,13 +20,17 @@ module QA end base.view 'app/assets/javascripts/notes/components/discussion_actions.vue' do - element :discussion_reply + element :discussion_reply_tab end base.view 'app/assets/javascripts/notes/components/toggle_replies_widget.vue' do element :expand_replies element :collapse_replies end + + base.view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do + element :toggle_comments_button + end end def start_discussion(text) @@ -36,8 +40,12 @@ module QA click_element :comment_button end + def toggle_comments + all_elements(:toggle_comments_button).last.click + end + def type_reply_to_discussion(reply_text) - all_elements(:discussion_reply).last.click + all_elements(:discussion_reply_tab).last.click fill_element :reply_input, reply_text end 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/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/settings/ci_cd.rb b/qa/qa/page/project/settings/ci_cd.rb index b8c5c563da6..ae826fb3a32 100644 --- a/qa/qa/page/project/settings/ci_cd.rb +++ b/qa/qa/page/project/settings/ci_cd.rb @@ -8,33 +8,32 @@ module QA include Common view 'app/views/projects/settings/ci_cd/show.html.haml' do - element :autodevops_settings - element :runners_settings - element :variables_settings + element :autodevops_settings_content + element :runners_settings_content + element :variables_settings_content end view 'app/views/projects/settings/ci_cd/_autodevops_form.html.haml' do - element :enable_auto_devops_field, 'check_box :enabled' # rubocop:disable QA/ElementWithPattern - element :enable_auto_devops_button, "%strong= s_('CICD|Default to Auto DevOps pipeline')" # rubocop:disable QA/ElementWithPattern - element :save_changes_button, "submit _('Save changes')" # rubocop:disable QA/ElementWithPattern + element :enable_autodevops_checkbox + element :save_changes_button end def expand_runners_settings(&block) - expand_section(:runners_settings) do + expand_section(:runners_settings_content) do Settings::Runners.perform(&block) end end def expand_ci_variables(&block) - expand_section(:variables_settings) do + expand_section(:variables_settings_content) do Settings::CiVariables.perform(&block) end end def enable_auto_devops - expand_section(:autodevops_settings) do - check 'Default to Auto DevOps pipeline' - click_on 'Save changes' + expand_section(:autodevops_settings_content) do + check_element :enable_autodevops_checkbox + click_element :save_changes_button end end end diff --git a/qa/qa/page/project/sub_menus/project.rb b/qa/qa/page/project/sub_menus/project.rb index 5e0ee3c274a..6f1bc131f84 100644 --- a/qa/qa/page/project/sub_menus/project.rb +++ b/qa/qa/page/project/sub_menus/project.rb @@ -10,7 +10,7 @@ module QA def self.included(base) base.class_eval do view 'app/views/layouts/nav/sidebar/_project.html.haml' do - element :link_project + element :project_link end end end @@ -18,7 +18,7 @@ module QA def click_project retry_on_exception do within_sidebar do - click_element(:link_project) + click_element(:project_link) end 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/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/7_configure/mattermost/create_group_with_mattermost_team_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb index 94d20106de4..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/1_manage/group/create_group_with_mattermost_team_spec.rb 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 afddbff75bd..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,15 +3,27 @@ module QA context 'Plan' do describe 'check xss occurence in @mentions in issues' do - before do - Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.perform(&:sign_in_using_credentials) + it 'user mentions a user in comment' do + 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 @@ -27,15 +39,13 @@ module QA issue.project = project end issue.visit! - end - it 'user mentions a user in comment' do - 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 e8fdffeeeab..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 @@ -15,28 +15,28 @@ module QA issue.visit! - Page::Project::Issue::Show.perform do |show_page| + Page::Project::Issue::Show.perform do |show| my_first_discussion = 'My first discussion' - show_page.select_all_activities_filter - show_page.start_discussion(my_first_discussion) + show.select_all_activities_filter + show.start_discussion(my_first_discussion) page.assert_text(my_first_discussion) - show_page.reply_to_discussion(my_first_reply) + show.reply_to_discussion(my_first_reply) page.assert_text(my_first_reply) end end it 'user collapses and expands reply for comments in an issue' do - Page::Project::Issue::Show.perform do |show_page| + 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 78919561a89..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 @@ -14,18 +14,18 @@ module QA end it 'user comments on an issue and edits the comment' do - Page::Project::Issue::Show.perform do |issue_show_page| + 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/filter_issue_comments_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb index 6f5b6893248..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 @@ -17,25 +17,25 @@ module QA end it 'user filters comments and activities in an issue' do - Page::Project::Issue::Show.perform do |show_page| + 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 694a3ffb54b..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 @@ -24,12 +24,12 @@ module QA 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/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) |