diff options
Diffstat (limited to 'qa/qa/page')
29 files changed, 252 insertions, 64 deletions
diff --git a/qa/qa/page/admin/overview/users/index.rb b/qa/qa/page/admin/overview/users/index.rb index e374c1bf281..fea95fdb84a 100644 --- a/qa/qa/page/admin/overview/users/index.rb +++ b/qa/qa/page/admin/overview/users/index.rb @@ -8,6 +8,7 @@ module QA class Index < QA::Page::Base view 'app/views/admin/users/index.html.haml' do element :user_search_field + element :pending_approval_tab end view 'app/views/admin/users/_user.html.haml' do @@ -22,6 +23,10 @@ module QA find_element(:user_search_field).set(username).send_keys(:return) end + def click_pending_approval_tab + click_element :pending_approval_tab + end + def click_user(username) within_element(:user_row_content, text: username) do click_element(:username_link) diff --git a/qa/qa/page/admin/overview/users/show.rb b/qa/qa/page/admin/overview/users/show.rb index f15ef0492fc..f455bd31d14 100644 --- a/qa/qa/page/admin/overview/users/show.rb +++ b/qa/qa/page/admin/overview/users/show.rb @@ -12,17 +12,32 @@ module QA view 'app/views/admin/users/show.html.haml' do element :confirm_user_button + element :user_id_content + end + + view 'app/views/admin/users/_approve_user.html.haml' do + element :approve_user_button end def click_impersonate_user click_element(:impersonate_user_link) end + def user_id + find_element(:user_id_content).text + end + def confirm_user accept_confirm do click_element :confirm_user_button end end + + def approve_user + accept_confirm do + click_element :approve_user_button + end + end end end end diff --git a/qa/qa/page/admin/settings/component/sign_up_restrictions.rb b/qa/qa/page/admin/settings/component/sign_up_restrictions.rb new file mode 100644 index 00000000000..8c5b4bf506b --- /dev/null +++ b/qa/qa/page/admin/settings/component/sign_up_restrictions.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module QA + module Page + module Admin + module Settings + module Component + class SignUpRestrictions < Page::Base + view 'app/views/admin/application_settings/_signup.html.haml' do + element :require_admin_approval_after_user_signup_checkbox + element :save_changes_button + end + + def require_admin_approval_after_user_signup + check_element :require_admin_approval_after_user_signup_checkbox + click_element :save_changes_button + end + end + end + end + end + end +end diff --git a/qa/qa/page/admin/settings/general.rb b/qa/qa/page/admin/settings/general.rb index 7e35902a778..a2457dded7c 100644 --- a/qa/qa/page/admin/settings/general.rb +++ b/qa/qa/page/admin/settings/general.rb @@ -9,6 +9,7 @@ module QA view 'app/views/admin/application_settings/general.html.haml' do element :account_and_limit_settings_content + element :sign_up_restrictions_settings_content end def expand_account_and_limit(&block) @@ -16,6 +17,12 @@ module QA Component::AccountAndLimit.perform(&block) end end + + def expand_sign_up_restrictions(&block) + expand_content(:sign_up_restrictions_settings_content) do + Component::SignUpRestrictions.perform(&block) + end + end end end end diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index ce4eac7fbc4..00b48dc7fe9 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -228,7 +228,7 @@ module QA def finished_loading_block? wait_for_requests - has_no_css?('.fa-spinner.block-loading', wait: Capybara.default_max_wait_time) + has_no_css?('.gl-spinner', wait: Capybara.default_max_wait_time) end def has_loaded_all_images? 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/component/legacy_clone_panel.rb b/qa/qa/page/component/legacy_clone_panel.rb index ebab9fd708c..f15d159a712 100644 --- a/qa/qa/page/component/legacy_clone_panel.rb +++ b/qa/qa/page/component/legacy_clone_panel.rb @@ -12,7 +12,7 @@ module QA base.view 'app/views/shared/_clone_panel.html.haml' do element :clone_dropdown element :clone_options_dropdown, '.clone-options-dropdown' # rubocop:disable QA/ElementWithPattern - element :project_repository_location, 'text_field_tag :project_clone' # rubocop:disable QA/ElementWithPattern + element :clone_url, 'text_field_tag :clone_url' # rubocop:disable QA/ElementWithPattern end end @@ -28,7 +28,7 @@ module QA end def repository_location - Git::Location.new(find('#project_clone').value) + Git::Location.new(find('#clone_url').value) end private diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb index 5ac72d73c78..0454042289b 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -122,13 +122,17 @@ module QA def select_all_activities_filter select_filter_with_text('Show all activity') + + wait_until do + has_no_element?(:discussion_filter_container) && has_element?(:comment_field) + end end def select_comments_only_filter select_filter_with_text('Show comments only') wait_until do - has_no_element?(:system_note_content) + has_no_element?(:discussion_filter_container) && has_no_element?(:system_note_content) end end @@ -145,6 +149,8 @@ module QA click_element :note_dropdown click_element :discussion_menu_item click_element :comment_button + + has_comment?(text) end def toggle_comments(position) 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/group/members.rb b/qa/qa/page/group/members.rb index 16e447a2be5..87423ae9d75 100644 --- a/qa/qa/page/group/members.rb +++ b/qa/qa/page/group/members.rb @@ -22,12 +22,12 @@ module QA element :group_row end - view 'app/assets/javascripts/vue_shared/components/members/table/role_dropdown.vue' do + view 'app/assets/javascripts/members/components/table/role_dropdown.vue' do element :access_level_dropdown element :access_level_link end - view 'app/assets/javascripts/vue_shared/components/members/action_buttons/remove_member_button.vue' do + view 'app/assets/javascripts/members/components/action_buttons/remove_member_button.vue' do element :delete_member_button end diff --git a/qa/qa/page/group/new.rb b/qa/qa/page/group/new.rb index 88e7121dbe0..5f43cfb49c0 100644 --- a/qa/qa/page/group/new.rb +++ b/qa/qa/page/group/new.rb @@ -7,7 +7,6 @@ module QA view 'app/views/shared/_group_form.html.haml' do element :group_path_field, 'text_field :path' # rubocop:disable QA/ElementWithPattern element :group_name_field, 'text_field :name' # rubocop:disable QA/ElementWithPattern - element :group_description_field, 'text_area :description' # rubocop:disable QA/ElementWithPattern end view 'app/views/groups/_new_group_fields.html.haml' do @@ -20,10 +19,6 @@ module QA fill_in 'group_name', with: path end - def set_description(description) - fill_in 'group_description', with: description - end - def set_visibility(visibility) choose visibility end diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 9c63ddee890..627809dacf2 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -93,6 +93,10 @@ module QA has_personal_area?(wait: 0) end + def not_signed_in? + has_no_personal_area? + end + def sign_out retry_until do wait_if_retry_later @@ -129,6 +133,10 @@ module QA has_element?(:user_avatar, wait: wait) end + def has_no_personal_area?(wait: Capybara.default_max_wait_time) + has_no_element?(:user_avatar, wait: wait) + end + def has_admin_area_link?(wait: Capybara.default_max_wait_time) has_element?(:admin_area_link, wait: wait) end diff --git a/qa/qa/page/main/sign_up.rb b/qa/qa/page/main/sign_up.rb deleted file mode 100644 index f8e85798012..00000000000 --- a/qa/qa/page/main/sign_up.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Main - class SignUp < Page::Base - view 'app/views/devise/shared/_signup_box.html.haml' do - element :new_user_first_name_field - element :new_user_last_name_field - element :new_user_username_field - element :new_user_email_field - element :new_user_password_field - element :new_user_register_button - end - - view 'app/views/registrations/welcome/show.html.haml' do - element :get_started_button - end - - def sign_up!(user) - signed_in = retry_until(raise_on_failure: false) do - fill_element :new_user_first_name_field, user.first_name - fill_element :new_user_last_name_field, user.last_name - fill_element :new_user_username_field, user.username - fill_element :new_user_email_field, user.email - fill_element :new_user_password_field, user.password - click_element :new_user_register_button if has_element?(:new_user_register_button) - click_element :get_started_button if has_element?(:get_started_button) - - Page::Main::Menu.perform(&:has_personal_area?) - end - - raise "Failed to register and sign in" unless signed_in - end - end - end - end -end - -QA::Page::Main::SignUp.prepend_if_ee('QA::EE::Page::Main::SignUp') diff --git a/qa/qa/page/profile/two_factor_auth.rb b/qa/qa/page/profile/two_factor_auth.rb index 6794825769a..a0dd230d8ab 100644 --- a/qa/qa/page/profile/two_factor_auth.rb +++ b/qa/qa/page/profile/two_factor_auth.rb @@ -14,8 +14,9 @@ module QA element :register_2fa_app_button end - view 'app/views/profiles/two_factor_auths/_codes.html.haml' do + view 'app/assets/javascripts/authentication/two_factor_auth/components/recovery_codes.vue' do element :proceed_button + element :copy_button element :codes_content element :code_content end @@ -43,7 +44,8 @@ module QA code_elements.map { |code_content| code_content.text } end - def click_proceed_button + def click_copy_and_proceed + click_element :copy_button click_element :proceed_button end end diff --git a/qa/qa/page/project/fork/new.rb b/qa/qa/page/project/fork/new.rb index e2f2e9330dd..bbdd4748f5c 100644 --- a/qa/qa/page/project/fork/new.rb +++ b/qa/qa/page/project/fork/new.rb @@ -9,9 +9,17 @@ module QA element :fork_namespace_button end + view 'app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list.vue' do + element :fork_groups_list_search_field + end + def choose_namespace(namespace = Runtime::Namespace.path) click_element(:fork_namespace_button, name: namespace) end + + def search_for_group(group_name) + find_element(:fork_groups_list_search_field).set(group_name) + end end end end diff --git a/qa/qa/page/project/import/github.rb b/qa/qa/page/project/import/github.rb index ad1746258ea..6890c7de9f8 100644 --- a/qa/qa/page/project/import/github.rb +++ b/qa/qa/page/project/import/github.rb @@ -12,7 +12,7 @@ module QA element :authenticate_button end - view 'app/assets/javascripts/import_projects/components/provider_repo_table_row.vue' do + view 'app/assets/javascripts/import_entities/import_projects/components/provider_repo_table_row.vue' do element :project_import_row element :project_namespace_select element :project_path_field 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/issue/show.rb b/qa/qa/page/project/issue/show.rb index f7bd74d1882..db2f5f9b3dc 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -14,7 +14,7 @@ module QA element :remove_related_issue_button end - view 'app/views/shared/issuable/_close_reopen_button.html.haml' do + view 'app/assets/javascripts/issue_show/components/header_actions.vue' do element :close_issue_button element :reopen_issue_button end diff --git a/qa/qa/page/project/operations/metrics/show.rb b/qa/qa/page/project/operations/metrics/show.rb index 35dfd92f119..6e8a52ab2e6 100644 --- a/qa/qa/page/project/operations/metrics/show.rb +++ b/qa/qa/page/project/operations/metrics/show.rb @@ -70,7 +70,7 @@ module QA end end - def duplicate_dashboard(save_as = 'test_duplication.yml', commit_option = 'Commit to master branch') + def duplicate_dashboard(save_as = 'test_duplication.yml', commit_option = 'Commit to default branch') click_element :actions_menu_dropdown click_on 'Duplicate current dashboard' fill_element :duplicate_dashboard_filename_field, "#{SecureRandom.hex(8)}-#{save_as}" diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index aff2378330a..0f5a7e8c801 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -22,15 +22,17 @@ module QA all_elements(:pipeline_url_link, minimum: 1, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).first.click end - def wait_for_latest_pipeline_success + def wait_for_latest_pipeline_succeeded wait_for_latest_pipeline_status { has_text?('passed') } end - def wait_for_latest_pipeline_completion + def wait_for_latest_pipeline_completed wait_for_latest_pipeline_status { has_text?('passed') || has_text?('failed') } end def wait_for_latest_pipeline_status + wait_until(max_duration: 30, reload: true, sleep_interval: 5) { has_pipeline? } + wait_until(reload: false, max_duration: 360) do within_element_by_index(:pipeline_commit_status, 0) { yield } end @@ -49,6 +51,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/settings/integrations.rb b/qa/qa/page/project/settings/integrations.rb index e18ff71bcb3..dd676c86486 100644 --- a/qa/qa/page/project/settings/integrations.rb +++ b/qa/qa/page/project/settings/integrations.rb @@ -6,8 +6,8 @@ module QA module Settings class Integrations < QA::Page::Base view 'app/views/shared/integrations/_index.html.haml' do - element :prometheus_link, '{ data: { qa_selector: "#{integration.to_param' # rubocop:disable QA/ElementWithPattern - element :jira_link, '{ data: { qa_selector: "#{integration.to_param' # rubocop:disable QA/ElementWithPattern + element :prometheus_link, 'data: { qa_selector: "#{integration.to_param' # rubocop:disable QA/ElementWithPattern + element :jira_link, 'data: { qa_selector: "#{integration.to_param' # rubocop:disable QA/ElementWithPattern end def click_on_prometheus_integration diff --git a/qa/qa/page/project/settings/protected_branches.rb b/qa/qa/page/project/settings/protected_branches.rb index 7315bfb76a5..6616921f34c 100644 --- a/qa/qa/page/project/settings/protected_branches.rb +++ b/qa/qa/page/project/settings/protected_branches.rb @@ -58,7 +58,7 @@ module QA allowed[:roles] = Resource::ProtectedBranch::Roles::NO_ONE unless allowed.key?(:roles) within_element(:"allowed_to_#{action}_dropdown") do - click_on allowed[:roles] + click_on allowed[:roles][:description] allowed[:users].each { |user| click_on user.username } if allowed.key?(:users) allowed[:groups].each { |group| click_on group.name } if allowed.key?(:groups) end diff --git a/qa/qa/page/project/settings/services/jenkins.rb b/qa/qa/page/project/settings/services/jenkins.rb new file mode 100644 index 00000000000..3d7da8d0161 --- /dev/null +++ b/qa/qa/page/project/settings/services/jenkins.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Settings + module Services + class Jenkins < QA::Page::Base + view 'app/assets/javascripts/integrations/edit/components/dynamic_field.vue' do + element :jenkins_url_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern + element :project_name_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern + element :username_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern + element :password_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern + end + + view 'app/assets/javascripts/integrations/edit/components/integration_form.vue' do + element :save_changes_button + end + + def setup_service_with(jenkins_url:, project_name:) + set_jenkins_url(jenkins_url) + set_project_name(project_name) + set_username('admin') + set_password('password') + click_save_changes_button + end + + private + + def set_jenkins_url(jenkins_url) + fill_element(:jenkins_url_field, jenkins_url) + end + + def set_project_name(project_name) + fill_element(:project_name_field, project_name) + end + + def set_username(username) + fill_element(:username_field, username) + end + + def set_password(password) + fill_element(:password_field, password) + end + + def click_save_changes_button + click_element :save_changes_button + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 4f0cf55c127..d2c258b90b5 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -34,6 +34,7 @@ module QA view 'app/views/projects/_home_panel.html.haml' do element :forked_from_link element :project_name_content + element :project_id_content end view 'app/views/projects/_files.html.haml' do @@ -157,6 +158,10 @@ module QA find_element(:project_name_content).text end + def project_id + find_element(:project_id_content).text.delete('Project ID: ') + end + def switch_to_branch(branch_name) find_element(:branches_select).click 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/page/registration/sign_up.rb b/qa/qa/page/registration/sign_up.rb new file mode 100644 index 00000000000..0fb4b466e62 --- /dev/null +++ b/qa/qa/page/registration/sign_up.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module QA + module Page + module Registration + class SignUp < Page::Base + view 'app/views/devise/shared/_signup_box.html.haml' do + element :new_user_first_name_field + element :new_user_last_name_field + element :new_user_username_field + element :new_user_email_field + element :new_user_password_field + element :new_user_register_button + end + + view 'app/views/registrations/welcome/show.html.haml' do + element :get_started_button + end + + def fill_new_user_first_name_field(first_name) + fill_element :new_user_first_name_field, first_name + end + + def fill_new_user_last_name_field(last_name) + fill_element :new_user_last_name_field, last_name + end + + def fill_new_user_username_field(username) + fill_element :new_user_username_field, username + end + + def fill_new_user_email_field(email) + fill_element :new_user_email_field, email + end + + def fill_new_user_password_field(password) + fill_element :new_user_password_field, password + end + + def click_new_user_register_button + click_element :new_user_register_button if has_element?(:new_user_register_button) + end + end + end + end +end diff --git a/qa/qa/page/registration/welcome.rb b/qa/qa/page/registration/welcome.rb new file mode 100644 index 00000000000..394e94b6414 --- /dev/null +++ b/qa/qa/page/registration/welcome.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module QA + module Page + module Registration + class Welcome < Page::Base + view 'app/views/registrations/welcome/show.html.haml' do + element :get_started_button + end + + def click_get_started_button_if_available + if has_element?(:get_started_button) + Support::Retrier.retry_until do + click_element :get_started_button + has_no_element?(:get_started_button) + end + end + end + end + end + end +end + +QA::Page::Registration::Welcome.prepend_if_ee('QA::EE::Page::Registration::Welcome') |