diff options
Diffstat (limited to 'qa/qa/page')
89 files changed, 1001 insertions, 1030 deletions
diff --git a/qa/qa/page/admin/applications.rb b/qa/qa/page/admin/applications.rb index 56880a4b22c..a2a9060273e 100644 --- a/qa/qa/page/admin/applications.rb +++ b/qa/qa/page/admin/applications.rb @@ -5,64 +5,64 @@ module QA module Admin class Applications < Page::Base view 'app/views/admin/applications/index.html.haml' do - element :new_application_button + element 'new-application-button' end view 'app/views/admin/applications/_form.html.haml' do - element :name_field - element :redirect_uri_field - element :trusted_checkbox - element :save_application_button + element 'name-field' + element 'redirect-uri-field' + element 'trusted-checkbox' + element 'save-application-button' end view 'app/views/shared/tokens/_scopes_form.html.haml' do - element :api_label, '#{scope}_label' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck + element 'api-label', '#{scope}-label' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck end view 'app/views/shared/doorkeeper/applications/_show.html.haml' do - element :application_id_field - element :id_of_application_field + element 'application-id-field' + element 'id-of-application-field' end view 'app/assets/javascripts/vue_shared/components/form/input_copy_toggle_visibility.vue' do - element :clipboard_button + element 'clipboard-button' end def click_new_application_button - click_element :new_application_button + click_element 'new-application-button' end def fill_name(name) - fill_element :name_field, name + fill_element 'name-field', name end def fill_redirect_uri(redirect_uri) - fill_element :redirect_uri_field, redirect_uri + fill_element 'redirect-uri-field', redirect_uri end def set_trusted_checkbox(value) - check_element :trusted_checkbox, value + check_element 'trusted-checkbox', value end def set_scope(scope) - click_element "#{scope}_label".to_sym + click_element "#{scope}-label".to_sym end def save_application - click_element :save_application_button + click_element 'save-application-button' end def get_secret_id - find_element(:clipboard_button)['data-clipboard-text'] + find_element('clipboard-button')['data-clipboard-text'] end def get_application_id - find_element(:application_id_field).value + find_element('application-id-field').value end # Returns the ID of the resource def get_id_of_application - find_element(:id_of_application_field, visible: false).value + find_element('id-of-application-field', visible: false).value end end end diff --git a/qa/qa/page/admin/menu.rb b/qa/qa/page/admin/menu.rb index 8fd813a5ddc..563650bbdf2 100644 --- a/qa/qa/page/admin/menu.rb +++ b/qa/qa/page/admin/menu.rb @@ -9,15 +9,15 @@ module QA include Sidebar::Settings view 'lib/sidebars/admin/menus/admin_overview_menu.rb' do - element :admin_overview_submenu_content + element 'admin-overview-submenu-content' end view 'lib/sidebars/admin/menus/analytics_menu.rb' do - element :admin_sidebar_analytics_submenu_content + element 'admin-sidebar-analytics-submenu-content' end view 'lib/sidebars/admin/menus/monitoring_menu.rb' do - element :admin_monitoring_menu_link + element 'admin-monitoring-menu-link' end def go_to_applications diff --git a/qa/qa/page/admin/new_session.rb b/qa/qa/page/admin/new_session.rb index 3d46bb7f186..3a2a863cc23 100644 --- a/qa/qa/page/admin/new_session.rb +++ b/qa/qa/page/admin/new_session.rb @@ -5,16 +5,16 @@ module QA module Admin class NewSession < Page::Base view 'app/views/admin/sessions/_new_base.html.haml' do - element :enter_admin_mode_button - element :password_field + element 'enter-admin-mode-button' + element 'password-field' end def set_password(password) - fill_element :password_field, password + fill_element 'password-field', password end def click_enter_admin_mode - click_element :enter_admin_mode_button + click_element 'enter-admin-mode-button' end end end diff --git a/qa/qa/page/admin/settings/component/account_and_limit.rb b/qa/qa/page/admin/settings/component/account_and_limit.rb index a61c8cc77cd..96f76fead84 100644 --- a/qa/qa/page/admin/settings/component/account_and_limit.rb +++ b/qa/qa/page/admin/settings/component/account_and_limit.rb @@ -7,16 +7,16 @@ module QA module Component class AccountAndLimit < Page::Base view 'app/views/admin/application_settings/_account_and_limit.html.haml' do - element :receive_max_input_size_field - element :save_changes_button + element 'receive-max-input-size-field' + element 'save-changes-button' end def set_max_file_size(size) - fill_element :receive_max_input_size_field, size + fill_element 'receive-max-input-size-field', size end def save_settings - click_element :save_changes_button + click_element 'save-changes-button' end end end diff --git a/qa/qa/page/admin/settings/component/ip_limits.rb b/qa/qa/page/admin/settings/component/ip_limits.rb index a85b96014b3..1c75e7d3884 100644 --- a/qa/qa/page/admin/settings/component/ip_limits.rb +++ b/qa/qa/page/admin/settings/component/ip_limits.rb @@ -7,22 +7,22 @@ module QA module Component class IpLimits < Page::Base view 'app/views/admin/application_settings/_ip_limits.html.haml' do - element :throttle_unauthenticated_api_checkbox - element :throttle_unauthenticated_web_checkbox - element :throttle_authenticated_api_checkbox - element :throttle_authenticated_web_checkbox - element :save_changes_button + element 'throttle-unauthenticated-api-checkbox' + element 'throttle-unauthenticated-web-checkbox' + element 'throttle-authenticated-api-checkbox' + element 'throttle-authenticated-web-checkbox' + element 'save-changes-button' end def enable_throttles - check_element(:throttle_unauthenticated_api_checkbox, true) - check_element(:throttle_unauthenticated_web_checkbox, true) - check_element(:throttle_authenticated_api_checkbox, true) - check_element(:throttle_authenticated_web_checkbox, true) + check_element('throttle-unauthenticated-api-checkbox', true) + check_element('throttle-unauthenticated-web-checkbox', true) + check_element('throttle-authenticated-api-checkbox', true) + check_element('throttle-authenticated-web-checkbox', true) end def save_settings - click_element :save_changes_button + click_element 'save-changes-button' end end end diff --git a/qa/qa/page/admin/settings/component/outbound_requests.rb b/qa/qa/page/admin/settings/component/outbound_requests.rb index c812c05f9c1..4b8bafc8096 100644 --- a/qa/qa/page/admin/settings/component/outbound_requests.rb +++ b/qa/qa/page/admin/settings/component/outbound_requests.rb @@ -7,8 +7,8 @@ module QA module Component class OutboundRequests < Page::Base view 'app/views/admin/application_settings/_outbound.html.haml' do - element :allow_requests_from_services_checkbox - element :save_changes_button + element 'allow-requests-from-services-checkbox' + element 'save-changes-button' end def allow_requests_to_local_network_from_services @@ -19,11 +19,11 @@ module QA private def check_allow_requests_to_local_network_from_services_checkbox - check_element(:allow_requests_from_services_checkbox) + check_element('allow-requests-from-services-checkbox') end def click_save_changes_button - click_element :save_changes_button + click_element 'save-changes-button' end end end diff --git a/qa/qa/page/admin/settings/component/performance_bar.rb b/qa/qa/page/admin/settings/component/performance_bar.rb index ebf0e744b5e..c0b5aa692c2 100644 --- a/qa/qa/page/admin/settings/component/performance_bar.rb +++ b/qa/qa/page/admin/settings/component/performance_bar.rb @@ -7,17 +7,17 @@ module QA module Component class PerformanceBar < Page::Base view 'app/views/admin/application_settings/_performance_bar.html.haml' do - element :enable_performance_bar_checkbox - element :save_changes_button + element 'enable-performance-bar-checkbox' + element 'save-changes-button' end def enable_performance_bar - check_element(:enable_performance_bar_checkbox, true) + check_element('enable-performance-bar-checkbox', true) Capybara.current_session.driver.browser.manage.add_cookie(name: 'perf_bar_enabled', value: 'true') end def save_settings - click_element :save_changes_button + click_element 'save-changes-button' 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 index 8b0d420d00a..ec918d06366 100644 --- a/qa/qa/page/admin/settings/component/sign_up_restrictions.rb +++ b/qa/qa/page/admin/settings/component/sign_up_restrictions.rb @@ -7,19 +7,19 @@ module QA module Component class SignUpRestrictions < Page::Base view 'app/assets/javascripts/pages/admin/application_settings/general/components/signup_form.vue' do - element :require_admin_approval_after_user_signup_checkbox - element :signup_enabled_checkbox - element :save_changes_button + element 'require-admin-approval-checkbox' + element 'signup-enabled-checkbox' + element 'save-changes-button' end def require_admin_approval_after_user_signup - click_element_coordinates(:require_admin_approval_after_user_signup_checkbox, visible: false) - click_element(:save_changes_button) + click_element_coordinates('require-admin-approval-after-user-signup-checkbox', visible: false) + click_element('save-changes-button') end def disable_signups - click_element_coordinates(:signup_enabled_checkbox, visible: false) - click_element(:save_changes_button) + click_element_coordinates('signup-enabled-checkbox', visible: false) + click_element('save-changes-button') end end end diff --git a/qa/qa/page/admin/settings/component/snowplow.rb b/qa/qa/page/admin/settings/component/snowplow.rb index c7f103e29a8..da2d3253ea7 100644 --- a/qa/qa/page/admin/settings/component/snowplow.rb +++ b/qa/qa/page/admin/settings/component/snowplow.rb @@ -9,20 +9,20 @@ module QA include QA::Page::Settings::Common view 'app/views/admin/application_settings/_snowplow.html.haml' do - element :snowplow_settings_content - element :snowplow_enabled_checkbox - element :save_changes_button + element 'snowplow-settings-content' + element 'snowplow-enabled-checkbox' + element 'save-changes-button' end def enable_snowplow_tracking - expand_content(:snowplow_settings_content) do + expand_content('snowplow-settings-content') do check_snowplow_enabled_checkbox click_save_changes_button end end def disable_snowplow_tracking - expand_content(:snowplow_settings_content) do + expand_content('snowplow-settings-content') do uncheck_snowplow_enabled_checkbox click_save_changes_button end @@ -31,15 +31,15 @@ module QA private def check_snowplow_enabled_checkbox - check_element(:snowplow_enabled_checkbox, true) + check_element('snowplow-enabled-checkbox', true) end def uncheck_snowplow_enabled_checkbox - uncheck_element(:snowplow_enabled_checkbox, true) + uncheck_element('snowplow-enabled-checkbox', true) end def click_save_changes_button - click_element :save_changes_button + click_element 'save-changes-button' end end end diff --git a/qa/qa/page/admin/settings/component/usage_statistics.rb b/qa/qa/page/admin/settings/component/usage_statistics.rb index c296e63e28e..d11eff5b5f9 100644 --- a/qa/qa/page/admin/settings/component/usage_statistics.rb +++ b/qa/qa/page/admin/settings/component/usage_statistics.rb @@ -7,11 +7,11 @@ module QA module Component class UsageStatistics < Page::Base view 'app/views/admin/application_settings/_usage.html.haml' do - element :enable_usage_data_checkbox + element 'enable-usage-data-checkbox' end def has_disabled_usage_data_checkbox? - has_element?(:enable_usage_data_checkbox, disabled: true, visible: false) + has_element?('enable-usage-data-checkbox', disabled: true, visible: false) end end end diff --git a/qa/qa/page/admin/settings/general.rb b/qa/qa/page/admin/settings/general.rb index a2457dded7c..599705bd714 100644 --- a/qa/qa/page/admin/settings/general.rb +++ b/qa/qa/page/admin/settings/general.rb @@ -8,18 +8,18 @@ module QA include QA::Page::Settings::Common view 'app/views/admin/application_settings/general.html.haml' do - element :account_and_limit_settings_content - element :sign_up_restrictions_settings_content + element 'account-and-limit-settings-content' + element 'sign-up-restrictions-settings-content' end def expand_account_and_limit(&block) - expand_content(:account_and_limit_settings_content) do + expand_content('account-and-limit-settings-content') do Component::AccountAndLimit.perform(&block) end end def expand_sign_up_restrictions(&block) - expand_content(:sign_up_restrictions_settings_content) do + expand_content('sign-up-restrictions-settings-content') do Component::SignUpRestrictions.perform(&block) end end diff --git a/qa/qa/page/admin/settings/metrics_and_profiling.rb b/qa/qa/page/admin/settings/metrics_and_profiling.rb index 7224e51e110..aa2399ba810 100644 --- a/qa/qa/page/admin/settings/metrics_and_profiling.rb +++ b/qa/qa/page/admin/settings/metrics_and_profiling.rb @@ -8,12 +8,12 @@ module QA include QA::Page::Settings::Common view 'app/views/admin/application_settings/metrics_and_profiling.html.haml' do - element :performance_bar_settings_content + element 'performance-bar-settings-content' element :usage_statistics_settings_content end def expand_performance_bar(&block) - expand_content(:performance_bar_settings_content) do + expand_content('performance-bar-settings-content') do Component::PerformanceBar.perform(&block) end end diff --git a/qa/qa/page/admin/settings/network.rb b/qa/qa/page/admin/settings/network.rb index 253904788e3..ccd7bc3a4dd 100644 --- a/qa/qa/page/admin/settings/network.rb +++ b/qa/qa/page/admin/settings/network.rb @@ -8,18 +8,18 @@ module QA include QA::Page::Settings::Common view 'app/views/admin/application_settings/network.html.haml' do - element :ip_limits_content - element :outbound_requests_content + element 'ip-limits-content' + element 'outbound-requests-content' end def expand_ip_limits(&block) - expand_content(:ip_limits_content) do + expand_content('ip-limits-content') do Component::IpLimits.perform(&block) end end def expand_outbound_requests(&block) - expand_content(:outbound_requests_content) do + expand_content('outbound-requests-content') do Component::OutboundRequests.perform(&block) end end diff --git a/qa/qa/page/blame/show.rb b/qa/qa/page/blame/show.rb index 42fb217d2df..39117efb2a5 100644 --- a/qa/qa/page/blame/show.rb +++ b/qa/qa/page/blame/show.rb @@ -9,7 +9,7 @@ module QA end view 'app/views/projects/blame/show.html.haml' do - element :blame_file_content + element 'blob-content-holder' end def has_file?(file_name) @@ -23,11 +23,11 @@ module QA end def has_file_content?(file_content) - within_element(:blame_file_content) { has_text?(file_content) } + within_element('blob-content-holder') { has_text?(file_content) } end def has_no_file_content?(file_content) - within_element(:blame_file_content) do + within_element('blob-content-holder') do has_no_text?(file_content) end end diff --git a/qa/qa/page/component/access_tokens.rb b/qa/qa/page/component/access_tokens.rb index 0732e0b8a89..c80df535aba 100644 --- a/qa/qa/page/component/access_tokens.rb +++ b/qa/qa/page/component/access_tokens.rb @@ -24,7 +24,7 @@ module QA end base.view 'app/views/shared/tokens/_scopes_form.html.haml' do - element :api_label, '#{scope}_label' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck + element 'api-label', '#{scope}-label' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck end base.view 'app/assets/javascripts/access_tokens/components/new_access_token_app.vue' do @@ -66,7 +66,7 @@ module QA end def check_api - click_element(:api_label) + click_element('api-label') end def click_create_token_button diff --git a/qa/qa/page/component/badges.rb b/qa/qa/page/component/badges.rb index 9d2959c010e..8c0907d17b4 100644 --- a/qa/qa/page/component/badges.rb +++ b/qa/qa/page/component/badges.rb @@ -16,12 +16,12 @@ module QA end view 'app/assets/javascripts/badges/components/badge_list.vue' do - element :badge_list_content - element :badge_list + element 'badge-list-content' + element 'badge-list' end view 'app/assets/javascripts/badges/components/badge.vue' do - element :badge_image_link + element 'badge-image-link' end def show_badge_add_form @@ -45,14 +45,14 @@ module QA end def has_badge?(badge_name) - within_element(:badge_list_content) do - has_element?(:badge_list, text: badge_name) + within_element('badge-list-content') do + has_element?('badge-list', text: badge_name) end end def has_visible_badge_image_link?(link_url) - within_element(:badge_list_content) do - has_element?(:badge_image_link, link_url: link_url) + within_element('badge-list-content') do + has_element?('badge-image-link', link_url: link_url) end end end diff --git a/qa/qa/page/component/blob_content.rb b/qa/qa/page/component/blob_content.rb index a57ef38f768..fda7064a37b 100644 --- a/qa/qa/page/component/blob_content.rb +++ b/qa/qa/page/component/blob_content.rb @@ -10,20 +10,20 @@ module QA super base.view 'app/assets/javascripts/blob/components/blob_header_filepath.vue' do - element :file_title_content + element 'file-title-content' end base.view 'app/assets/javascripts/blob/components/blob_content.vue' do - element :blob_viewer_file_content + element 'blob-viewer-file-content' end base.view 'app/assets/javascripts/blob/components/blob_header_default_actions.vue' do - element :default_actions_container - element :copy_contents_button + element 'default-actions-container' + element 'copy-contents-button' end base.view 'app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue' do - element :blob_viewer_file_content + element 'blob-viewer-file-content' end end @@ -36,30 +36,30 @@ module QA end def has_file_name?(file_name, file_number = nil) - within_file_by_number(:file_title_content, file_number) { has_text?(file_name) } + within_file_by_number('file-title-content', file_number) { has_text?(file_name) } end def has_no_file_name?(file_name) - within_element(:file_title_content) do + within_element('file-title-content') do has_no_text?(file_name) end end def has_file_content?(file_content, file_number = nil) - within_file_by_number(:blob_viewer_file_content, file_number) { has_text?(file_content) } + within_file_by_number('blob-viewer-file-content', file_number) { has_text?(file_content) } end def has_no_file_content?(file_content) - within_element(:blob_viewer_file_content) do + within_element('blob-viewer-file-content') do has_no_text?(file_content) end end def has_normalized_ws_text?(text, wait: Capybara.default_max_wait_time) - if has_element?(:blob_viewer_file_content, wait: 1) + if has_element?('blob-viewer-file-content', wait: 1) # The blob viewer renders line numbers and whitespace in a way that doesn't match the source file # This isn't a visual validation test, so we ignore line numbers and whitespace - find_element(:blob_viewer_file_content, wait: 0).text.gsub(/^\d+\s|\s*/, '') + find_element('blob-viewer-file-content', wait: 0).text.gsub(/^\d+\s|\s*/, '') .start_with?(text.gsub(/\s*/, '')) else has_text?(text.gsub(/\s+/, " "), wait: wait) @@ -67,7 +67,7 @@ module QA end def click_copy_file_contents(file_number = nil) - within_file_by_number(:default_actions_container, file_number) { click_element(:copy_contents_button) } + within_file_by_number('default-actions-container', file_number) { click_element('copy-contents-button') } end private diff --git a/qa/qa/page/component/breadcrumbs.rb b/qa/qa/page/component/breadcrumbs.rb index f2343da489e..08faea0c760 100644 --- a/qa/qa/page/component/breadcrumbs.rb +++ b/qa/qa/page/component/breadcrumbs.rb @@ -10,12 +10,12 @@ module QA super base.view 'app/views/layouts/nav/breadcrumbs/_breadcrumbs.html.haml' do - element :breadcrumb_links_content + element 'breadcrumb-links' end end def has_breadcrumb?(text) - has_element?(:breadcrumb_links_content, text: text) + has_element?('breadcrumb-links', text: text) end end end diff --git a/qa/qa/page/component/ci_badge_link.rb b/qa/qa/page/component/ci_badge_link.rb index 0fddd1cbf12..d0a40b4bfbe 100644 --- a/qa/qa/page/component/ci_badge_link.rb +++ b/qa/qa/page/component/ci_badge_link.rb @@ -6,24 +6,24 @@ module QA module CiBadgeLink extend QA::Page::PageConcern - COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running - INCOMPLETE_STATUSES = %w[pending created running].freeze + COMPLETED_STATUSES = %w[Passed Failed Canceled Blocked Skipped Manual].freeze # excludes Created, Pending, Running + INCOMPLETE_STATUSES = %w[Pending Created Running].freeze - # e.g. def passed?(timeout: nil); status_badge == 'passed'; end + # e.g. def passed?(timeout: nil); status_badge == 'Passed'; end COMPLETED_STATUSES.map do |status| - define_method "#{status}?" do |timeout: nil| + define_method "#{status.downcase}?" do |timeout: nil| timeout ? completed?(timeout: timeout) : completed? status_badge == status end # has_passed? => passed? # has_failed? => failed? - alias_method :"has_#{status}?", :"#{status}?" + alias_method :"has_#{status.downcase}?", :"#{status.downcase}?" end - # e.g. def pending?; status_badge == 'pending'; end + # e.g. def pending?; status_badge == 'Pending'; end INCOMPLETE_STATUSES.map do |status| - define_method "#{status}?" do + define_method "#{status.downcase}?" do status_badge == status end end @@ -32,12 +32,13 @@ module QA super base.view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do - element 'ci-badge-link' + element 'ci-badge-text' end end def status_badge - find_element('ci-badge-link').text + # There are more than 1 on job details page + all_elements('ci-badge-text', minimum: 1).first.text end def completed?(timeout: 60) diff --git a/qa/qa/page/component/content_editor.rb b/qa/qa/page/component/content_editor.rb index f2733e4b065..d5f93bbc8c9 100644 --- a/qa/qa/page/component/content_editor.rb +++ b/qa/qa/page/component/content_editor.rb @@ -10,41 +10,41 @@ module QA super base.view 'app/assets/javascripts/content_editor/components/content_editor.vue' do - element :content_editor_container + element 'content-editor' end - base.view 'app/assets/javascripts/content_editor/components/toolbar_text_style_dropdown.vue' do - element :text_style_dropdown + base.view 'app/assets/javascripts/content_editor/components/formatting_toolbar.vue' do + element 'text-styles' end base.view 'app/assets/javascripts/content_editor/components/toolbar_attachment_button.vue' do - element :file_upload_field + element 'file-upload-field' end base.view 'app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue' do - element :markdown_editor_form_field + element 'markdown-editor-form-field' end end def add_heading(heading, text) - within_element(:content_editor_container) do + within_element('content-editor') do text_area.set(text) # wait for text style option to become active after typing - has_active_element?(:text_style_dropdown, wait: 1) - click_element(:text_style_dropdown) - find_element(:text_style_dropdown).find('li', text: heading).click + has_active_element?('text-styles', wait: 1) + click_element('text-styles') + find_element('.gl-new-dropdown-contents li', text: heading).click end end def upload_image(image_path) - within_element(:content_editor_container) do + within_element('content-editor') do # add image on a new line text_area.send_keys(:return) - find_element(:file_upload_field, visible: false).send_keys(image_path) + find_element('file-upload-field', visible: false).send_keys(image_path) end QA::Support::Retrier.retry_on_exception do - source = find_element(:markdown_editor_form_field, visible: false) + source = find_element('markdown-editor-form-field', visible: false) source.value =~ %r{uploads/.*#{::File.basename(image_path)}} end end diff --git a/qa/qa/page/component/import/gitlab.rb b/qa/qa/page/component/import/gitlab.rb index 5831a713ae5..1cb8a099a70 100644 --- a/qa/qa/page/component/import/gitlab.rb +++ b/qa/qa/page/component/import/gitlab.rb @@ -32,7 +32,7 @@ module QA click_element(:import_project_button) wait_until(reload: false) do - has_notice?("The project was successfully imported.") || has_element?(:project_name_content) + has_notice?("The project was successfully imported.") || has_element?('project-name-content') end end end diff --git a/qa/qa/page/component/issuable/common.rb b/qa/qa/page/component/issuable/common.rb index 526f8763488..9c452cc2b69 100644 --- a/qa/qa/page/component/issuable/common.rb +++ b/qa/qa/page/component/issuable/common.rb @@ -13,6 +13,14 @@ module QA base.view 'app/assets/javascripts/issues/show/components/title.vue' do element 'issue-title', required: true end + + base.view 'app/assets/javascripts/related_issues/components/add_issuable_form.vue' do + element 'add-issue-button' + end + + base.view 'app/assets/javascripts/related_issues/components/related_issuable_input.vue' do + element 'add-issue-field' + end end end end diff --git a/qa/qa/page/component/issuable/sidebar.rb b/qa/qa/page/component/issuable/sidebar.rb index 680f1d41a5e..daa0124fbd0 100644 --- a/qa/qa/page/component/issuable/sidebar.rb +++ b/qa/qa/page/component/issuable/sidebar.rb @@ -11,23 +11,23 @@ module QA super base.view 'app/assets/javascripts/sidebar/components/assignees/assignee_avatar.vue' do - element :avatar_image + element 'avatar-image' end base.view 'app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue' do - element :more_assignees_link + element 'user-list-more-button' end base.view 'app/assets/javascripts/sidebar/components/reviewers/reviewer_title.vue' do - element :reviewers_edit_button + element 'reviewers-edit-button' end base.view 'app/assets/javascripts/sidebar/components/labels/labels_select_widget/labels_select_root.vue' do - element :labels_block + element 'sidebar-labels' end base.view 'app/assets/javascripts/sidebar/components/labels/labels_select_vue/dropdown_contents_labels_view.vue' do - element :dropdown_input_field + element 'dropdown-input-field' end base.view 'app/assets/javascripts/sidebar/components/labels/labels_select_widget/dropdown_contents.vue' do @@ -35,17 +35,17 @@ module QA end base.view 'app/assets/javascripts/sidebar/components/labels/labels_select_widget/dropdown_value.vue' do - element :selected_label_content + element 'selected-label-content' end base.view 'app/views/shared/issuable/_sidebar.html.haml' do - element :assignee_block_container - element :milestone_block - element :reviewers_block_container + element 'assignee-block-container' + element 'sidebar-milestones' + element 'reviewers-block-container' end base.view 'app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue' do - element :milestone_link, 'data-qa-selector="`${formatIssuableAttribute.snake}_link`"' # rubocop:disable QA/ElementWithPattern + element 'milestone-link', 'data-testid="`${formatIssuableAttribute.kebab}-link`"' # rubocop:disable QA/ElementWithPattern end base.view 'app/assets/javascripts/sidebar/components/sidebar_editable_item.vue' do @@ -53,7 +53,7 @@ module QA end base.view 'app/helpers/dropdowns_helper.rb' do - element :dropdown_list_content + element 'dropdown-list-content' end end @@ -64,14 +64,14 @@ module QA end wait_until(reload: false) do - has_element?(:milestone_block, text: milestone.title, wait: 0) + has_element?('sidebar-milestones', text: milestone.title, wait: 0) end refresh end def click_milestone_link - click_element(:milestone_link) + click_element('milestone-link') end def has_assignee?(username) @@ -106,39 +106,39 @@ module QA def has_avatar_image_count?(count) wait_assignees_block_finish_loading do - all_elements(:avatar_image, count: count) + all_elements('avatar-image', count: count) end end def has_label?(label) wait_labels_block_finish_loading do - has_element?(:selected_label_content, label_name: label) + has_element?('selected-label-content', label_name: label) end end def has_no_label?(label) wait_labels_block_finish_loading do - has_no_element?(:selected_label_content, label_name: label) + has_no_element?('selected-label-content', label_name: label) end end def has_milestone?(milestone_title) wait_milestone_block_finish_loading do - has_element?(:milestone_link, text: milestone_title) + has_element?('milestone-link', text: milestone_title) end end def more_assignees_link - find_element(:more_assignees_link) + find_element('user-list-more-button') end def select_labels(labels) - within_element(:labels_block) do + within_element('sidebar-labels') do click_element('edit-button') labels.each do |label| within_element('labels-select-dropdown-contents') do - fill_element(:dropdown_input_field, label) + fill_element('dropdown-input-field', label) click_button(text: label) end end @@ -148,21 +148,21 @@ module QA end def toggle_more_assignees_link - click_element(:more_assignees_link) + click_element('user-list-more-button') end def toggle_reviewers_edit - click_element(:reviewers_edit_button) + click_element('reviewers-edit-button') end def suggested_reviewer_usernames - within_element(:reviewers_block_container) do + within_element('reviewers-block-container') do wait_for_requests - click_element(:reviewers_edit_button) + click_element('reviewers-edit-button') wait_for_requests - list = find_element(:dropdown_list_content) + list = find_element('dropdown-list-content') suggested_reviewers = list.find_all('li[data-user-suggested="true"') raise ElementNotFound, 'No suggested reviewers found' if suggested_reviewers.nil? @@ -177,10 +177,10 @@ module QA end def unassign_reviewers - within_element(:reviewers_block_container) do + within_element('reviewers-block-container') do wait_for_requests - click_element(:reviewers_edit_button) + click_element('reviewers-edit-button') wait_for_requests end @@ -188,12 +188,12 @@ module QA end def select_reviewer(username) - within_element(:reviewers_block_container) do - within_element(:dropdown_list_content) do + within_element('reviewers-block-container') do + within_element('dropdown-list-content') do click_on username end - click_element(:reviewers_edit_button) + click_element('reviewers-edit-button') wait_for_requests end end @@ -201,7 +201,7 @@ module QA private def wait_assignees_block_finish_loading - within_element(:assignee_block_container) do + within_element('assignee-block-container') do wait_until(reload: false, max_duration: 10, sleep_interval: 1) do finished_loading_block? yield @@ -210,7 +210,7 @@ module QA end def wait_reviewers_block_finish_loading - within_element(:reviewers_block_container) do + within_element('reviewers-block-container') do wait_until(reload: false, max_duration: 10, sleep_interval: 1) do finished_loading_block? yield @@ -219,7 +219,7 @@ module QA end def wait_labels_block_finish_loading - within_element(:labels_block) do + within_element('sidebar-labels') do wait_until(reload: false, max_duration: 10, sleep_interval: 1) do finished_loading_block? yield @@ -228,7 +228,7 @@ module QA end def wait_milestone_block_finish_loading - within_element(:milestone_block) do + within_element('sidebar-milestones') do wait_until(reload: false, max_duration: 10, sleep_interval: 1) do finished_loading_block? yield diff --git a/qa/qa/page/component/issue_board/show.rb b/qa/qa/page/component/issue_board/show.rb index 2259a65b546..6fbe2b7036c 100644 --- a/qa/qa/page/component/issue_board/show.rb +++ b/qa/qa/page/component/issue_board/show.rb @@ -6,109 +6,112 @@ module QA module IssueBoard class Show < QA::Page::Base view 'app/assets/javascripts/boards/components/board_card.vue' do - element :board_card + element 'board-card' + end + + view 'app/assets/javascripts/boards/components/board_column.vue' do + element 'board-list' end view 'app/assets/javascripts/boards/components/board_form.vue' do - element :board_name_field - element :save_changes_button + element 'board-name-field' + element 'save-changes-button' end view 'app/assets/javascripts/boards/components/board_list.vue' do - element :board_list_cards_area + element 'board-list-cards-area' + end + + view 'app/assets/javascripts/boards/components/board_list_header.vue' do + element 'board-list-header' end view 'app/assets/javascripts/boards/components/boards_selector.vue' do - element :boards_dropdown - element :boards_dropdown_content - element :create_new_board_button + element 'boards-dropdown' + element 'create-new-board-button' end view 'app/assets/javascripts/boards/components/board_content.vue' do - element :boards_list + element 'boards-list' end view 'app/assets/javascripts/boards/components/toggle_focus.vue' do - element :focus_mode_button + element 'focus-mode-button' end view 'app/assets/javascripts/boards/components/config_toggle.vue' do - element :boards_config_button + element 'boards-config-button' end # The `focused_board` method does not use `find_element` with an element defined - # with the attribute `data-qa-selector` since such element is not unique when the + # with the attribute `data-testid` since such element is not unique when the # `is-focused` class is not set, and it was not possible to find a better solution. def focused_board find('.issue-boards-content.js-focus-mode-board.is-focused') end def boards_dropdown - find_element(:boards_dropdown) - end - - def boards_dropdown_content - find_element(:boards_dropdown_content) + find_element('boards-dropdown') end def boards_list_cards_area_with_index(index) wait_boards_list_finish_loading do - within_element_by_index(:board_list, index) do - find_element(:board_list_cards_area) + within_element_by_index('board-list', index) do + find_element('board-list-cards-area') end end end def boards_list_header_with_index(index) wait_boards_list_finish_loading do - within_element_by_index(:board_list, index) do - find_element(:board_list_header) + within_element_by_index('board-list', index) do + find_element('board-list-header') end end end def card_of_list_with_index(index) wait_boards_list_finish_loading do - within_element_by_index(:board_list, index) do - find_element(:board_card) + within_element_by_index('board-list', index) do + find_element('board-card') end end end def click_boards_config_button - click_element(:boards_config_button) + click_element('boards-config-button') wait_for_requests end def click_boards_dropdown_button # The dropdown button comes from the `GlDropdown` component of `@gitlab/ui`, # so it wasn't possible to add a `data-qa-selector` to it. - find_element(:boards_dropdown).find('button').click + find_element('boards-dropdown').find('button').click end def click_focus_mode_button - click_element(:focus_mode_button) + click_element('focus-mode-button') end def create_new_board(board_name) click_boards_dropdown_button - click_element(:create_new_board_button) + click_element('create-new-board-button') set_name(board_name) end def has_modal_board_name_field? - has_element?(:board_name_field, wait: 1) + has_element?('board-name-field', wait: 1) end def set_name(name) - find_element(:board_name_field).set(name) - click_element(:save_changes_button) + find_element('board-name-field').set(name) + click_element('save-changes-button') end private def wait_boards_list_finish_loading - within_element(:boards_list) do + within_element('boards-list') do wait_until(reload: false, max_duration: 5, sleep_interval: 1) do finished_loading? && (block_given? ? yield : true) end diff --git a/qa/qa/page/component/lazy_loader.rb b/qa/qa/page/component/lazy_loader.rb index 1b166efbbff..2e2d99b28d5 100644 --- a/qa/qa/page/component/lazy_loader.rb +++ b/qa/qa/page/component/lazy_loader.rb @@ -10,7 +10,7 @@ module QA super base.view 'app/views/layouts/_img_loader.html.haml' do - element :js_lazy_loaded_content + element 'js-lazy-loaded-content' end end end diff --git a/qa/qa/page/component/legacy_clone_panel.rb b/qa/qa/page/component/legacy_clone_panel.rb index 8c3c25f6e41..2534865c2f4 100644 --- a/qa/qa/page/component/legacy_clone_panel.rb +++ b/qa/qa/page/component/legacy_clone_panel.rb @@ -10,9 +10,9 @@ module QA super base.view 'app/views/shared/_clone_panel.html.haml' do - element :clone_dropdown - element :clone_dropdown_content - element :clone_url_content + element 'clone-dropdown' + element 'clone-dropdown-content' + element 'clone-url-content' end end @@ -28,16 +28,16 @@ module QA end def repository_location - Git::Location.new(find_element(:clone_url_content).value) + Git::Location.new(find_element('clone-url-content').value) end private def choose_repository_clone(kind, detect_text) wait_until(reload: false) do - click_element :clone_dropdown + click_element 'clone-dropdown' - within_element(:clone_dropdown_content) do + within_element('clone-dropdown-content') do click_link(kind) end diff --git a/qa/qa/page/component/members/invite_members_modal.rb b/qa/qa/page/component/members/invite_members_modal.rb index ae51213b3e2..b9d0b382ba1 100644 --- a/qa/qa/page/component/members/invite_members_modal.rb +++ b/qa/qa/page/component/members/invite_members_modal.rb @@ -14,7 +14,7 @@ module QA base.view 'app/assets/javascripts/invite_members/components/invite_modal_base.vue' do element :invite_button element :access_level_dropdown - element :invite_members_modal_content + element 'invite-modal' end base.view 'app/assets/javascripts/invite_members/components/members_token_select.vue' do @@ -41,7 +41,7 @@ module QA def add_member(username, access_level = 'Developer', refresh_page: true) open_invite_members_modal - within_element(:invite_members_modal_content) do + within_element('invite-modal') do fill_element(:members_token_select_input, username) Support::WaitForRequests.wait_for_requests click_button(username, match: :prefer_exact) @@ -54,7 +54,7 @@ module QA def invite_group(group_name, access_level = 'Guest', refresh_page: true) open_invite_group_modal - within_element(:invite_members_modal_content) do + within_element('invite-modal') do click_button 'Select a group' Support::WaitForRequests.wait_for_requests diff --git a/qa/qa/page/component/members/members_filter.rb b/qa/qa/page/component/members/members_filter.rb index 8803211ea86..e6e75af6ba0 100644 --- a/qa/qa/page/component/members/members_filter.rb +++ b/qa/qa/page/component/members/members_filter.rb @@ -11,14 +11,15 @@ module QA super base.view 'app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue' do - element :search_bar_input - element :search_button + element 'search-button' end end def search_member(username) - fill_element :search_bar_input, username - click_element :search_button + filter_input = find('.gl-filtered-search-term-input') + filter_input.click + filter_input.set(username) + click_element 'search-button' end end end diff --git a/qa/qa/page/component/members/members_table.rb b/qa/qa/page/component/members/members_table.rb index 5add3a0ac7d..8bc20da83af 100644 --- a/qa/qa/page/component/members/members_table.rb +++ b/qa/qa/page/component/members/members_table.rb @@ -27,11 +27,11 @@ module QA end base.view 'app/assets/javascripts/members/components/action_dropdowns/user_action_dropdown.vue' do - element :user_action_dropdown + element 'user-action-dropdown' end base.view 'app/assets/javascripts/members/components/action_dropdowns/remove_member_dropdown_item.vue' do - element :delete_member_dropdown_item + element 'delete-member-dropdown-item' end base.view 'app/assets/javascripts/members/components/action_buttons/approve_access_request_button.vue' do @@ -39,7 +39,7 @@ module QA end base.view 'app/assets/javascripts/members/components/members_tabs.vue' do - element :groups_list_tab + element 'groups-list-tab' end base.view 'app/assets/javascripts/members/components/action_buttons/remove_group_link_button.vue' do @@ -60,8 +60,8 @@ module QA def remove_member(username) within_element(:member_row, text: username) do - click_element :user_action_dropdown - click_element :delete_member_dropdown_item + click_element 'user-action-dropdown' + click_element 'delete-member-dropdown-item' end confirm_remove_member @@ -82,7 +82,7 @@ module QA end def remove_group(group_name) - click_element :groups_list_tab + click_element 'groups-list-tab' within_element(:member_row, text: group_name) do click_element :remove_group_link_button @@ -92,7 +92,7 @@ module QA end def has_group?(group_name) - click_element :groups_list_tab + click_element 'groups-list-tab' has_element?(:member_row, text: group_name) end end diff --git a/qa/qa/page/component/new_snippet.rb b/qa/qa/page/component/new_snippet.rb index 9c4408e36e4..b939c2ca750 100644 --- a/qa/qa/page/component/new_snippet.rb +++ b/qa/qa/page/component/new_snippet.rb @@ -10,60 +10,60 @@ module QA super base.view 'app/assets/javascripts/snippets/components/edit.vue' do - element :snippet_title_field, required: true - element :submit_button + element 'snippet-title-input-field', required: true + element 'submit-button' end base.view 'app/assets/javascripts/snippets/components/snippet_description_edit.vue' do - element :snippet_description_field - element :description_placeholder, required: true + element 'snippet-description-field' + element 'description-placeholder', required: true end base.view 'app/assets/javascripts/snippets/components/snippet_blob_edit.vue' do - element :file_name_field - element :file_holder_container + element 'file-name-field' + element 'file-holder-container' end base.view 'app/assets/javascripts/snippets/components/snippet_blob_actions_edit.vue' do - element :add_file_button + element 'add-button' end base.view 'app/views/shared/_zen.html.haml' do # This 'element' is here only to ensure the changes in the view source aren't mistakenly changed - element :_, "qa_selector = local_assigns.fetch(:qa_selector, '')" # rubocop:disable QA/ElementWithPattern + element :_, "testid = local_assigns.fetch(:testid, '')" # rubocop:disable QA/ElementWithPattern end base.view 'app/assets/javascripts/snippets/components/snippet_visibility_edit.vue' do - element :visibility_content + element 'visibility-content' end end def fill_title(title) - fill_element :snippet_title_field, title + fill_element 'snippet-title-input-field', title end def fill_description(description) - click_element :description_placeholder - fill_element :snippet_description_field, description + click_element 'description-placeholder' + fill_element 'snippet-description-field', description end def set_visibility(visibility) - click_element(:visibility_content, visibility: visibility) + click_element('visibility-content', visibility: visibility) end def fill_file_name(name, file_number = nil) if file_number - within_element_by_index(:file_holder_container, file_number - 1) do - fill_element(:file_name_field, name) + within_element_by_index('file-holder-container', file_number - 1) do + fill_element('file-name-field', name) end else - fill_element(:file_name_field, name) + fill_element('file-name-field', name) end end def fill_file_content(content, file_number = nil) if file_number - within_element_by_index(:file_holder_container, file_number - 1) do + within_element_by_index('file-holder-container', file_number - 1) do text_area.set(content) end else @@ -72,13 +72,13 @@ module QA end def click_add_file - click_element(:add_file_button) + click_element('add-button') end def click_create_snippet_button - click_element_coordinates(:submit_button) + click_element_coordinates('submit-button') wait_until(reload: false) do - has_no_element?(:snippet_title_field) + has_no_element?('snippet-title-input-field') end end diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb index 6bb83d8b7e8..da87691e7a6 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -10,117 +10,110 @@ module QA super base.view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do - element :toggle_comments_button + element 'toggle-comments-button' end base.view 'app/assets/javascripts/notes/components/comment_form.vue' do - element :comment_field + element 'comment-field' end base.view 'app/assets/javascripts/notes/components/comment_type_dropdown.vue' do - element :comment_button - element :discussion_menu_item + element 'comment-button' + element 'discussion-menu-item' end base.view 'app/assets/javascripts/notes/components/discussion_actions.vue' do - element :discussion_reply_tab - element :resolve_discussion_button + element 'discussion-reply-tab' + element 'resolve-discussion-button' end base.view 'app/assets/javascripts/notes/components/discussion_filter.vue' do - element :discussion_preferences_dropdown - element :filter_menu_item + element 'discussion-preferences-dropdown' + element 'filter-menu-item' end base.view 'app/assets/javascripts/notes/components/discussion_filter_note.vue' do - element :discussion_filter_container + element 'discussion-filter-container' end base.view 'app/assets/javascripts/notes/components/noteable_discussion.vue' do - element :discussion_content + element 'discussion-content' end base.view 'app/assets/javascripts/notes/components/noteable_note.vue' do - element :noteable_note_container + element 'noteable-note-container' end base.view 'app/assets/javascripts/notes/components/note_actions.vue' do - element :note_edit_button + element 'note-edit-button' end base.view 'app/assets/javascripts/notes/components/note_form.vue' do - element :reply_field - element :reply_comment_button + element 'reply-field' + element 'reply-comment-button' end base.view 'app/assets/javascripts/notes/components/note_header.vue' do - element :system_note_content + element 'system-note-content' end base.view 'app/assets/javascripts/notes/components/toggle_replies_widget.vue' do - element :expand_replies_button - element :collapse_replies_button - end - - base.view 'app/assets/javascripts/vue_shared/components/notes/skeleton_note.vue' do - element :skeleton_note_placeholder - end - - base.view 'app/views/shared/notes/_form.html.haml' do - element :new_note_form, 'new-note' # rubocop:disable QA/ElementWithPattern - element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern + element 'expand-replies-button' + element 'collapse-replies-button' end end def collapse_replies - close_rich_text_promo_popover_if_present - click_element :collapse_replies_button + click_element 'collapse-replies-button' end # Attachment option should be an absolute path def comment(text, attachment: nil, filter: :all_activities) - close_rich_text_promo_popover_if_present method("select_#{filter}_filter").call - fill_element :comment_field, "#{text}\n" + fill_element 'comment-field', "#{text}\n" unless attachment.nil? QA::Page::Component::Dropzone.new(self, '.new-note') .attach_file(attachment) end - click_element :comment_button + click_element 'comment-button' end def edit_comment(text) - click_element :note_edit_button - fill_element :reply_field, text - click_element :reply_comment_button + click_element 'note-edit-button' + fill_element 'reply-field', text + click_element 'reply-comment-button' end def expand_replies - click_element :expand_replies_button + click_element 'expand-replies-button' end def has_comment?(comment_text) - has_element?(:noteable_note_container, text: comment_text, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) + has_element?( + 'noteable-note-container', + text: comment_text, + wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME + ) end def has_system_note?(note_text) - has_element?(:system_note_content, text: note_text, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) + has_element?('system-note-content', text: note_text, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) end def noteable_note_item - find_element(:noteable_note_container) + find_element('noteable-note-container') end def reply_to_discussion(position, reply_text) type_reply_to_discussion(position, reply_text) - click_element :reply_comment_button + click_element 'reply-comment-button' end def resolve_discussion_at_index(index) - within_element_by_index(:discussion_content, index) do - click_element :resolve_discussion_button + within_element_by_index('discussion-content', index) do + click_element 'resolve-discussion-button' end end @@ -128,7 +121,7 @@ module QA select_filter_with_text('Show all activity') wait_until do - has_no_element?(:discussion_filter_container) && has_element?(:comment_field) + has_no_element?('discussion-filter-container') && has_element?('comment-field') end end @@ -136,7 +129,7 @@ module QA select_filter_with_text('Show comments only') wait_until do - has_no_element?(:discussion_filter_container) && has_no_element?(:system_note_content) + has_no_element?('discussion-filter-container') && has_no_element?('system-note-content') end end @@ -144,27 +137,26 @@ module QA select_filter_with_text('Show history only') wait_until do - has_element?(:discussion_filter_container) && has_no_element?(:noteable_note_container) + has_element?('discussion-filter-container') && has_no_element?('noteable-note-container') end end def start_discussion(text) - fill_element :comment_field, text - close_rich_text_promo_popover_if_present - within_element(:comment_button) { click_button(class: 'gl-new-dropdown-toggle') } - click_element :discussion_menu_item - click_element :comment_button + fill_element 'comment-field', text + within_element('comment-button') { click_button(class: 'gl-new-dropdown-toggle') } + click_element 'discussion-menu-item' + click_element 'comment-button' has_comment?(text) end def toggle_comments(position) - all_elements(:toggle_comments_button, minimum: position)[position - 1].click + all_elements('toggle-comments-button', minimum: position)[position - 1].click end def type_reply_to_discussion(position, reply_text) - all_elements(:discussion_reply_tab, minimum: position)[position - 1].click - fill_element :reply_field, reply_text + all_elements('discussion-reply-tab', minimum: position)[position - 1].click + fill_element 'reply-field', reply_text end private @@ -172,8 +164,8 @@ module QA def select_filter_with_text(text) retry_on_exception do click_element('issue-title') - click_element :discussion_preferences_dropdown - find_element(:filter_menu_item, text: text).click + click_element 'discussion-preferences-dropdown' + find_element('filter-menu-item', text: text).click wait_for_requests end diff --git a/qa/qa/page/component/rich_text_popover.rb b/qa/qa/page/component/rich_text_popover.rb deleted file mode 100644 index f5b0c668fb1..00000000000 --- a/qa/qa/page/component/rich_text_popover.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Component - module RichTextPopover - extend QA::Page::PageConcern - - def self.included(base) - super - - base.view 'app/assets/javascripts/vue_shared/components/markdown/editor_mode_switcher.vue' do - element 'rich-text-promo-popover' - end - - base.view 'app/views/shared/_broadcast_message.html.haml' do - element :close_button - end - end - - def close_rich_text_promo_popover_if_present - return unless has_element?('rich-text-promo-popover', wait: 0) - - within_element('rich-text-promo-popover') do - click_element('close-button') - end - has_no_element?('rich-text-promo-popover') - end - end - end - end -end diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb index 12695ddd5b0..91c915877e2 100644 --- a/qa/qa/page/component/snippet.rb +++ b/qa/qa/page/component/snippet.rb @@ -14,111 +14,108 @@ module QA end base.view 'app/assets/javascripts/snippets/components/snippet_title.vue' do - element :snippet_title_content + element 'snippet-title-content' end base.view 'app/assets/javascripts/snippets/components/snippet_description_view.vue' do - element :snippet_description_content + element 'snippet-description-content' end base.view 'app/assets/javascripts/snippets/components/snippet_header.vue' do - element :snippet_container + element 'snippet-container' + element 'snippet-action-button' + element 'delete-snippet-button' end base.view 'app/assets/javascripts/blob/components/blob_header_filepath.vue' do - element :file_title_content + element 'file-title-content' end base.view 'app/assets/javascripts/blob/components/blob_content.vue' do - element :blob_viewer_file_content - end - - base.view 'app/assets/javascripts/snippets/components/snippet_header.vue' do - element :snippet_action_button - element :delete_snippet_button + element 'blob-viewer-file-content' end base.view 'app/assets/javascripts/snippets/components/show.vue' do - element :clone_button - element :snippet_embed_dropdown + element 'clone-button' + element 'snippet-embed-dropdown' end base.view 'app/assets/javascripts/vue_shared/components/clone_dropdown/clone_dropdown.vue' do - element :copy_http_url_button - element :copy_ssh_url_button + element 'copy-http-url-button' + element 'copy-ssh-url-button' end base.view 'app/views/shared/notes/_comment_button.html.haml' do - element :comment_button + element 'comment-button' end base.view 'app/views/shared/notes/_form.html.haml' do - element :note_field + element 'note-field' end - base.view 'app/views/snippets/notes/_actions.html.haml' do - element :edit_comment_button + base.view 'app/views/projects/notes/_actions.html.haml' do + element 'edit-comment-button' end base.view 'app/views/shared/notes/_edit_form.html.haml' do - element :edit_note_field - element :save_comment_button + element 'edit-note-field' + element 'save-comment-button' end base.view 'app/views/shared/notes/_note.html.haml' do - element :note_content - element :note_author_content + element 'note-content' + element 'note-author-content' end base.view 'app/views/shared/notes/_notes_with_form.html.haml' do - element :notes_list + element 'notes-list' end base.view 'app/views/projects/notes/_more_actions_dropdown.html.haml' do - element :more_actions_dropdown - element :delete_comment_button + element 'more-actions-dropdown' + element 'delete-comment-button' end base.view 'app/assets/javascripts/snippets/components/embed_dropdown.vue' do - element :copy_button + element 'copy-button' end base.view 'app/assets/javascripts/blob/components/blob_header_default_actions.vue' do - element :default_actions_container - element :copy_contents_button + element 'default-actions-container' + element 'copy-contents-button' end base.view 'app/views/layouts/nav/breadcrumbs/_breadcrumbs.html.haml' do - element :breadcrumb_links_content - element :breadcrumb_current_link + element 'breadcrumb-links' + element 'breadcrumb-current-link' end end def has_snippet_title?(snippet_title) - has_element?(:snippet_title_content, text: snippet_title, wait: 10) + has_element?('snippet-title-content', text: snippet_title, wait: 10) end def has_snippet_description?(snippet_description) - has_element? :snippet_description_content, text: snippet_description + has_element? 'snippet-description-content', text: snippet_description end def has_no_snippet_description? - has_no_element?(:snippet_description_field) + has_no_element?('snippet-description-content') end def has_visibility_type?(visibility_type) - within_element(:snippet_container) do + within_element('snippet-container') do has_text?(visibility_type) end end def has_file_name?(file_name, file_number = nil) if file_number - within_element_by_index(:file_title_content, file_number - 1) do + within_element_by_index('file-title-content', file_number - 1) do has_text?(file_name) end else - within_element(:file_title_content) do + within_element('file-title-content') do has_text?(file_name) end end @@ -126,11 +123,11 @@ module QA def has_no_file_name?(file_name, file_number = nil) if file_number - within_element_by_index(:file_title_content, file_number - 1) do + within_element_by_index('file-title-content', file_number - 1) do has_no_text?(file_name) end else - within_element(:file_title_content) do + within_element('file-title-content') do has_no_text?(file_name) end end @@ -138,11 +135,11 @@ module QA def has_file_content?(file_content, file_number = nil) if file_number - within_element_by_index(:blob_viewer_file_content, file_number - 1) do + within_element_by_index('blob-viewer-file-content', file_number - 1) do has_text?(file_content) end else - within_element(:blob_viewer_file_content) do + within_element('blob-viewer-file-content') do has_text?(file_content) end end @@ -150,11 +147,11 @@ module QA def has_no_file_content?(file_content, file_number = nil) if file_number - within_element_by_index(:blob_viewer_file_content, file_number - 1) do + within_element_by_index('blob-viewer-file-content', file_number - 1) do has_no_text?(file_content) end else - within_element(:blob_viewer_file_content) do + within_element('blob-viewer-file-content') do has_no_text?(file_content) end end @@ -162,119 +159,119 @@ module QA RSpec::Matchers.define :have_embed_dropdown do match do |page| - page.has_element?(:snippet_embed_dropdown) + page.has_element?('snippet-embed-dropdown') end match_when_negated do |page| - page.has_no_element?(:snippet_embed_dropdown) + page.has_no_element?('snippet-embed-dropdown') end end def click_edit_button - click_element(:snippet_action_button, Page::Dashboard::Snippet::Edit, action: 'Edit') + click_element('snippet-action-button', Page::Dashboard::Snippet::Edit, action: 'Edit') end def click_delete_button - click_element(:snippet_action_button, action: 'Delete') - click_element(:delete_snippet_button) + click_element('snippet-action-button', action: 'Delete') + click_element('delete-snippet-button') # wait for the page to reload after deletion wait_until(reload: false) do - has_no_element?(:delete_snippet_button) && - has_no_element?(:snippet_action_button, action: 'Delete') + has_no_element?('delete-snippet-button') && + has_no_element?('snippet-action-button', action: 'Delete') end end def get_repository_uri_http - click_element(:clone_button) - Git::Location.new(find_element(:copy_http_url_button)['data-clipboard-text']).uri.to_s + click_element('clone-button') + Git::Location.new(find_element('copy-http-url-button')['data-clipboard-text']).uri.to_s end def get_repository_uri_ssh - click_element(:clone_button) - Git::Location.new(find_element(:copy_ssh_url_button)['data-clipboard-text']).uri.to_s + click_element('clone-button') + Git::Location.new(find_element('copy-ssh-url-button')['data-clipboard-text']).uri.to_s end def get_sharing_link - click_element(:snippet_embed_dropdown) - find_element(:copy_button, action: 'Share')['data-clipboard-text'] + click_element('snippet-embed-dropdown') + find_element('copy-button', action: 'Share')['data-clipboard-text'] end def add_comment(comment) - fill_element(:note_field, comment) - click_element(:comment_button) + fill_element('note-field', comment) + click_element('comment-button') - unless has_element?(:note_author_content) - raise ElementNotFound, "Comment did not appear as expected" + unless has_element?('note-author-content') + raise QA::Page::Base::ElementNotFound, "Comment did not appear as expected" end end def has_comment_author?(author_username) - within_element(:note_author_content) do + within_element('note-author-content') do has_text?('@' + author_username) end end def has_comment_content?(comment_content) - within_element(:note_content) do + within_element('note-content') do has_text?(comment_content) end end def within_notes_list(&block) - within_element :notes_list, &block + within_element 'notes-list', &block end def has_syntax_highlighting?(language) - within_element(:blob_viewer_file_content) do + within_element('blob-viewer-file-content') do find('.line')['lang'].to_s == language end end def edit_comment(comment) - click_element(:edit_comment_button) - fill_element(:edit_note_field, comment) - click_element(:save_comment_button) + click_element('edit-comment-button') + fill_element('edit-note-field', comment) + click_element('save-comment-button') - unless has_element?(:note_author_content) - raise ElementNotFound, "Comment did not appear as expected" + unless has_element?('note-author-content') + raise QA::Page::Base::ElementNotFound, "Comment did not appear as expected" end end def delete_comment(comment) - click_element(:more_actions_dropdown) - click_element(:delete_comment_button) + click_element('more-actions-dropdown') + click_element('delete-comment-button') click_confirmation_ok_button - unless has_no_element?(:note_content, text: comment) - raise ElementNotFound, "Comment was not removed as expected" + unless has_no_element?('note-content', text: comment) + raise QA::Page::Base::ElementNotFound, "Comment was not removed as expected" end end def click_copy_file_contents(file_number = nil) if file_number - within_element_by_index(:default_actions_container, file_number - 1) do - click_element(:copy_contents_button) + within_element_by_index('default-actions-container', file_number - 1) do + click_element('copy-contents-button') end else - within_element(:default_actions_container) do - click_element(:copy_contents_button) + within_element('default-actions-container') do + click_element('copy-contents-button') end end end def copy_file_contents_to_comment(file_number = nil) click_copy_file_contents(file_number) - send_keys_to_element(:note_field, [:shift, :insert]) - click_element(:comment_button) + send_keys_to_element('note-field', [:shift, :insert]) + click_element('comment-button') - unless has_element?(:note_author_content) - raise ElementNotFound, "Comment did not appear as expected" + unless has_element?('note-author-content') + raise QA::Page::Base::ElementNotFound, "Comment did not appear as expected" end end def snippet_id - within_element(:breadcrumb_links_content) do - find_element(:breadcrumb_current_link).text.delete_prefix('$') + within_element('breadcrumb-links') do + find_element('breadcrumb-current-link').text.delete_prefix('$') end end end diff --git a/qa/qa/page/component/web_ide/modal/create_new_file.rb b/qa/qa/page/component/web_ide/modal/create_new_file.rb index 2869bb9c331..22cac83d913 100644 --- a/qa/qa/page/component/web_ide/modal/create_new_file.rb +++ b/qa/qa/page/component/web_ide/modal/create_new_file.rb @@ -7,7 +7,7 @@ module QA module Modal class CreateNewFile < Page::Base view 'app/assets/javascripts/ide/components/new_dropdown/modal.vue' do - element :file_name_field, required: true + element 'file-name-field', required: true element :new_file_modal, required: true element :template_list_content end diff --git a/qa/qa/page/component/wiki.rb b/qa/qa/page/component/wiki.rb index ed68052f997..d5daaf7d8ea 100644 --- a/qa/qa/page/component/wiki.rb +++ b/qa/qa/page/component/wiki.rb @@ -10,25 +10,25 @@ module QA super base.view 'app/views/shared/wikis/show.html.haml' do - element :wiki_page_title - element :edit_page_button + element 'wiki-page-title' + element 'wiki-edit-button' end base.view 'app/views/shared/wikis/_wiki_content.html.haml' do - element :wiki_page_content + element 'wiki-page-content' end base.view 'app/views/shared/wikis/_main_links.html.haml' do - element :new_page_button - element :page_history_button + element 'new-page-button' + element 'page-history-button' end base.view 'app/views/shared/empty_states/_wikis.html.haml' do - element :create_first_page_link + element 'create-first-page-link' end base.view 'app/views/shared/empty_states/_wikis_layout.html.haml' do - element :svg_content + element 'svg-content' end end @@ -37,49 +37,49 @@ module QA # "Create your first page" button shifts up a bit. This can cause # webdriver to miss the hit so we wait for the svg to load before # clicking the button. - within_element(:svg_content) do - has_element?(:js_lazy_loaded_content) + within_element('svg-content') do + has_element?('js-lazy-loaded-content') end - click_element(:create_first_page_link) + click_element('create-first-page-link') end def click_new_page - click_element(:new_page_button) + click_element('new-page-button') end def click_page_history - click_element(:page_history_button) + click_element('page-history-button') end def click_edit - click_element(:edit_page_button) + click_element('wiki-edit-button') end def has_title?(title) - has_element?(:wiki_page_title, title) + has_element?('wiki-page-title', title) end def has_content?(content) - has_element?(:wiki_page_content, content) + has_element?('wiki-page-content', content) end def has_no_content?(content) - has_no_element?(:wiki_page_content, content) + has_no_element?('wiki-page-content', content) end def has_no_page? - has_element?(:create_first_page_link) + has_element?('create-first-page-link') end def has_heading?(heading_type, text) - within_element(:wiki_page_content) do + within_element('wiki-page-content') do has_css?(heading_type, text: text) end end def has_image?(image_file_name) - within_element(:wiki_page_content) do + within_element('wiki-page-content') do has_css?("img[src$='#{image_file_name}']") end end diff --git a/qa/qa/page/component/wiki_page_form.rb b/qa/qa/page/component/wiki_page_form.rb index 335790c5b27..454121b457e 100644 --- a/qa/qa/page/component/wiki_page_form.rb +++ b/qa/qa/page/component/wiki_page_form.rb @@ -10,34 +10,34 @@ module QA super base.view 'app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue' do - element :wiki_title_textbox - element :wiki_message_textbox - element :wiki_submit_button + element 'wiki-title-textbox' + element 'wiki-message-textbox' + element 'wiki-submit-button' end base.view 'app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue' do - element :markdown_editor_form_field + element 'markdown-editor-form-field' end base.view 'app/assets/javascripts/vue_shared/components/markdown/editor_mode_switcher.vue' do - element :editing_mode_switcher + element 'editing-mode-switcher' end base.view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do - element :delete_button + element 'delete-button' end end def set_title(title) - fill_element(:wiki_title_textbox, title) + fill_element('wiki-title-textbox', title) end def set_content(content) - fill_element(:markdown_editor_form_field, content) + fill_element('markdown-editor-form-field', content) end def set_message(message) - fill_element(:wiki_message_textbox, message) + fill_element('wiki-message-textbox', message) end def click_submit @@ -45,23 +45,23 @@ module QA # before clicking submit. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/97693#note_1098728562 sleep 0.5 - click_element(:wiki_submit_button) + click_element('wiki-submit-button') QA::Support::Retrier.retry_on_exception do - has_no_element?(:wiki_title_textbox) + has_no_element?('wiki-title-textbox') end end def delete_page - click_element(:delete_button, Page::Modal::DeleteWiki) + click_element('delete-button', Page::Modal::DeleteWiki) Page::Modal::DeleteWiki.perform(&:confirm_deletion) end def use_new_editor - click_element(:editing_mode_switcher) + click_element('editing-mode-switcher') wait_until(reload: false) do - has_element?(:content_editor_container) + has_element?('content-editor') end end end diff --git a/qa/qa/page/component/wiki_sidebar.rb b/qa/qa/page/component/wiki_sidebar.rb index 7543b9655f9..8c9741c3086 100644 --- a/qa/qa/page/component/wiki_sidebar.rb +++ b/qa/qa/page/component/wiki_sidebar.rb @@ -10,42 +10,42 @@ module QA super base.view 'app/views/shared/wikis/_sidebar.html.haml' do - element :clone_repository_link - element :view_all_pages_button + element 'clone-repository-link' + element 'view-all-pages-button' end base.view 'app/views/shared/wikis/_sidebar_wiki_page.html.haml' do - element :wiki_page_link + element 'wiki-page-link' end base.view 'app/views/shared/wikis/_wiki_directory.html.haml' do - element :wiki_directory_content - element :wiki_dir_page_link + element 'wiki-directory-content' + element 'wiki-dir-page-link' end end def click_clone_repository - click_element(:clone_repository_link) + click_element('clone-repository-link') end def click_view_all_pages - click_element(:view_all_pages_button) + click_element('view-all-pages-button') end def click_page_link(page_title) - click_element(:wiki_page_link, page_name: page_title) + click_element('wiki-page-link', page_name: page_title) end def has_page_listed?(page_title) - has_element?(:wiki_page_link, page_name: page_title) + has_element?('wiki-page-link', page_name: page_title) end def has_directory?(directory) - has_element?(:wiki_directory_content, text: directory) + has_element?('wiki-directory-content', text: directory) end def has_dir_page?(dir_page) - has_element?(:wiki_dir_page_link, page_name: dir_page) + has_element?('wiki-dir-page-link', page_name: dir_page) end end end diff --git a/qa/qa/page/dashboard/projects.rb b/qa/qa/page/dashboard/projects.rb index 4a81d34b32e..ff822a6b117 100644 --- a/qa/qa/page/dashboard/projects.rb +++ b/qa/qa/page/dashboard/projects.rb @@ -5,34 +5,34 @@ module QA module Dashboard class Projects < Page::Base view 'app/views/shared/projects/_search_form.html.haml' do - element :project_filter_form_container, required: true + element 'project-filter-form-container', required: true end view 'app/views/shared/projects/_project.html.haml' do - element :project_content - element :user_role_content + element 'project-content' + element 'user-role-content' end view 'app/views/dashboard/_projects_head.html.haml' do - element :new_project_button + element 'new-project-button' end view 'app/views/dashboard/projects/_blank_state_welcome.html.haml' do - element :new_project_button + element 'new-project-button' end view 'app/views/dashboard/projects/_blank_state_admin_welcome.html.haml' do - element :new_project_button + element 'new-project-button' end def has_project_with_access_role?(project_name, access_role) - within_element(:project_content, text: project_name) do - has_element?(:user_role_content, text: access_role) + within_element('project-content', text: project_name) do + has_element?('user-role-content', text: access_role) end end def filter_by_name(name) - within_element(:project_filter_form_container) do + within_element('project-filter-form-container') do fill_in :name, with: name end end @@ -44,7 +44,7 @@ module QA end def click_new_project_button - click_element(:new_project_button, Page::Project::New) + click_element('new-project-button', Page::Project::New) end def self.path @@ -52,7 +52,7 @@ module QA end def clear_project_filter - fill_element(:project_filter_form_container, "") + fill_element('project-filter-form-container', "") end end end diff --git a/qa/qa/page/dashboard/snippet/edit.rb b/qa/qa/page/dashboard/snippet/edit.rb index 8af3eb5693c..6706f9b0886 100644 --- a/qa/qa/page/dashboard/snippet/edit.rb +++ b/qa/qa/page/dashboard/snippet/edit.rb @@ -6,49 +6,51 @@ module QA module Snippet class Edit < Page::Base view 'app/assets/javascripts/snippets/components/edit.vue' do - element :submit_button, required: true + element 'submit-button', required: true end view 'app/assets/javascripts/snippets/components/snippet_blob_edit.vue' do - element :file_name_field - element :file_holder_container + element 'file-name-field' + element 'file-holder-container' end view 'app/assets/javascripts/blob/components/blob_edit_header.vue' do - element :delete_file_button + element 'delete-file-button' end view 'app/assets/javascripts/snippets/components/snippet_visibility_edit.vue' do - element :visibility_content + element 'visibility-content' end def add_to_file_content(content) text_area.click text_area.send_keys(:home, content) # starts in the beginning of the line - text_area.has_text?(content) # wait for changes to take effect + wait_until(message: "add_to_file_content", max_duration: Capybara.default_max_wait_time, reload: false) do + text_area.value.include?(content) # wait for changes to take effect + end end def change_visibility_to(visibility_type) - click_element(:visibility_content, visibility: visibility_type) + click_element('visibility-content', visibility: visibility_type) end def click_add_file - click_element(:add_file_button) + click_element('add-button') end def fill_file_name(name, file_number = nil) if file_number - within_element_by_index(:file_holder_container, file_number - 1) do - fill_element(:file_name_field, name) + within_element_by_index('file-holder-container', file_number - 1) do + fill_element('file-name-field', name) end else - fill_element(:file_name_field, name) + fill_element('file-name-field', name) end end def fill_file_content(content, file_number = nil) if file_number - within_element_by_index(:file_holder_container, file_number - 1) do + within_element_by_index('file-holder-container', file_number - 1) do text_area.set(content) end else @@ -57,15 +59,15 @@ module QA end def click_delete_file(file_number) - within_element_by_index(:file_holder_container, file_number - 1) do - click_element(:delete_file_button) + within_element_by_index('file-holder-container', file_number - 1) do + click_element('delete-file-button') end end def save_changes - click_element_coordinates(:submit_button) + click_element_coordinates('submit-button') wait_until(reload: false) do - has_no_element?(:file_name_field) + has_no_element?('file-name-field') end end diff --git a/qa/qa/page/dashboard/snippet/index.rb b/qa/qa/page/dashboard/snippet/index.rb index 51d7bd3f20b..3b479ddebb1 100644 --- a/qa/qa/page/dashboard/snippet/index.rb +++ b/qa/qa/page/dashboard/snippet/index.rb @@ -6,25 +6,25 @@ module QA module Snippet class Index < Page::Base view 'app/views/shared/snippets/_snippet.html.haml' do - element :snippet_link - element :snippet_visibility_content - element :snippet_file_count_content + element 'snippet-link' + element 'snippet-visibility-content' + element 'snippet-file-count-content' end def has_snippet_title?(snippet_title) - has_element?(:snippet_link, snippet_title: snippet_title) + has_element?('snippet-link', snippet_title: snippet_title) end def has_visibility_level?(snippet_title, visibility) - within_element(:snippet_link, snippet_title: snippet_title) do - has_element?(:snippet_visibility_content, snippet_visibility: visibility) + within_element('snippet-link', snippet_title: snippet_title) do + has_element?('snippet-visibility-content', snippet_visibility: visibility) end end def has_number_of_files?(snippet_title, number) retry_until(max_attempts: 5, reload: true, sleep_interval: 1) do # snippet statistics computation can take a few moments - within_element(:snippet_link, snippet_title: snippet_title) do - has_element?(:snippet_file_count_content, snippet_files: number, wait: 5) + within_element('snippet-link', snippet_title: snippet_title) do + has_element?('snippet-file-count-content', snippet_files: number, wait: 5) end end end diff --git a/qa/qa/page/dashboard/snippet/show.rb b/qa/qa/page/dashboard/snippet/show.rb index f395bd4f8cb..c0eea5cbe1b 100644 --- a/qa/qa/page/dashboard/snippet/show.rb +++ b/qa/qa/page/dashboard/snippet/show.rb @@ -9,7 +9,7 @@ module QA include Page::Component::BlobContent view 'app/assets/javascripts/snippets/components/snippet_title.vue' do - element :snippet_title_content + element 'snippet-title-content' end end end diff --git a/qa/qa/page/dashboard/todos.rb b/qa/qa/page/dashboard/todos.rb index 74283f46928..94fd20b80ab 100644 --- a/qa/qa/page/dashboard/todos.rb +++ b/qa/qa/page/dashboard/todos.rb @@ -19,7 +19,7 @@ module QA view 'app/helpers/dropdowns_helper.rb' do element :dropdown_input_field - element :dropdown_list_content + element 'dropdown-list-content' end def has_todo_list? @@ -35,7 +35,7 @@ module QA fill_element(:dropdown_input_field, group.path) - within_element(:dropdown_list_content) do + within_element('dropdown-list-content') do click_on group.path end diff --git a/qa/qa/page/dashboard/welcome.rb b/qa/qa/page/dashboard/welcome.rb index 6f645e168c7..a7c293a2661 100644 --- a/qa/qa/page/dashboard/welcome.rb +++ b/qa/qa/page/dashboard/welcome.rb @@ -5,11 +5,11 @@ module QA module Dashboard class Welcome < Page::Base view 'app/views/dashboard/projects/_zero_authorized_projects.html.haml' do - element :welcome_title_content + element 'welcome-title-content' end def has_welcome_title?(text) - has_element?(:welcome_title_content, text: text) + has_element?('welcome-title-content', text: text) end def self.path diff --git a/qa/qa/page/file/shared/commit_button.rb b/qa/qa/page/file/shared/commit_button.rb index c1c5907f27d..edab31b098b 100644 --- a/qa/qa/page/file/shared/commit_button.rb +++ b/qa/qa/page/file/shared/commit_button.rb @@ -11,12 +11,12 @@ module QA super base.view 'app/views/projects/_commit_button.html.haml' do - element :commit_button + element 'commit-button' end end def commit_changes - click_element(:commit_button) + click_element('commit-button') wait_until(reload: false, max_duration: 60) do finished_loading? diff --git a/qa/qa/page/file/shared/commit_message.rb b/qa/qa/page/file/shared/commit_message.rb index 12154cdb728..9d90400f42f 100644 --- a/qa/qa/page/file/shared/commit_message.rb +++ b/qa/qa/page/file/shared/commit_message.rb @@ -14,7 +14,7 @@ module QA element :commit_message_field end - base.view 'app/assets/javascripts/repository/components/last_commit.vue' do + base.view 'app/assets/javascripts/repository/components/commit_info.vue' do element :commit_content end diff --git a/qa/qa/page/file/shared/editor.rb b/qa/qa/page/file/shared/editor.rb index f392d52747e..2e28c158ea1 100644 --- a/qa/qa/page/file/shared/editor.rb +++ b/qa/qa/page/file/shared/editor.rb @@ -20,7 +20,7 @@ module QA end def remove_content - if page.driver.browser.capabilities.platform.include? "mac" + if page.driver.browser.capabilities.platform_name.include? "mac" text_area.send_keys([:command, 'a'], :backspace) else text_area.send_keys([:control, 'a'], :backspace) diff --git a/qa/qa/page/group/bulk_import.rb b/qa/qa/page/group/bulk_import.rb index 9fb262c27c3..52e5593cb26 100644 --- a/qa/qa/page/group/bulk_import.rb +++ b/qa/qa/page/group/bulk_import.rb @@ -11,12 +11,8 @@ module QA element 'filter-groups' end - view "app/assets/javascripts/import_entities/import_groups/components/import_target_cell.vue" do - element :target_group_dropdown_item - end - - view "app/assets/javascripts/import_entities/components/group_dropdown.vue" do - element :target_namespace_selector_dropdown + view "app/assets/javascripts/import_entities/components/import_target_dropdown.vue" do + element 'target-namespace-dropdown' end view "app/assets/javascripts/import_entities/import_groups/components/import_actions_cell.vue" do @@ -40,8 +36,8 @@ module QA filter_group(source_group_name) within_element(:import_item, source_group: source_group_name) do - click_element(:target_namespace_selector_dropdown) - click_element(:target_group_dropdown_item, group_name: target_group_name) + click_element('target-namespace-dropdown') + click_element("listbox-item-#{target_group_name}") retry_until(message: "Triggering import") do click_element('import-group-button') diff --git a/qa/qa/page/group/milestone/index.rb b/qa/qa/page/group/milestone/index.rb index a86772a070d..8540de62943 100644 --- a/qa/qa/page/group/milestone/index.rb +++ b/qa/qa/page/group/milestone/index.rb @@ -6,11 +6,11 @@ module QA module Milestone class Index < Page::Milestone::Index view 'app/views/groups/milestones/index.html.haml' do - element :new_group_milestone_link + element 'new-group-milestone-link' end def click_new_milestone_link - click_element(:new_group_milestone_link) + click_element('new-group-milestone-link') end end end diff --git a/qa/qa/page/group/milestone/new.rb b/qa/qa/page/group/milestone/new.rb index 55b406ed477..50965769c9e 100644 --- a/qa/qa/page/group/milestone/new.rb +++ b/qa/qa/page/group/milestone/new.rb @@ -6,13 +6,13 @@ module QA module Milestone class New < Page::Milestone::New view 'app/views/groups/milestones/_form.html.haml' do - element :create_milestone_button + element 'create-milestone-button' element 'milestone-description-field' - element :milestone_title_field + element 'milestone-title-field' end def click_create_milestone_button - click_element(:create_milestone_button) + click_element('create-milestone-button') end def set_description(description) @@ -20,7 +20,7 @@ module QA end def set_title(title) - fill_element(:milestone_title_field, title) + fill_element('milestone-title-field', title) end end end diff --git a/qa/qa/page/group/settings/general.rb b/qa/qa/page/group/settings/general.rb index 44460291c90..c12a9a60fa2 100644 --- a/qa/qa/page/group/settings/general.rb +++ b/qa/qa/page/group/settings/general.rb @@ -12,7 +12,7 @@ module QA view 'app/views/groups/edit.html.haml' do element :permission_lfs_2fa_content - element :advanced_settings_content + element 'advanced-settings-content' end view 'app/views/groups/settings/_permissions.html.haml' do @@ -41,11 +41,11 @@ module QA end view 'app/views/groups/settings/_transfer.html.haml' do - element :transfer_group_content + element 'transfer-group-content' end view 'app/assets/javascripts/groups/components/transfer_group_form.vue' do - element :transfer_group_button + element 'transfer-group-button' end def set_group_name(name) @@ -114,14 +114,14 @@ module QA def transfer_group(source_group, target_group) QA::Runtime::Logger.info "Transferring group: #{source_group.path} to target group: #{target_group.path}" - expand_content(:advanced_settings_content) + expand_content('advanced-settings-content') scroll_to_transfer_group_content select_namespace(target_group.path) wait_for_enabled_transfer_group_button - click_element(:transfer_group_button) + click_element('transfer-group-button') fill_confirmation_text(source_group.full_path) confirm_transfer @@ -131,15 +131,15 @@ module QA def scroll_to_transfer_group_content retry_until(sleep_interval: 1, message: 'Waiting for transfer group content to display') do - has_element?(:transfer_group_content, wait: 3) + has_element?('transfer-group-content', wait: 3) end - scroll_to_element :transfer_group_content + scroll_to_element 'transfer-group-content' end def wait_for_enabled_transfer_group_button retry_until(sleep_interval: 1, message: 'Waiting for transfer group button to be enabled') do - has_element?(:transfer_group_button, disabled: false, wait: 3) + has_element?('transfer-group-button', disabled: false, wait: 3) end end end diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb index 0eaab078950..4dd0f3a5704 100644 --- a/qa/qa/page/group/show.rb +++ b/qa/qa/page/group/show.rb @@ -8,7 +8,7 @@ module QA include QA::Page::Component::ConfirmModal view 'app/views/groups/_home_panel.html.haml' do - element :new_project_button + element 'new-project-button' element :new_subgroup_button element :group_id_content end @@ -23,7 +23,7 @@ module QA end def has_new_project_and_new_subgroup_buttons? - has_element?(:new_project_button) + has_element?('new_project_button') has_element?(:new_subgroup_button) end @@ -36,7 +36,7 @@ module QA end def go_to_new_project - click_element :new_project_button + click_element 'new-project-button' end def group_id diff --git a/qa/qa/page/issuable/new.rb b/qa/qa/page/issuable/new.rb index 0306b246e42..d5b41e0399f 100644 --- a/qa/qa/page/issuable/new.rb +++ b/qa/qa/page/issuable/new.rb @@ -4,8 +4,6 @@ module QA module Page module Issuable class New < Page::Base - include Page::Component::RichTextPopover - view 'app/views/shared/issuable/form/_title.html.haml' do element 'issuable-form-title-field' end @@ -15,11 +13,11 @@ module QA end view 'app/assets/javascripts/sidebar/components/milestone/milestone_dropdown.vue' do - element :issuable_milestone_dropdown + element 'issuable-milestone-dropdown' end view 'app/views/shared/issuable/_label_dropdown.html.haml' do - element :issuable_label_dropdown + element 'issuable-label-dropdown' end view 'app/assets/javascripts/sidebar/components/labels/labels_select_widget/dropdown_contents.vue' do @@ -27,11 +25,11 @@ module QA end view 'app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml' do - element :assign_to_me_link + element 'assign-to-me-link' end view 'app/views/shared/issuable/form/_template_selector.html.haml' do - element :template_dropdown + element 'template-dropdown' end def fill_title(title) @@ -43,30 +41,29 @@ module QA end def choose_milestone(milestone) - within_element(:issuable_milestone_dropdown) do - click_button 'Select milestone' - click_button milestone.title + within_element('issuable-milestone-dropdown') do + click_button('Select milestone') + click_button(milestone.title) end end def choose_template(template_name) - close_rich_text_promo_popover_if_present - click_element :template_dropdown - within_element(:template_dropdown) do - click_on template_name + click_element('template-dropdown') + within_element('template-dropdown') do + click_on(template_name) end end def select_label(label) - click_element :issuable_label_dropdown + click_element('issuable-label-dropdown') click_on(label.title, match: :prefer_exact) - click_element :issuable_label_dropdown # So that the dropdown goes away(click away action) + click_element('issuable-label-dropdown') # So that the dropdown goes away(click away action) end def assign_to_me - click_element :assign_to_me_link + click_element('assign-to-me-link') end end end diff --git a/qa/qa/page/label/index.rb b/qa/qa/page/label/index.rb index 70df2e4dc9e..77d02c73a52 100644 --- a/qa/qa/page/label/index.rb +++ b/qa/qa/page/label/index.rb @@ -7,26 +7,26 @@ module QA include Component::LazyLoader view 'app/views/shared/labels/_nav.html.haml' do - element :create_new_label_button + element 'create-new-label-button' end view 'app/views/shared/empty_states/_labels.html.haml' do - element :label_svg_content + element 'label-svg-content' end view 'app/views/shared/empty_states/_priority_labels.html.haml' do - element :label_svg_content + element 'label-svg-content' end def click_new_label_button # The 'labels.svg' takes a fraction of a second to load after which the "New label" button shifts up a bit # This can cause webdriver to miss the hit so we wait for the svg to load (implicitly with has_element?) # before clicking the button. - within_element(:label_svg_content) do - has_element?(:js_lazy_loaded_content) + within_element('label-svg-content') do + has_element?('js-lazy-loaded-content') end - click_element :create_new_label_button + click_element('create-new-label-button') end end end diff --git a/qa/qa/page/label/new.rb b/qa/qa/page/label/new.rb index 12427443280..719b10cbf1b 100644 --- a/qa/qa/page/label/new.rb +++ b/qa/qa/page/label/new.rb @@ -5,26 +5,26 @@ module QA module Label class New < Page::Base view 'app/views/shared/labels/_form.html.haml' do - element :label_title_field - element :label_description_field - element :label_color_field - element :label_create_button + element 'label-title-field' + element 'label-description-field' + element 'label-color-field' + element 'label-create-button' end def click_label_create_button - click_element :label_create_button + click_element('label-create-button') end def fill_title(title) - fill_element :label_title_field, title + fill_element('label-title-field', title) end def fill_description(description) - fill_element :label_description_field, description + fill_element('label-description-field', description) end def fill_color(color) - fill_element :label_color_field, color + fill_element('label-color-field', color) end end end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 47e50c4a8a3..1fd0b5b453c 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -153,10 +153,6 @@ module QA has_css?(".active", text: 'Standard') end - def has_arkose_labs_token? - has_css?('[name="arkose_labs_token"][value]', visible: false) - end - def has_accept_all_cookies_button? has_button?('Accept All Cookies') end @@ -235,16 +231,7 @@ module QA fill_in_credential(user) - if Runtime::Env.running_on_dot_com? - click_accept_all_cookies if has_accept_all_cookies_button? - # Arkose only appears in staging.gitlab.com, gitlab.com, etc... - - # Wait until the ArkoseLabs challenge has initialized - Support::WaitForRequests.wait_for_requests - Support::Waiter.wait_until(max_duration: 5, reload_page: false, raise_on_failure: false) do - has_arkose_labs_token? - end - end + click_accept_all_cookies if Runtime::Env.running_on_dot_com? && has_accept_all_cookies_button? click_element :sign_in_button diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 9bd0e52132f..2413166e120 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -21,8 +21,8 @@ module QA element :edit_profile_link end - view 'app/assets/javascripts/super_sidebar/components/user_name_group.vue' do - element :user_profile_link + view 'app/assets/javascripts/super_sidebar/components/user_menu_profile_item.vue' do + element 'user-profile-link' end view 'app/assets/javascripts/super_sidebar/components/user_bar.vue' do @@ -115,10 +115,10 @@ module QA return false unless has_personal_area? within_user_menu do - has_element?(:user_profile_link, text: /#{user.username}/) + has_element?('user-profile-link', text: /#{user.username}/) end # we need to close user menu because plain user link check will leave it open - click_element :user_avatar_content if has_element?(:user_profile_link, wait: 0) + click_element :user_avatar_content if has_element?('user-profile-link', wait: 0) end def not_signed_in? @@ -159,7 +159,7 @@ module QA def click_user_profile_link within_user_menu do - click_element(:user_profile_link) + click_element('user-profile-link') end end @@ -189,7 +189,7 @@ module QA def within_user_menu(&block) within_element(:navbar) do - click_element :user_avatar_content unless has_element?(:user_profile_link, wait: 1) + click_element :user_avatar_content unless has_element?('user-profile-link', wait: 1) within_element('user-dropdown', &block) end diff --git a/qa/qa/page/merge_request/index.rb b/qa/qa/page/merge_request/index.rb index ae024c16566..14623fe68a2 100644 --- a/qa/qa/page/merge_request/index.rb +++ b/qa/qa/page/merge_request/index.rb @@ -5,11 +5,11 @@ module QA module MergeRequest class Index < Page::Base view 'app/views/shared/empty_states/_merge_requests.html.haml' do - element :new_merge_request_button + element 'new-merge-request-button' end def click_new_merge_request - click_element(:new_merge_request_button) + click_element('new-merge-request-button') end end end diff --git a/qa/qa/page/merge_request/new.rb b/qa/qa/page/merge_request/new.rb index 6a59440fc28..6a97a643a77 100644 --- a/qa/qa/page/merge_request/new.rb +++ b/qa/qa/page/merge_request/new.rb @@ -14,8 +14,8 @@ module QA element 'compare-branches-button' end - view 'app/assets/javascripts/merge_requests/components/compare_dropdown.vue' do - element 'source-branch-dropdown', ':data-testid="testid"' # rubocop:disable QA/ElementWithPattern + view 'app/assets/javascripts/merge_requests/components/compare_app.vue' do + element 'compare-dropdown' end view 'app/views/projects/merge_requests/creations/_new_submit.html.haml' do @@ -50,7 +50,7 @@ module QA end def select_source_branch(branch) - click_element('source-branch-dropdown') + click_element('compare-dropdown', 'compare-side': 'source') search_and_select(branch) end end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 80541bd9283..a51c65a18c6 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -6,39 +6,38 @@ module QA class Show < Page::Base include Page::Component::Note include Page::Component::Issuable::Sidebar - include Page::Component::RichTextPopover view 'app/assets/javascripts/batch_comments/components/preview_dropdown.vue' do - element :review_preview_dropdown + element 'review-preview-dropdown' end view 'app/assets/javascripts/batch_comments/components/review_bar.vue' do - element :review_bar_content + element 'review-bar-content' end view 'app/assets/javascripts/batch_comments/components/submit_dropdown.vue' do - element :submit_review_dropdown - element :submit_review_button + element 'submit-review-dropdown' + element 'submit-review-button' end view 'app/assets/javascripts/diffs/components/compare_dropdown_layout.vue' do - element :dropdown_content + element 'version-dropdown-content' end view 'app/assets/javascripts/diffs/components/compare_versions.vue' do - element :target_version_dropdown - element :file_tree_button + element 'target-version-dropdown' + element 'file-tree-button' end view 'app/assets/javascripts/diffs/components/tree_list.vue' do - element :file_tree_container - element :diff_tree_search + element 'file-tree-container' + element 'diff-tree-search' end view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do - element :file_title_container - element :dropdown_button - element :edit_in_ide_button + element 'file-title-container' + element 'options-dropdown-button' + element 'edit-in-ide-button' end view 'app/assets/javascripts/vue_shared/components/file_row.vue' do @@ -46,13 +45,13 @@ module QA end view 'app/assets/javascripts/diffs/components/diff_row.vue' do - element :diff_comment_button - element :new_diff_line_link + element 'left-comment-button' + element 'left-line-number' end view 'app/assets/javascripts/notes/components/note_form.vue' do - element :start_review_button - element :comment_now_button + element 'start-review-button' + element 'comment-now-button' end view 'app/views/projects/merge_requests/_code_dropdown.html.haml' do @@ -63,67 +62,68 @@ module QA end view 'app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue' do - element :merge_request_pipeline_info_content - element :pipeline_link + element 'pipeline-info-container' + element 'pipeline-id' end view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_failed_to_merge.vue' do - element :merge_request_error_content + element 'merge-request-failed-refresh-button' end view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue' do - element :cherry_pick_button - element :revert_button + element 'cherry-pick-button' + element 'revert-button' end view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue' do - element :mr_rebase_button - element :no_fast_forward_message_content + element 'standard-rebase-button' + element 'rebase-message' end view 'app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue' do - element :merge_button - element :merge_moment_dropdown - element :merge_immediately_menu_item - element :merged_status_content + element 'merge-button' + element 'merge-immediately-dropdown' + element 'merge-immediately-button' + element 'merged-status-content' end view 'app/assets/javascripts/vue_merge_request_widget/components/states/sha_mismatch.vue' do - element :head_mismatch_content + element 'head-mismatch-content' end view 'app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue' do - element :squash_checkbox + element 'squash-checkbox' end view 'app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue' do - element :mr_widget_content + element 'mr-widget-content' + element 'pipeline-container' end view 'app/assets/javascripts/vue_shared/components/markdown/apply_suggestion.vue' do - element :apply_suggestion_dropdown - element :commit_message_field - element :commit_with_custom_message_button + element 'apply-suggestion-dropdown' + element 'commit-message-field' + element 'commit-with-custom-message-button' end view 'app/assets/javascripts/vue_shared/components/markdown/header.vue' do - element :suggestion_button - element :dismiss_suggestion_popover_button + element 'suggestion-button' + element 'dismiss-suggestion-popover-button' end view 'app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue' do - element :add_suggestion_batch_button - element :applied_badge - element :applying_badge + element 'add-suggestion-batch-button' + element 'applied-badge' + element 'applying-badge' end view 'app/views/projects/merge_requests/_description.html.haml' do - element :description_content + element 'description-content' end view 'app/views/projects/merge_requests/_mr_title.html.haml' do - element :edit_title_button - element :title_content, required: true + element 'edit-title-button' + element 'title-content', required: true end view 'app/views/projects/merge_requests/_page.html.haml' do @@ -132,55 +132,55 @@ module QA element 'diffs-tab', required: true end - view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue' do - element :cancel_auto_merge_button - end - view 'app/views/shared/_broadcast_message.html.haml' do - element :broadcast_notification_container - element :close_button + element 'broadcast-notification-container' + element 'close-button' end view 'app/assets/javascripts/ci/jobs_page/components/job_cells/job_cell.vue' do element 'fork-icon' end + view 'app/assets/javascripts/vue_merge_request_widget/components/mr_collapsible_extension.vue' do + element 'mr-collapsible-title' + end + def start_review - click_element(:start_review_button) + click_element('start-review-button') # After clicking the button, wait for it to disappear # before moving on to the next part of the test - has_no_element?(:start_review_button) + has_no_element?('start-review-button') end def click_target_version_dropdown - click_element(:target_version_dropdown) + click_element('target-version-dropdown') end def version_dropdown_content - find_element(:dropdown_content).text + find_element('version-dropdown-content').text end def submit_pending_reviews # On test environments we have a broadcast message that can cover the buttons - if has_element?(:broadcast_notification_container, wait: 5) - within_element(:broadcast_notification_container) do - click_element(:close_button) + if has_element?('broadcast-notification-container', wait: 5) + within_element('broadcast-notification-container') do + click_element('close-button') end end - within_element(:review_bar_content) do - click_element(:review_preview_dropdown) + within_element('review-bar-content') do + click_element('review-preview-dropdown') end - click_element(:submit_review_dropdown) - click_element(:submit_review_button) + click_element('submit-review-dropdown') + click_element('submit-review-button') # After clicking the button, wait for the review bar to disappear # before moving on to the next part of the test wait_until(reload: false) do - has_no_element?(:review_bar_content) + has_no_element?('review-bar-content') end end @@ -189,11 +189,13 @@ module QA has_css?('a[data-linenumber="1"]') end - all_elements(:new_diff_line_link, minimum: 1).first.hover - click_element(:diff_comment_button) - click_element(:dismiss_suggestion_popover_button) if has_element?(:dismiss_suggestion_popover_button, wait: 1) + all_elements('left-line-number', minimum: 1).first.hover + click_element('left-comment-button') - fill_element(:reply_field, text) + click_element('dismiss-suggestion-popover-button') if has_element?('dismiss-suggestion-popover-button', + wait: 1) + + fill_element('reply-field', text) end def click_discussions_tab @@ -212,18 +214,18 @@ module QA end def click_pipeline_link - click_element(:pipeline_link) + click_element('pipeline-id') end def edit! # Click by JS is needed to bypass the Moved MR actions popover # Change back to regular click_element when moved_mr_sidebar FF is removed # Rollout issue: https://gitlab.com/gitlab-org/gitlab/-/issues/385460 - click_by_javascript(find_element(:edit_title_button, skip_finished_loading_check: true)) + click_by_javascript(find_element('edit-title-button', skip_finished_loading_check: true)) end def fast_forward_not_possible? - has_element?(:no_fast_forward_message_content) + has_element?('rebase-message') end def has_file?(file_name) @@ -244,23 +246,23 @@ module QA def search_file_tree(file_name) open_file_tree - fill_element(:diff_tree_search, file_name) + fill_element('diff-tree-search', file_name) end def open_file_tree - click_element(:file_tree_button) if has_no_element?(:file_tree_container, wait: 1) + click_element('file-tree-button') if has_no_element?('file-tree-container', wait: 1) end def has_merge_button? refresh - has_element?(:merge_button) + has_element?('merge-button') end def has_no_merge_button? refresh - has_no_element?(:merge_button) + has_no_element?('merge-button') end RSpec::Matchers.define :have_merge_button do @@ -271,30 +273,30 @@ module QA def has_pipeline_status?(text) # Pipelines can be slow, so we wait a bit longer than the usual 10 seconds wait_until(max_duration: 120, sleep_interval: 5, reload: true) do - has_element?(:merge_request_pipeline_info_content, text: text, wait: 15) + has_element?('pipeline-info-container', text: text, wait: 15) end end def has_title?(title) - has_element?(:title_content, text: title) + has_element?('title-content', text: title) end def has_description?(description) - has_element?(:description_content, text: description) + has_element?('description-content', text: description) end def mark_to_squash # Refresh page if commit arrived after loading the MR page wait_until(reload: true, message: 'Wait for MR to be unblocked') do - has_no_element?(:head_mismatch_content, wait: 1) + has_no_element?('head-mismatch-content', wait: 1) end # The squash checkbox is enabled via JS wait_until(reload: false) do - !find_element(:squash_checkbox, visible: false).disabled? + !find_element('squash-checkbox', visible: false).disabled? end - check_element(:squash_checkbox, true) + check_element('squash-checkbox', true) end def merge! @@ -307,7 +309,7 @@ module QA def merge_when_pipeline_succeeds! wait_until_ready_to_merge - click_element(:merge_button, text: 'Merge when pipeline succeeds') + click_element('merge-button', text: 'Merge when pipeline succeeds') end def merged? @@ -318,23 +320,23 @@ module QA # To remove page refresh logic if possible # We don't raise on failure because this method is used as a predicate matcher retry_until(max_attempts: 3, reload: true, raise_on_failure: false) do - has_element?(:merged_status_content, text: /The changes were merged into|Changes merged into/, wait: 20) + has_element?('merged-status-content', text: /The changes were merged into|Changes merged into/, wait: 20) end end RSpec::Matchers.define :be_mergeable do match do |page| - page.has_element?(:merge_button, disabled: false) + page.has_element?('merge-button', disabled: false) end match_when_negated do |page| - page.has_no_element?(:merge_button, disabled: false) + page.has_no_element?('merge-button', disabled: false) end end # Waits up 10 seconds and returns false if the Revert button is not enabled def revertible? - has_element?(:revert_button, disabled: false, wait: 10) + has_element?('revert-button', disabled: false, wait: 10) end # Waits up 60 seconds and raises an error if unable to merge. @@ -348,12 +350,12 @@ module QA wait_until(message: "Waiting for ready to merge", sleep_interval: 1) do # changes in mr are rendered async, because of that mr can sometimes show no changes and there will be no # merge button, in such case we must retry loop otherwise find_element will raise ElementNotFound error - next false unless has_element?(:merge_button, wait: 1) + next false unless has_element?('merge-button', wait: 1) - break true unless find_element(:merge_button).disabled? + break true unless find_element('merge-button').disabled? # If the widget shows "Merge blocked: new changes were just added" we can refresh the page and check again - next false if has_element?(:head_mismatch_content, wait: 1) + next false if has_element?('head-mismatch-content', wait: 1) # Stop waiting if we're in a transient test. By this point we're in an unexpected state and should let the # test fail so we can investigate. If we're not in a transient test we keep trying until we reach timeout. @@ -368,25 +370,24 @@ module QA def rebase! # The rebase button is disabled on load wait_until do - has_element?(:mr_rebase_button) + has_element?('standard-rebase-button') end # The rebase button is enabled via JS wait_until(reload: false) do - !find_element(:mr_rebase_button).disabled? + !find_element('standard-rebase-button').disabled? end - click_element(:mr_rebase_button) + click_element('standard-rebase-button') end def merge_immediately! - close_rich_text_promo_popover_if_present retry_until(reload: true, sleep_interval: 1, max_attempts: 12) do - if has_element?(:merge_moment_dropdown) - click_element(:merge_moment_dropdown, skip_finished_loading_check: true) - click_element(:merge_immediately_menu_item, skip_finished_loading_check: true) + if has_element?('merge-immediately-dropdown') + click_element('merge-immediately-dropdown', skip_finished_loading_check: true) + click_element('merge-immediately-button', skip_finished_loading_check: true) else - click_element(:merge_button, skip_finished_loading_check: true) + click_element('merge-button', skip_finished_loading_check: true) end merged? @@ -394,13 +395,12 @@ module QA end def try_to_merge! - close_rich_text_promo_popover_if_present # Revisit after merge page re-architect is done https://gitlab.com/gitlab-org/gitlab/-/issues/300042 # To remove page refresh logic if possible wait_until_ready_to_merge - wait_until { !find_element(:merge_button).text.include?('when pipeline succeeds') } # rubocop:disable Rails/NegateInclude + wait_until { !find_element('merge-button').text.include?('when pipeline succeeds') } # rubocop:disable Rails/NegateInclude - click_element(:merge_button) + click_element('merge-button') end def view_email_patches @@ -421,7 +421,7 @@ module QA def wait_for_merge_request_error_message wait_until(max_duration: 30, reload: false) do - has_element?(:merge_request_error_content) + has_element?('merge-request-failed-refresh-button') end end @@ -436,43 +436,43 @@ module QA end def edit_file_in_web_ide(file_name) - within_element(:file_title_container, file_name: file_name) do - click_element(:dropdown_button) - click_element(:edit_in_ide_button) + within_element('file-title-container', file_name: file_name) do + click_element('options-dropdown-button') + click_element('edit-in-ide-button') end page.driver.browser.switch_to.window(page.driver.browser.window_handles.last) end def add_suggestion_to_diff(suggestion, line) find("a[data-linenumber='#{line}']").hover - click_element(:diff_comment_button) - click_element(:suggestion_button) - initial_content = find_element(:reply_field).value - fill_element(:reply_field, '') - fill_element(:reply_field, initial_content.gsub(/(```suggestion:-0\+0\n).*(\n```)/, "\\1#{suggestion}\\2")) - click_element(:comment_now_button) + click_element('left-comment-button') + click_element('suggestion-button') + initial_content = find_element('reply-field').value + fill_element('reply-field', '') + fill_element('reply-field', initial_content.gsub(/(```suggestion:-0\+0\n).*(\n```)/, "\\1#{suggestion}\\2")) + click_element('comment-now-button') wait_for_requests end def apply_suggestion_with_message(message) - all_elements(:apply_suggestion_dropdown, minimum: 1).first.click - fill_element(:commit_message_field, message) - click_element(:commit_with_custom_message_button) + all_elements('apply-suggestion-dropdown', minimum: 1).first.click + fill_element('commit-message-field', message) + click_element('commit-with-custom-message-button') end def add_suggestion_to_batch - all_elements(:add_suggestion_batch_button, minimum: 1).first.click + all_elements('add-suggestion-batch-button', minimum: 1).first.click end def has_suggestions_applied?(count = 1) wait_until(reload: false) do - has_no_element?(:applying_badge) + has_no_element?('applying-badge') end - all_elements(:applied_badge, count: count) + all_elements('applied-badge', count: count) end def cherry_pick! - click_element(:cherry_pick_button, Page::Component::CommitModal) + click_element('cherry-pick-button', Page::Component::CommitModal) click_element(:submit_commit_button) end @@ -480,18 +480,40 @@ module QA # reload page when the revert modal occasionally doesn't appear in ee:large-setup job # https://gitlab.com/gitlab-org/gitlab/-/issues/386623 (transient issue) retry_on_exception(reload: true) do - click_element(:revert_button, Page::Component::CommitModal) + click_element('revert-button', Page::Component::CommitModal) end click_element(:submit_commit_button) end def mr_widget_text - find_element(:mr_widget_content).text + find_element('mr-widget-content').text end def has_fork_icon? has_element?('fork-icon', skip_finished_loading_check: true) end + + def click_artifacts_dropdown_button + wait_for_requests + within_element('pipeline-container') do + click_element('base-dropdown-toggle') + end + end + + def has_artifact_with_name?(name) + has_text?(name) + end + + def open_exposed_artifacts_list + within_element('pipeline-container') do + wait_until(reload: false) { has_no_text?('Loading artifacts') } + click_element('mr-collapsible-title') + end + end + + def has_exposed_artifact_with_name?(name) + has_link?(name) + end end end end diff --git a/qa/qa/page/milestone/index.rb b/qa/qa/page/milestone/index.rb index 2e86dd4c0ab..85921d077d8 100644 --- a/qa/qa/page/milestone/index.rb +++ b/qa/qa/page/milestone/index.rb @@ -5,15 +5,15 @@ module QA module Milestone class Index < Page::Base view 'app/views/shared/milestones/_milestone.html.haml' do - element :milestone_link + element 'milestone-link' end def click_milestone(milestone) - click_element(:milestone_link, milestone_title: milestone.title) + click_element('milestone-link', milestone_title: milestone.title) end def has_milestone?(milestone) - has_element?(:milestone_link, milestone_title: milestone.title) + has_element?('milestone-link', milestone_title: milestone.title) end end end diff --git a/qa/qa/page/milestone/new.rb b/qa/qa/page/milestone/new.rb index 655254d74fa..31f8f4cc5a0 100644 --- a/qa/qa/page/milestone/new.rb +++ b/qa/qa/page/milestone/new.rb @@ -5,16 +5,16 @@ module QA module Milestone class New < Page::Base view 'app/views/shared/milestones/_form_dates.html.haml' do - element :due_date_field - element :start_date_field + element 'due-date-field' + element 'start-date-field' end def set_due_date(due_date) - fill_element(:due_date_field, due_date.to_s + "\n") + fill_element('due-date-field', due_date.to_s + "\n") end def set_start_date(start_date) - fill_element(:start_date_field, start_date.to_s + "\n") + fill_element('start-date-field', start_date.to_s + "\n") end end end diff --git a/qa/qa/page/milestone/show.rb b/qa/qa/page/milestone/show.rb index 0ab966534a3..b773335a4d1 100644 --- a/qa/qa/page/milestone/show.rb +++ b/qa/qa/page/milestone/show.rb @@ -7,23 +7,23 @@ module QA include Support::Dates view 'app/views/shared/milestones/_description.html.haml' do - element :milestone_description_content - element :milestone_title_content, required: true + element 'milestone-description-content' + element 'milestone-title-content', required: true end view 'app/views/shared/milestones/_sidebar.html.haml' do - element :due_date_content - element :start_date_content + element 'due-date-content' + element 'start-date-content' end def has_due_date?(due_date) formatted_due_date = format_date(due_date) - has_element?(:due_date_content, text: formatted_due_date) + has_element?('due-date-content', text: formatted_due_date) end def has_start_date?(start_date) formatted_start_date = format_date(start_date) - has_element?(:start_date_content, text: formatted_start_date) + has_element?('start-date-content', text: formatted_start_date) end end end diff --git a/qa/qa/page/modal/delete_issue.rb b/qa/qa/page/modal/delete_issue.rb index 9b51e969b48..8fb0c781d36 100644 --- a/qa/qa/page/modal/delete_issue.rb +++ b/qa/qa/page/modal/delete_issue.rb @@ -5,11 +5,11 @@ module QA module Modal class DeleteIssue < Base view 'app/assets/javascripts/issues/show/components/delete_issue_modal.vue' do - element :confirm_delete_issue_button, required: true + element 'confirm-delete-issue-button', required: true end def confirm_delete_issue - click_element :confirm_delete_issue_button + click_element('confirm-delete-issue-button') end end end diff --git a/qa/qa/page/project/artifacts/index.rb b/qa/qa/page/project/artifacts/index.rb new file mode 100644 index 00000000000..19285be430b --- /dev/null +++ b/qa/qa/page/project/artifacts/index.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Artifacts + class Index < QA::Page::Base + view 'app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue' do + element 'select-all-artifacts-checkbox' + end + + view 'app/assets/javascripts/ci/artifacts/components/artifacts_bulk_delete.vue' do + element 'bulk-delete-delete-button' + end + + view 'app/assets/javascripts/ci/artifacts/components/bulk_delete_modal.vue' do + element 'artifacts-bulk-delete-modal' + end + + view 'app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue' do + element 'job-artifacts-count' + element 'job-artifacts-size' + end + + def select_all + check_element('select-all-artifacts-checkbox', true) + end + + def delete_selected_artifacts + click_element('bulk-delete-delete-button') + + within_element('artifacts-bulk-delete-modal') do + find_element('.js-modal-action-primary').click + end + end + + def job_artifacts_count_by_row(row: 1) + all_elements('job-artifacts-count', minimum: row)[row - 1].text.gsub(/[^0-9]/, '').to_i + end + + def job_artifacts_size_by_row(row: 1) + all_elements('job-artifacts-size', minimum: row)[row - 1].text.gsub(/[^0-9]/, '').to_f + end + end + end + end + end +end diff --git a/qa/qa/page/project/import/github.rb b/qa/qa/page/project/import/github.rb index 9e1bf0a393f..08400042028 100644 --- a/qa/qa/page/project/import/github.rb +++ b/qa/qa/page/project/import/github.rb @@ -20,7 +20,7 @@ module QA end view "app/assets/javascripts/import_entities/components/import_target_dropdown.vue" do - element :target_namespace_selector_dropdown + element 'target-namespace-dropdown' end # Add personal access token @@ -46,7 +46,7 @@ module QA # @return [void] def import!(gh_project_name, target_group_path, project_name) within_element(:project_import_row, source_project: gh_project_name) do - click_element(:target_namespace_selector_dropdown) + click_element('target-namespace-dropdown') click_element("listbox-item-#{target_group_path}", wait: 10) fill_element(:project_path_field, project_name) diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 8092b69d377..e75682aee57 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -9,13 +9,12 @@ module QA include Page::Component::DesignManagement include Page::Component::Issuable::Sidebar include Page::Component::Issuable::Common - include Page::Component::RichTextPopover # We need to check phone_layout? instead of mobile_layout? here # since tablets have the regular top navigation bar prepend Mobile::Page::Project::Issue::Show if Runtime::Env.phone_layout? view 'app/assets/javascripts/issuable/components/related_issuable_item.vue' do - element :remove_related_issue_button + element 'remove-related-issue-button' end view 'app/assets/javascripts/issues/show/components/header_actions.vue' do @@ -24,41 +23,33 @@ module QA element 'delete-issue-button' end - view 'app/assets/javascripts/related_issues/components/add_issuable_form.vue' do - element :add_issue_button - end - - view 'app/assets/javascripts/related_issues/components/related_issuable_input.vue' do - element :add_issue_field - end - view 'app/assets/javascripts/related_issues/components/related_issues_block.vue' do element 'related-issues-plus-button' end view 'app/assets/javascripts/related_issues/components/related_issues_list.vue' do - element :related_issuable_content - element :related_issues_loading_placeholder + element 'related-issuable-content' + element 'related-issues-loading-placeholder' end def relate_issue(issue) click_element('related-issues-plus-button') - fill_element(:add_issue_field, issue.web_url) - send_keys_to_element(:add_issue_field, :enter) + fill_element('add-issue-field', issue.web_url) + send_keys_to_element('add-issue-field', :enter) end def related_issuable_item - find_element(:related_issuable_content) + find_element('related-issuable-content') end def wait_for_related_issues_to_load - has_no_element?(:related_issues_loading_placeholder, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) + has_no_element?('related-issues-loading-placeholder', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) end def click_remove_related_issue_button retry_until(sleep_interval: 5) do - click_element(:remove_related_issue_button) - has_no_element?(:remove_related_issue_button, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) + click_element('remove-related-issue-button') + has_no_element?('remove-related-issue-button', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) end end diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb index c2c1f6e4b79..a1ad3a50be7 100644 --- a/qa/qa/page/project/job/show.rb +++ b/qa/qa/page/project/job/show.rb @@ -72,8 +72,11 @@ module QA has_element?('artifacts-locked-message-content') end - def has_unlocked_artifact? - has_element?('artifacts-unlocked-message-content') + # Artifact unlock is async and depends on queue size on target env + def has_unlocked_artifact?(wait: 120) + wait_until(reload: true, max_duration: wait, sleep_interval: 1) do + has_element?('artifacts-unlocked-message-content') + end end def go_to_pipeline diff --git a/qa/qa/page/project/milestone/index.rb b/qa/qa/page/project/milestone/index.rb index d25a3389ae8..49515728db1 100644 --- a/qa/qa/page/project/milestone/index.rb +++ b/qa/qa/page/project/milestone/index.rb @@ -6,23 +6,23 @@ module QA module Milestone class Index < Page::Milestone::Index view 'app/views/projects/milestones/index.html.haml' do - element :new_project_milestone_link + element 'new-project-milestone-link' end view 'app/views/shared/milestones/_milestone.html.haml' do - element :milestone_link + element 'milestone-link' end def click_new_milestone_link - click_element :new_project_milestone_link + click_element('new-project-milestone-link') end def has_milestone?(milestone) - has_element? :milestone_link, milestone_title: milestone.title + has_element?('milestone-link', milestone_title: milestone.title) end def click_milestone(milestone) - click_element :milestone_link, milestone_title: milestone.title + click_element('milestone-link', milestone_title: milestone.title) end end end diff --git a/qa/qa/page/project/milestone/new.rb b/qa/qa/page/project/milestone/new.rb index 4df4988e056..a14e1e6b071 100644 --- a/qa/qa/page/project/milestone/new.rb +++ b/qa/qa/page/project/milestone/new.rb @@ -6,35 +6,22 @@ module QA module Milestone class New < Page::Milestone::New view 'app/views/projects/milestones/_form.html.haml' do - element :create_milestone_button + element 'create-milestone-button' element 'milestone-description-field' - element :milestone_title_field - end - - view 'app/views/shared/milestones/_form_dates.html.haml' do - element :due_date_field - element :start_date_field + element 'milestone-title-field' end def click_create_milestone_button - click_element :create_milestone_button + click_element('create-milestone-button') end def set_title(title) - fill_element :milestone_title_field, title + fill_element('milestone-title-field', title) end def set_description(description) fill_element('milestone-description-field', description) end - - def set_due_date(due_date) - fill_element :due_date_field, due_date.to_s + "\n" - end - - def set_start_date(start_date) - fill_element :start_date_field, start_date.to_s + "\n" - end end end end diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index a1086794b1f..5a050eaa8bb 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -5,32 +5,28 @@ module QA module Project module Pipeline class Index < QA::Page::Base - view 'app/assets/javascripts/ci/pipelines_page/components/pipeline_url.vue' do - element :pipeline_url_link - end + include Component::CiBadgeLink - view 'app/assets/javascripts/ci/pipelines_page/components/pipelines_status_badge.vue' do - element :pipeline_commit_status - end - - view 'app/assets/javascripts/ci/pipelines_page/components/pipeline_operations.vue' do - element :pipeline_retry_button + view 'app/assets/javascripts/ci/pipelines_page/components/pipeline_url.vue' do + element 'pipeline-url-link' end view 'app/assets/javascripts/ci/pipelines_page/components/nav_controls.vue' do - element :run_pipeline_button + element 'run-pipeline-button' end view 'app/assets/javascripts/ci/common/pipelines_table.vue' do - element :pipeline_row_container + element 'pipeline-table-row' end def latest_pipeline - all_elements(:pipeline_row_container, minimum: 1).first + all_elements('pipeline-table-row', minimum: 1).first end def latest_pipeline_status - latest_pipeline.find(element_selector_css(:pipeline_commit_status)).text + within(latest_pipeline) do + find_element('ci-badge-text') + end.text end # If no status provided, wait for pipeline to complete @@ -39,27 +35,31 @@ module QA finished_status = %w[passed failed canceled skipped manual] wait_until(max_duration: wait, reload: reload, sleep_interval: 1, message: "Wait for latest pipeline") do - status ? latest_pipeline_status == status : finished_status.include?(latest_pipeline_status) + if status + latest_pipeline_status.casecmp(status) == 0 + else + finished_status.include?(latest_pipeline_status.downcase) + end end end def has_any_pipeline?(wait: nil) wait ||= Support::Repeater::DEFAULT_MAX_WAIT_TIME wait_until(max_duration: wait, message: "Wait for any pipeline") do - has_element?(:pipeline_row_container) + has_element?('pipeline-table-row') end end def has_no_pipeline? - has_no_element?(:pipeline_row_container) + has_no_element?('pipeline-table-row') end def click_run_pipeline_button - click_element(:run_pipeline_button, Page::Project::Pipeline::New) + click_element('run-pipeline-button', Page::Project::Pipeline::New) end def click_on_latest_pipeline - latest_pipeline.find(element_selector_css(:pipeline_url_link)).click + latest_pipeline.find(element_selector_css('pipeline-url-link')).click end end end diff --git a/qa/qa/page/project/pipeline/new.rb b/qa/qa/page/project/pipeline/new.rb index 54c3bb0ddeb..33aa93d6204 100644 --- a/qa/qa/page/project/pipeline/new.rb +++ b/qa/qa/page/project/pipeline/new.rb @@ -6,45 +6,45 @@ module QA module Pipeline class New < QA::Page::Base view 'app/assets/javascripts/ci/pipeline_new/components/pipeline_new_form.vue' do - element :run_pipeline_button, required: true - element :ci_variable_row_container - element :ci_variable_key_field - element :ci_variable_value_field - element :ci_variable_value_dropdown - element :ci_variable_value_dropdown_item + element 'run-pipeline-button', required: true + element 'ci-variable-row-container' + element 'pipeline-form-ci-variable-key-field' + element 'pipeline-form-ci-variable-value-field' + element 'pipeline-form-ci-variable-value-dropdown' + element 'ci-variable-value-dropdown-item' end def click_run_pipeline_button - click_element(:run_pipeline_button, Page::Project::Pipeline::Show) + click_element('run-pipeline-button', Page::Project::Pipeline::Show) end def click_variable_dropdown return unless has_variable_dropdown? - click_element(:ci_variable_value_dropdown) + click_element('pipeline-form-ci-variable-value-dropdown') end def configure_variable(key: nil, value: 'foo', row_index: 0) - within_element_by_index(:ci_variable_row_container, row_index) do - fill_element(:ci_variable_key_field, key) unless key.nil? - fill_element(:ci_variable_value_field, value) + within_element_by_index('ci-variable-row-container', row_index) do + fill_element('pipeline-form-ci-variable-key-field', key) unless key.nil? + fill_element('pipeline-form-ci-variable-value-field', value) end end def has_variable_dropdown? - has_element?(:ci_variable_value_dropdown) + has_element?('pipeline-form-ci-variable-value-dropdown') end def variable_dropdown return unless has_variable_dropdown? - find_element(:ci_variable_value_dropdown) + find_element('pipeline-form-ci-variable-value-dropdown') end def variable_dropdown_item_with_index(index) return unless has_variable_dropdown? - within_element_by_index(:ci_variable_value_dropdown_item, index) do + within_element_by_index('ci-variable-value-dropdown-item', index) do find('p') end end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index db678ab1285..0caf373fffd 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -8,81 +8,64 @@ module QA include Component::CiBadgeLink view 'app/assets/javascripts/ci/pipeline_details/header/pipeline_details_header.vue' do - element :pipeline_details_header, required: true - end - - view 'app/assets/javascripts/ci/pipeline_details/graph/components/graph_component.vue' do - element :pipeline_graph, /class.*pipeline-graph.*/ # rubocop:disable QA/ElementWithPattern + element 'pipeline-details-header', required: true end view 'app/assets/javascripts/ci/pipeline_details/graph/components/job_item.vue' do - element :job_item_container, required: true - element :job_link, required: true - element :job_action_button - end - - view 'app/assets/javascripts/ci/pipeline_details/graph/components/linked_pipeline.vue' do - element :expand_linked_pipeline_button - element :linked_pipeline_container - element :downstream_title_content + element 'job-with-link', required: true end - view 'app/assets/javascripts/ci/reports/components/report_section.vue' do - element :expand_report_button + view 'app/assets/javascripts/ci/common/private/job_action_component.vue' do + element 'ci-action-button' end - view 'app/assets/javascripts/vue_shared/components/ci_icon.vue' do - element :status_icon, 'ci-status-icon-${status}' # rubocop:disable QA/ElementWithPattern + view 'app/assets/javascripts/ci/pipeline_details/graph/components/linked_pipeline.vue' do + element 'expand-pipeline-button' + element 'linked-pipeline-container' + element 'downstream-title-content' end view 'app/assets/javascripts/ci/pipeline_details/graph/components/job_group_dropdown.vue' do - element :job_dropdown_container - element :jobs_dropdown_menu + element 'job-dropdown-container' + element 'jobs-dropdown-menu' end - view 'app/views/layouts/nav/breadcrumbs/_breadcrumbs.html.haml' do - element :breadcrumb_links_content - element :breadcrumb_current_link - end - - def pipeline_id - within_element(:breadcrumb_links_content) do - find_element(:breadcrumb_current_link).text.delete_prefix('#') - end + view 'app/assets/javascripts/ci/pipeline_details/graph/components/stage_column_component.vue' do + element 'job-item-container', required: true end def running?(wait: 0) - within_element(:pipeline_details_header) do + within_element('pipeline-details-header') do page.has_content?('running', wait: wait) end end def has_build?(name, status: :success, wait: nil) if status - within_element(:job_item_container, text: name) do + within_element('job-item-container', text: name) do has_selector?(".ci-status-icon-#{status}", **{ wait: wait }.compact) end else - has_element?(:job_item_container, text: name) + has_element?('job-item-container', text: name) end end def has_job?(job_name) - has_element?(:job_link, text: job_name) + has_element?('job-with-link', text: job_name) end def has_no_job?(job_name) - has_no_element?(:job_link, text: job_name) + has_no_element?('job-with-link', text: job_name) end def linked_pipelines - all_elements(:linked_pipeline_container, minimum: 1) + all_elements('linked-pipeline-container', minimum: 1) end def find_linked_pipeline_by_title(title) linked_pipelines.find do |pipeline| within(pipeline) do - find_element(:downstream_title_content).text.include?(title) + find_element('downstream-title-content').text.include?(title) end end end @@ -91,14 +74,14 @@ module QA # If the pipeline page has loaded linked pipelines should appear, but it can take a little while, # especially on busier environments. retry_until(reload: true, message: 'Waiting for linked pipeline to appear') do - title ? find_linked_pipeline_by_title(title) : has_element?(:linked_pipeline_container) + title ? find_linked_pipeline_by_title(title) : has_element?('linked-pipeline-container') end end alias_method :has_child_pipeline?, :has_linked_pipeline? def has_no_linked_pipeline? - has_no_element?(:linked_pipeline_container) + has_no_element?('linked-pipeline-container') end alias_method :has_no_child_pipeline?, :has_no_linked_pipeline? @@ -106,19 +89,13 @@ module QA def expand_linked_pipeline(title: nil) linked_pipeline = title ? find_linked_pipeline_by_title(title) : linked_pipelines.first - within_element_by_index(:linked_pipeline_container, linked_pipelines.index(linked_pipeline)) do - click_element(:expand_linked_pipeline_button) + within_element_by_index('linked-pipeline-container', linked_pipelines.index(linked_pipeline)) do + click_element('expand-pipeline-button') end end alias_method :expand_child_pipeline, :expand_linked_pipeline - def expand_license_report - within_element(:license_report_widget) do - click_element(:expand_report_button) - end - end - def click_on_first_job first('.js-pipeline-graph-job-link', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).click end @@ -126,33 +103,33 @@ module QA def click_job(job_name) # Retry due to transient bug https://gitlab.com/gitlab-org/gitlab/-/issues/347126 QA::Support::Retrier.retry_on_exception do - click_element(:job_link, Project::Job::Show, text: job_name) + click_element('job-with-link', Project::Job::Show, text: job_name) end end def click_job_action(job_name) wait_for_requests - within_element(:job_item_container, text: job_name) do - click_element(:job_action_button) + within_element('job-item-container', text: job_name) do + click_element('ci-action-button') end end def click_job_dropdown(job_dropdown_name) - click_element(:job_dropdown_container, text: job_dropdown_name) + click_element('job-dropdown-container', text: job_dropdown_name) end def has_skipped_job_in_group? - within_element(:jobs_dropdown_menu) do - all_elements(:job_item_container, minimum: 1).all? do + within_element('jobs-dropdown-menu') do + all_elements('job-with-link', minimum: 1).all? do has_selector?('.ci-status-icon-skipped') end end end def has_no_skipped_job_in_group? - within_element(:jobs_dropdown_menu) do - all_elements(:job_item_container, minimum: 1).all? do + within_element('jobs-dropdown-menu') do + all_elements('job-with-link', minimum: 1).all? do has_no_selector?('.ci-status-icon-skipped') end end diff --git a/qa/qa/page/project/secure/configuration_form.rb b/qa/qa/page/project/secure/configuration_form.rb index 32609943f3e..28d96d54caf 100644 --- a/qa/qa/page/project/secure/configuration_form.rb +++ b/qa/qa/page/project/secure/configuration_form.rb @@ -14,8 +14,8 @@ module QA view 'app/assets/javascripts/security_configuration/components/feature_card.vue' do element 'feature-status' - element :sast_enable_button, "`${feature.type}_enable_button`" # rubocop:disable QA/ElementWithPattern - element :dependency_scanning_mr_button, "`${feature.type}_mr_button`" # rubocop:disable QA/ElementWithPattern + element 'sast-enable-button', "`${hyphenatedFeature}-enable-button`" # rubocop:disable QA/ElementWithPattern + element 'dependency-scanning-mr-button', "`${hyphenatedFeature}-mr-button`" # rubocop:disable QA/ElementWithPattern end view 'app/assets/javascripts/security_configuration/components/auto_dev_ops_alert.vue' do @@ -35,11 +35,11 @@ module QA end def click_sast_enable_button - click_element(:sast_enable_button) + click_element('sast-enable-button') end def click_dependency_scanning_mr_button - click_element(:dependency_scanning_mr_button) + click_element('dependency-scanning-mr-button') end def has_true_sast_status? diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb index fcfcecdc183..28e48c0fd2c 100644 --- a/qa/qa/page/project/settings/advanced.rb +++ b/qa/qa/page/project/settings/advanced.rb @@ -10,31 +10,31 @@ module QA include Component::NamespaceSelect view 'app/assets/javascripts/projects/components/shared/delete_button.vue' do - element :delete_button + element 'delete-button' end view 'app/views/projects/edit.html.haml' do - element :project_path_field - element :change_path_button + element 'project-path-field' + element 'change-path-button' end view 'app/views/projects/settings/_archive.html.haml' do - element :archive_project_link - element :unarchive_project_link + element 'archive-project-link' + element 'unarchive-project-link' end view 'app/views/projects/_export.html.haml' do - element :export_project_link - element :download_export_link - element :export_project_content + element 'export-project-link' + element 'download-export-link' + element 'export-project-content' end view 'app/views/projects/_transfer.html.haml' do - element :transfer_project_content + element 'transfer-project-content' end view 'app/assets/javascripts/projects/settings/components/transfer_project_form.vue' do - element :transfer_project_button + element 'transfer-project-button' end def update_project_path_to(path) @@ -43,11 +43,11 @@ module QA end def fill_project_path(path) - fill_element :project_path_field, path + fill_element 'project-path-field', path end def click_change_path_button - click_element :change_path_button + click_element 'change-path-button' end def transfer_project!(project_name, namespace) @@ -61,36 +61,36 @@ module QA wait_for_enabled_transfer_project_button - click_element :transfer_project_button + click_element 'transfer-project-button' fill_confirmation_text(project_name) confirm_transfer end def click_export_project_link - click_element :export_project_link + click_element 'export-project-link' end def click_download_export_link - click_element :download_export_link + click_element 'download-export-link' end def has_download_export_link? - has_element? :download_export_link + has_element? 'download-export-link' end def archive_project - click_element :archive_project_link + click_element 'archive-project-link' click_confirmation_ok_button end def unarchive_project - click_element :unarchive_project_link + click_element 'unarchive-project-link' click_confirmation_ok_button end def delete_project!(project_name) - click_element :delete_button + click_element 'delete-button' fill_confirmation_path(project_name) wait_for_delete_button_enabled confirm_delete @@ -100,15 +100,15 @@ module QA def scroll_to_transfer_project_content retry_until(sleep_interval: 1, message: 'Waiting for transfer project content to display') do - has_element?(:transfer_project_content, wait: 3) + has_element?('transfer-project-content', wait: 3) end - scroll_to_element :transfer_project_content + scroll_to_element 'transfer-project-content' end def wait_for_enabled_transfer_project_button retry_until(sleep_interval: 1, message: 'Waiting for transfer project button to be enabled') do - has_element?(:transfer_project_button, disabled: false, wait: 3) + has_element?('transfer-project-button', disabled: false, wait: 3) end end end diff --git a/qa/qa/page/project/settings/ci_variables.rb b/qa/qa/page/project/settings/ci_variables.rb index 36c667866b5..8057dfdf2dd 100644 --- a/qa/qa/page/project/settings/ci_variables.rb +++ b/qa/qa/page/project/settings/ci_variables.rb @@ -7,12 +7,19 @@ module QA class CiVariables < Page::Base include QA::Page::Settings::Common + # TODO: remove this when the ci_variable_drawer feature flag is enabled by default view 'app/assets/javascripts/ci/ci_variable_list/components/ci_variable_modal.vue' do element :ci_variable_key_field element :ci_variable_value_field element :ci_variable_save_button end + view 'app/assets/javascripts/ci/ci_variable_list/components/ci_variable_drawer.vue' do + element :ci_variable_key_field + element :ci_variable_value_field + element :ci_variable_save_button + end + def fill_variable(key, value, masked = false) within_element(:ci_variable_key_field) { find('input').set key } fill_element :ci_variable_value_field, value diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb index 0d45efdcb70..1fa5a4c6fa3 100644 --- a/qa/qa/page/project/settings/main.rb +++ b/qa/qa/page/project/settings/main.rb @@ -10,18 +10,18 @@ module QA include Layout::Flash view 'app/views/projects/edit.html.haml' do - element :advanced_settings_content - element :visibility_features_permissions_content - element :badges_settings_content + element 'advanced-settings-content' + element 'visibility-features-permissions-content' + element 'badges-settings-content' end view 'app/views/projects/settings/merge_requests/show.html.haml' do - element :merge_request_settings_content + element 'merge-request-settings-content' end view 'app/views/projects/settings/_general.html.haml' do - element :project_name_field - element :save_naming_topics_avatar_button + element 'project-name-field' + element 'save-naming-topics-avatar-button' end def rename_project_to(name) @@ -30,27 +30,27 @@ module QA end def fill_project_name(name) - fill_element :project_name_field, name + fill_element 'project-name-field', name end def click_save_changes - click_element :save_naming_topics_avatar_button + click_element 'save-naming-topics-avatar-button' end def expand_advanced_settings(&block) - expand_content(:advanced_settings_content) do + expand_content('advanced-settings-content') do Advanced.perform(&block) end end def expand_visibility_project_features_permissions(&block) - expand_content(:visibility_features_permissions_content) do + expand_content('visibility-features-permissions-content') do VisibilityFeaturesPermissions.perform(&block) end end def expand_badges_settings(&block) - expand_content(:badges_settings_content) do + expand_content('badges-settings-content') do Component::Badges.perform(&block) end end diff --git a/qa/qa/page/project/settings/protected_branches.rb b/qa/qa/page/project/settings/protected_branches.rb index aab2c5ed6bd..8358a4ae33e 100644 --- a/qa/qa/page/project/settings/protected_branches.rb +++ b/qa/qa/page/project/settings/protected_branches.rb @@ -12,8 +12,8 @@ module QA end view 'app/views/protected_branches/shared/_dropdown.html.haml' do - element :protected_branch_dropdown - element :protected_branch_dropdown_content + element 'protected-branch-dropdown' + element 'protected-branch-dropdown-content' end view 'app/assets/javascripts/protected_branches/protected_branch_create.js' do @@ -26,11 +26,11 @@ module QA end def select_branch(branch_name) - click_element 'add-protected-branch-button' - click_element :protected_branch_dropdown + click_element('add-protected-branch-button') + click_element('protected-branch-dropdown') - within_element(:protected_branch_dropdown_content) do - click_on branch_name + within_element('protected-branch-dropdown-content') do + click_on(branch_name) end end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 59cccfd665a..acc0f4cc293 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -14,15 +14,15 @@ module QA prepend Mobile::Page::Project::Show if Runtime::Env.phone_layout? view 'app/assets/javascripts/repository/components/preview/index.vue' do - element :blob_viewer_content + element 'blob-viewer-content' end view 'app/assets/javascripts/repository/components/table/row.vue' do - element :file_name_link + element 'file-name-link' end view 'app/assets/javascripts/repository/components/table/index.vue' do - element :file_tree_table + element 'file-tree-table' end view 'app/views/layouts/header/_new_dropdown.html.haml' do @@ -30,23 +30,22 @@ module QA end view 'app/views/projects/_last_push.html.haml' do - element :create_merge_request_button + element 'create-merge-request-button' end view 'app/views/projects/_home_panel.html.haml' do - element :project_name_content - element :project_id_content - element :project_badges_content - element :badge_image_link + element 'project-name-content' + element 'project-id-content' + element 'project-badges-content' + element 'badge-image-link' end view 'app/views/projects/_files.html.haml' do - element :project_buttons - element :tree_holder, '.tree-holder' # rubocop:disable QA/ElementWithPattern + element 'project-buttons' end view 'app/assets/javascripts/repository/components/fork_info.vue' do - element :forked_from_link + element 'forked-from-link' end view 'app/assets/javascripts/forks/components/forks_button.vue' do @@ -54,39 +53,39 @@ module QA end view 'app/views/projects/empty.html.haml' do - element :quick_actions_container + element 'quick-actions-container' end view 'app/assets/javascripts/repository/components/breadcrumbs.vue' do - element :add_to_tree_dropdown - element :new_file_menu_item + element 'add-to-tree' + element 'new-file-menu-item' end view 'app/views/projects/blob/viewers/_loading.html.haml' do - element :spinner_placeholder + element 'spinner-placeholder' end view 'app/views/projects/buttons/_download.html.haml' do - element :download_source_code_button + element 'download-source-code-button' end view 'app/views/projects/tree/_tree_header.html.haml' do - element :ref_dropdown_container + element 'ref-dropdown-container' end def wait_for_viewers_to_load - has_no_element?(:spinner_placeholder, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) + has_no_element?('spinner-placeholder', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) end def create_first_new_file! - within_element(:quick_actions_container) do + within_element('quick-actions-container') do click_link_with_text 'New file' end end def create_new_file! - click_element :add_to_tree_dropdown - click_element :new_file_menu_item + click_element 'add-to-tree' + click_element 'new-file-menu-item' end # Click by JS is needed to bypass the VSCode Web IDE popover @@ -98,47 +97,47 @@ module QA end def forked_from?(parent_project_name) - has_element?(:forked_from_link, text: parent_project_name) + has_element?('forked-from-link', text: parent_project_name) end def click_file(filename) - within_element(:file_tree_table) do - click_element(:file_name_link, text: filename) + within_element('file-tree-table') do + click_element('file-name-link', text: filename) end end def click_commit(commit_msg) wait_for_requests - within_element(:file_tree_table) do + within_element('file-tree-table') do click_on commit_msg end end def has_create_merge_request_button? - has_css?(element_selector_css(:create_merge_request_button)) + has_css?(element_selector_css('create-merge-request-button')) end def has_file?(name) - return false unless has_element?(:file_tree_table) + return false unless has_element?('file-tree-table') - within_element(:file_tree_table) do - has_element?(:file_name_link, text: name) + within_element('file-tree-table') do + has_element?('file-name-link', text: name) end end def has_no_file?(name) - within_element(:file_tree_table) do - has_no_element?(:file_name_link, text: name) + within_element('file-tree-table') do + has_no_element?('file-name-link', text: name) end end def has_name?(name) - has_element?(:project_name_content, text: name) + has_element?('project-name-content', text: name) end def has_readme_content?(text) - has_element?(:blob_viewer_content, text: text) + has_element?('blob-viewer-content', text: text) end def new_merge_request @@ -146,7 +145,7 @@ module QA has_create_merge_request_button? end - click_element :create_merge_request_button + click_element 'create-merge-request-button' end def open_web_ide! @@ -166,34 +165,28 @@ module QA end def project_name - find_element(:project_name_content).text + find_element('project-name-content').text end def project_id - find_element(:project_id_content).text.delete('Project ID: ') + find_element('project-id-content').text.delete('Project ID: ') end def switch_to_branch(branch_name) - within_element(:ref_dropdown_container) do + within_element('ref-dropdown-container') do expand_select_list select_item(branch_name) end end - def wait_for_import - wait_until(reload: true) do - has_css?('.tree-holder') - end - end - def has_visible_badge_image_link?(link_url) - within_element(:project_badges_content) do - has_element?(:badge_image_link, link_url: link_url) + within_element('project-badges-content') do + has_element?('badge-image-link', link_url: link_url) end end def has_license?(name) - within_element(:project_buttons) do + within_element('project-buttons') do has_link?(name) end end diff --git a/qa/qa/page/project/snippet/index.rb b/qa/qa/page/project/snippet/index.rb index 704698dc9d8..0ed2453bf77 100644 --- a/qa/qa/page/project/snippet/index.rb +++ b/qa/qa/page/project/snippet/index.rb @@ -9,15 +9,15 @@ module QA include Page::Component::BlobContent view 'app/views/shared/snippets/_snippet.html.haml' do - element :snippet_link + element 'snippet-link' end def has_project_snippet?(title) - has_element?(:snippet_link, snippet_title: title) + has_element?('snippet-link', snippet_title: title) end def click_snippet_link(title) - within_element(:snippet_link, text: title) do + within_element('snippet-link', text: title) do click_link(title) end end diff --git a/qa/qa/page/project/snippet/new.rb b/qa/qa/page/project/snippet/new.rb index 4a13e597e15..1a7e771ce7b 100644 --- a/qa/qa/page/project/snippet/new.rb +++ b/qa/qa/page/project/snippet/new.rb @@ -8,8 +8,8 @@ module QA include Page::Component::NewSnippet include Component::LazyLoader view 'app/views/shared/empty_states/_snippets.html.haml' do - element :create_first_snippet_link - element :svg_content + element 'create-first-snippet-link' + element 'svg-content' end def click_create_first_snippet @@ -19,10 +19,10 @@ module QA # "New snippet" button shifts up a bit. This can cause # webdriver to miss the hit so we wait for the svg to load before # clicking the button. - within_element(:svg_content) do - has_element?(:js_lazy_loaded_content) + within_element('svg-content') do + has_element?('js-lazy-loaded-content') end - click_element(:create_first_snippet_link) + click_element('create-first-snippet-link') end end end diff --git a/qa/qa/page/project/snippet/show.rb b/qa/qa/page/project/snippet/show.rb index 89723baf424..3727f4c6579 100644 --- a/qa/qa/page/project/snippet/show.rb +++ b/qa/qa/page/project/snippet/show.rb @@ -9,7 +9,7 @@ module QA include Page::Component::BlobContent view 'app/views/projects/notes/_actions.html.haml' do - element :edit_comment_button + element 'edit-comment-button' end end end diff --git a/qa/qa/page/project/sub_menus/build.rb b/qa/qa/page/project/sub_menus/build.rb index f9827cfdd5e..546390deaa3 100644 --- a/qa/qa/page/project/sub_menus/build.rb +++ b/qa/qa/page/project/sub_menus/build.rb @@ -23,16 +23,8 @@ module QA open_build_submenu('Pipeline schedules') end - def go_to_environments - open_operations_submenu('Environments') - end - - def go_to_feature_flags - open_operations_submenu('Feature Flags') - end - - def go_to_releases - open_operations_submenu('Releases') + def go_to_artifacts + open_build_submenu('Artifacts') end private diff --git a/qa/qa/page/project/sub_menus/common.rb b/qa/qa/page/project/sub_menus/common.rb index 563bc9257c5..0619afc313c 100644 --- a/qa/qa/page/project/sub_menus/common.rb +++ b/qa/qa/page/project/sub_menus/common.rb @@ -14,7 +14,7 @@ module QA include QA::Page::SubMenus::Common view 'app/views/layouts/nav/_top_bar.html.haml' do - element :toggle_mobile_nav_button + element 'toggle-mobile-nav-button' end end end diff --git a/qa/qa/page/project/web_ide/edit.rb b/qa/qa/page/project/web_ide/edit.rb index 16eaa7efba9..a835ba9e85f 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -267,13 +267,13 @@ module QA def create_first_file(file_name) click_element(:first_file_button, Page::Component::WebIDE::Modal::CreateNewFile) - fill_element(:file_name_field, file_name) + fill_element('file-name-field', file_name) click_button('Create file') end def add_file(file_name, file_text) click_element(:new_file_button, Page::Component::WebIDE::Modal::CreateNewFile) - fill_element(:file_name_field, file_name) + fill_element('file-name-field', file_name) click_button('Create file') wait_until(reload: false) { has_file?(file_name) } within_element(:editor_container) do @@ -283,7 +283,7 @@ module QA def add_directory(directory_name) click_element(:new_directory_button, Page::Component::WebIDE::Modal::CreateNewFile) - fill_element(:file_name_field, directory_name) + fill_element('file-name-field', directory_name) click_button('Create directory') wait_until(reload: false) { has_file?(directory_name) } end @@ -292,7 +292,7 @@ module QA click_element('file-row-name-container', file_name: file_name) click_element(:dropdown_button) click_element(:rename_move_button, Page::Component::WebIDE::Modal::CreateNewFile) - fill_element(:file_name_field, new_file_name) + fill_element('file-name-field', new_file_name) click_button('Rename file') end diff --git a/qa/qa/page/project/web_ide/vscode.rb b/qa/qa/page/project/web_ide/vscode.rb index 8f257e95f3e..74194b85ebe 100644 --- a/qa/qa/page/project/web_ide/vscode.rb +++ b/qa/qa/page/project/web_ide/vscode.rb @@ -7,91 +7,94 @@ module QA module WebIDE class VSCode < Page::Base view 'app/views/shared/_broadcast_message.html.haml' do - element :broadcast_notification_container - element :close_button + element 'broadcast-notification-container' + element 'close-button' end def has_file_explorer? - page.has_css?('.explorer-folders-view', visible: true) - page.has_css?('[aria-label="Files Explorer"]', visible: true) + has_element?('div[aria-label="Files Explorer"]') end def right_click_file_explorer - page.find('.explorer-folders-view', visible: true).right_click + has_element?('div.monaco-list-rows') + find_element('div[aria-label="Files Explorer"]').right_click end - def has_new_folder_menu_item? - page.has_css?('[aria-label="New Folder..."]', visible: true) + def open_file_from_explorer(file_name) + click_element("div[aria-label='#{file_name}']") end - def click_new_folder_menu_item - page.find('[aria-label="New Folder..."]').click + def click_inside_editor_frame + click_element('.monaco-editor') end - def enter_new_folder_text_input(name) - page.find('.explorer-item-edited', visible: true) - send_keys(name, :enter) + def within_file_editor(&block) + within_element('.monaco-editor', &block) end - def has_upload_menu_item? - page.has_css?('.menu-item-check', visible: true) + def has_right_click_menu_item? + has_element?('div.menu-item-check') + end + + def click_new_folder_menu_item + click_element('span[aria-label="New Folder..."]') end def click_upload_menu_item - page.find('[aria-label="Upload..."]', visible: true).click + click_element('span[aria-label="Upload..."]') + end + + def enter_new_folder_text_input(name) + find_element('input[type="text"]') + send_keys(name, :enter) end def enter_file_input(file) - page.find('input[type="file"]', visible: false).send_keys(file) + find_element('input[type="file"]', visible: false).send_keys(file) end def has_commit_pending_tab? - page.has_css?('.scm-viewlet-label', visible: true) + has_element?('.scm-viewlet-label') end def click_commit_pending_tab - page.find('.scm-viewlet-label', visible: true).click + click_element('.scm-viewlet-label', visible: true) end def click_commit_tab - page.find('a.codicon-source-control-view-icon', visible: true).click + click_element('.codicon-source-control-view-icon') end def has_commit_message_box? - page.has_css?('div.view-lines.monaco-mouse-cursor-text', visible: true) + has_element?('div[aria-label="Source Control Input"]') end def enter_commit_message(message) - page.find('div.view-lines.monaco-mouse-cursor-text', visible: true).send_keys(message) + within_element('div[aria-label="Source Control Input"]') do + find_element('.view-line').click + send_keys(message) + end end def click_commit_button - page.find('a.monaco-text-button', visible: true).click + click_element('div[aria-label="Commit to \'main\'"]') end def has_notification_box? - page.has_css?('a.monaco-text-button', visible: true) - end - - def create_merge_request - Support::Waiter.wait_until(max_duration: 10, retry_on_exception: true) do - within_vscode_editor do - page.find('.monaco-button[title="Create MR"]').click - end - end + has_element?('.monaco-dialog-box') end def click_new_branch - page.find('.monaco-button[title="Create new branch"]').click + click_element('.monaco-button[title="Create new branch"]') end def has_branch_input_field? - page.has_css?('.monaco-findInput', visible: true) + has_element?('input[aria-label="input"]') end def has_message?(content) within_vscode_editor do - page.has_content?(content) + has_text?(content) end end @@ -104,9 +107,9 @@ module QA def wait_for_ide_to_load page.driver.browser.switch_to.window(page.driver.browser.window_handles.last) # On test environments we have a broadcast message that can cover the buttons - if has_element?(:broadcast_notification_container, wait: 5) - within_element(:broadcast_notification_container) do - click_element(:close_button) + if has_element?('broadcast-notification-container', wait: 5) + within_element('broadcast-notification-container') do + click_element('close-button') end end @@ -121,15 +124,14 @@ module QA def create_new_folder(name) within_vscode_editor do - right_click_file_explorer - has_new_folder_menu_item? - # Use for stability, WebIDE inside an iframe is finnicky, webdriver sometimes moves too fast Support::Waiter.wait_until(max_duration: 20, retry_on_exception: true) do + right_click_file_explorer + has_right_click_menu_item? click_new_folder_menu_item # Verify New Folder button is triggered and textbox is waiting for input enter_new_folder_text_input(name) - page.has_content?(name) + has_text?(name) end end end @@ -148,8 +150,8 @@ module QA end has_commit_message_box? - send_keys(message) - page.has_content?(message) + enter_commit_message(message) + has_text?(message) click_commit_button has_notification_box? end @@ -164,8 +166,14 @@ module QA end end + def create_merge_request + within_vscode_editor do + has_element?('div[title="GitLab Web IDE Extension (Extension)"]') + click_element('.monaco-button[title="Create MR"]') + end + end + def upload_file(file_path) - wait_for_ide_to_load within_vscode_editor do # VSCode eagerly removes the input[type='file'] from click on Upload. # We need to execute a script on the iframe to stub out the iframes body.removeChild to add it back in. @@ -174,10 +182,40 @@ module QA # Use for stability, WebIDE inside an iframe is finnicky, webdriver sometimes moves too fast Support::Waiter.wait_until(max_duration: 20, retry_on_exception: true) do right_click_file_explorer - has_upload_menu_item? + has_right_click_menu_item? click_upload_menu_item enter_file_input(file_path) end + # Wait for the file to be uploaded + has_text?(file_path) + end + end + + def add_file_content(prompt_data) + within_vscode_editor do + click_inside_editor_frame + within_file_editor do + send_keys(:enter, :enter, prompt_data) + end + end + end + + def verify_prompt_appears_and_accept(pattern) + within_vscode_editor do + within_file_editor do + Support::Waiter.wait_until(max_duration: 30) do + page.text.match?(pattern) + end + send_keys(:tab) + end + end + end + + def validate_prompt(pattern) + within_vscode_editor do + within_file_editor do + page.text.match?(pattern) + end end end end diff --git a/qa/qa/page/project/wiki/list.rb b/qa/qa/page/project/wiki/list.rb index 785847011bf..224199256e1 100644 --- a/qa/qa/page/project/wiki/list.rb +++ b/qa/qa/page/project/wiki/list.rb @@ -6,15 +6,15 @@ module QA module Wiki class List < Base view 'app/views/shared/wikis/_pages_wiki_page.html.haml' do - element :wiki_page_link + element 'wiki-page-link' end def click_page_link(page_title) - click_element :wiki_page_link, page_name: page_title + click_element 'wiki-page-link', page_name: page_title end def has_page_listed?(page_title) - has_element? :wiki_page_link, page_name: page_title + has_element? 'wiki-page-link', page_name: page_title end end end diff --git a/qa/qa/page/registration/welcome.rb b/qa/qa/page/registration/welcome.rb deleted file mode 100644 index bf7b970f12e..00000000000 --- a/qa/qa/page/registration/welcome.rb +++ /dev/null @@ -1,39 +0,0 @@ -# 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 - element :role_dropdown - end - - def has_get_started_button?(wait: Capybara.default_max_wait_time) - has_element?(:get_started_button, wait: wait) - end - - def select_role(role) - select_element(:role_dropdown, role) - end - - def choose_setup_for_just_me_if_available - # Only implemented in EE - end - - def choose_create_a_new_project_if_available - # Only implemented in EE - end - - def click_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 - -QA::Page::Registration::Welcome.prepend_mod_with('Page::Registration::Welcome', namespace: QA) diff --git a/qa/qa/page/search/results.rb b/qa/qa/page/search/results.rb index a04fd9092d1..9e56d000070 100644 --- a/qa/qa/page/search/results.rb +++ b/qa/qa/page/search/results.rb @@ -16,7 +16,7 @@ module QA end view 'app/views/shared/projects/_project.html.haml' do - element :project_content + element 'project-content' end def switch_to_code @@ -40,7 +40,7 @@ module QA end def has_project?(project_name) - has_element?(:project_content, project_name: project_name) + has_element?('project-content', project_name: project_name) end private diff --git a/qa/qa/page/user/show.rb b/qa/qa/page/user/show.rb index e5ee943a69d..62e08dc8c63 100644 --- a/qa/qa/page/user/show.rb +++ b/qa/qa/page/user/show.rb @@ -5,7 +5,7 @@ module QA module User class Show < Page::Base view 'app/views/users/_follow_user.html.haml' do - element :follow_user_link + element 'follow-user-link' end view 'app/views/shared/users/_user.html.haml' do @@ -13,11 +13,11 @@ module QA end view 'app/views/users/_overview.html.haml' do - element :user_activity_content + element 'user-activity-content' end def click_follow_user_link - click_element(:follow_user_link) + click_element('follow-user-link') end def click_following_tab @@ -29,7 +29,7 @@ module QA end def has_activity?(activity) - within_element(:user_activity_content) do + within_element('user-activity-content') do has_text?(activity) end end |