Commit a63d5d34 authored by svistas's avatar svistas

Rename selectors to use expand_content convention

Prior to this change, the use of expand_section and
expand_settings were not conforming to the
convention in the style guide.

This change introduces expand_content to adhere
to the naming convention stated in element-naming-convention doc.
parent ae5b0983
......@@ -13,7 +13,7 @@
.settings-content
= render 'visibility_and_access'
%section.settings.qa-account-and-limit-settings.as-account-limit.no-animate#js-account-settings{ class: ('expanded' if expanded_by_default?) }
%section.settings.as-account-limit.no-animate#js-account-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'account_and_limit_settings_content' } }
.settings-header
%h4
= _('Account and limit')
......
......@@ -24,7 +24,7 @@
.settings-content
= render 'grafana'
%section.settings.qa-performance-bar-settings.as-performance-bar.no-animate#js-performance-bar-settings{ class: ('expanded' if expanded_by_default?) }
%section.settings.as-performance-bar.no-animate#js-performance-bar-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'performance_bar_settings_content' } }
.settings-header
%h4
= _('Profiling - Performance bar')
......
......@@ -13,7 +13,7 @@
.settings-content
= render 'performance'
%section.settings.as-ip-limits.no-animate#js-ip-limits-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'ip_limits_section' } }
%section.settings.as-ip-limits.no-animate#js-ip-limits-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'ip_limits_content' } }
.settings-header
%h4
= _('User and IP Rate Limits')
......@@ -24,7 +24,7 @@
.settings-content
= render 'ip_limits'
%section.settings.as-outbound.no-animate#js-outbound-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'outbound_requests_section' } }
%section.settings.as-outbound.no-animate#js-outbound-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'outbound_requests_content' } }
.settings-header
%h4
= _('Outbound requests')
......
......@@ -2,7 +2,7 @@
- page_title _("Preferences")
- @content_class = "limit-container-width" unless fluid_layout
%section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'email_section' } }
%section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'email_content' } }
.settings-header
%h4
= _('Email')
......
......@@ -25,7 +25,7 @@
.settings-content
= render partial: 'repository_mirrors_form'
%section.settings.qa-repository-storage-settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded_by_default?) }
%section.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded_by_default?), data: { qa_selector: 'repository_storage_settings_content' } }
.settings-header
%h4
= _('Repository storage')
......
......@@ -15,7 +15,7 @@
.settings-content
= render 'groups/settings/general'
%section.settings.gs-permissions.no-animate#js-permissions-settings{ class: ('expanded' if expanded), data: { qa_selector: 'permission_lfs_2fa_section' } }
%section.settings.gs-permissions.no-animate#js-permissions-settings{ class: ('expanded' if expanded), data: { qa_selector: 'permission_lfs_2fa_content' } }
.settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only{ role: 'button' }
= _('Permissions, LFS, 2FA')
......
......@@ -223,7 +223,7 @@
%span.nav-item-name.qa-admin-settings-item
= _('Settings')
%ul.sidebar-sub-level-items.qa-admin-sidebar-settings-submenu
%ul.sidebar-sub-level-items{ data: { qa_selector: 'admin_sidebar_settings_submenu_content' } }
= nav_link(controller: [:application_settings, :integrations], html_options: { class: "fly-out-top-item" } ) do
= link_to general_admin_application_settings_path do
%strong.fly-out-top-item-name
......
......@@ -3,7 +3,7 @@
- mirror_settings_enabled = can?(current_user, :admin_remote_mirror, @project)
- mirror_settings_class = "#{'expanded' if expanded} #{'js-mirror-settings' if mirror_settings_enabled}".strip
%section.settings.project-mirror-settings.no-animate#js-push-remote-settings{ class: mirror_settings_class, data: { qa_selector: 'mirroring_repositories_settings_section' } }
%section.settings.project-mirror-settings.no-animate#js-push-remote-settings{ class: mirror_settings_class, data: { qa_selector: 'mirroring_repositories_settings_content' } }
.settings-header
%h4= _('Mirroring repositories')
%button.btn.js-settings-toggle
......
- expanded = expanded_by_default?
%section.qa-protected-branches-settings.settings.no-animate#js-protected-branches-settings{ class: ('expanded' if expanded) }
%section.settings.no-animate#js-protected-branches-settings{ class: ('expanded' if expanded), data: { qa_selector: 'protected_branches_settings_content' } }
.settings-header
%h4
Protected Branches
......
- expanded = expanded_by_default?
%section.qa-deploy-keys-settings.settings.no-animate#js-deploy-keys-settings{ class: ('expanded' if expanded), data: { qa_selector: 'deploy_keys_settings' } }
%section.qa-deploy-keys-settings.settings.no-animate#js-deploy-keys-settings{ class: ('expanded' if expanded), data: { qa_selector: 'deploy_keys_settings_content' } }
.settings-header
%h4= _('Deploy Keys')
%button.btn.js-settings-toggle{ type: 'button' }
......
- expanded = expand_deploy_tokens_section?(@new_deploy_token)
%section.qa-deploy-tokens-settings.settings.no-animate#js-deploy-tokens{ class: ('expanded' if expanded), data: { qa_selector: 'deploy_tokens_settings' } }
%section.qa-deploy-tokens-settings.settings.no-animate#js-deploy-tokens{ class: ('expanded' if expanded), data: { qa_selector: 'deploy_tokens_settings_content' } }
.settings-header
%h4= s_('DeployTokens|Deploy Tokens')
%button.btn.js-settings-toggle.qa-expand-deploy-keys{ type: 'button' }
......
- if ::Gitlab::CurrentSettings.custom_project_templates_enabled?
%section.settings.as-custom-project-templates.no-animate#js-custom-project-templates-settings.qa-custom-project-template-section{ class: ('expanded' if expanded) }
%section.settings.as-custom-project-templates.no-animate#js-custom-project-templates-settings{ class: ('expanded' if expanded), data: { qa_selector: 'custom_project_template_content' } }
.settings-header
%h4
= _('Custom project templates')
......
......@@ -47,7 +47,7 @@ module QA
def go_to_template_settings
hover_element(:admin_settings_item) do
within_submenu(:admin_sidebar_settings_submenu) do
within_submenu(:admin_sidebar_settings_submenu_content) do
click_element :admin_settings_template_item
end
end
......
......@@ -13,7 +13,7 @@ module QA
end
def expand_elasticsearch(&block)
expand_section(:elasticsearch_tab) do
expand_content(:elasticsearch_tab) do
Component::Elasticsearch.perform(&block)
end
end
......
......@@ -9,11 +9,11 @@ module QA
include QA::Page::Settings::Common
view 'app/views/admin/application_settings/preferences.html.haml' do
element :email_section
element :email_content
end
def expand_email_settings(&block)
expand_section(:email_section) do
expand_content(:email_content) do
Component::Email.perform(&block)
end
end
......
......@@ -10,12 +10,12 @@ module QA
include ::QA::Page::Component::Select2
view 'ee/app/views/admin/application_settings/_custom_templates_form.html.haml' do
element :custom_project_template_section
element :custom_project_template_content
element :save_changes_button
end
def current_custom_project_template
expand_section(:custom_project_template_section)
expand_content(:custom_project_template_content)
within_element(:custom_project_template_select) do
current_selection
......@@ -23,7 +23,7 @@ module QA
end
def choose_custom_project_template(path)
expand_section(:custom_project_template_section)
expand_content(:custom_project_template_content)
within_element(:custom_project_template_select) do
clear_current_selection_if_present
......
......@@ -42,7 +42,7 @@ module QA
end
def current_custom_project_template
expand_section(:custom_project_templates)
expand_content(:custom_project_templates)
within_element(:custom_project_template_select) do
current_selection
......@@ -50,7 +50,7 @@ module QA
end
def choose_custom_project_template(path)
expand_section(:custom_project_templates)
expand_content(:custom_project_templates)
within_element(:custom_project_template_select) do
clear_current_selection_if_present
......@@ -62,7 +62,7 @@ module QA
def set_ip_address_restriction(ip_address)
QA::Runtime::Logger.debug(%Q[Setting ip address restriction to: #{ip_address}])
expand_section(:permission_lfs_2fa_section)
expand_content(:permission_lfs_2fa_content)
# GitLab UI Token Selector (https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-token-selector--default)
# `data-qa-*` can only be added to the wrapper so custom selector used to find token close buttons and text input
......@@ -77,13 +77,13 @@ module QA
end
def set_membership_lock_enabled
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
check_element :membership_lock_checkbox
click_element :save_permissions_changes_button
end
def set_membership_lock_disabled
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
uncheck_element :membership_lock_checkbox
click_element :save_permissions_changes_button
end
......@@ -93,7 +93,7 @@ module QA
end
def current_file_template_repository
expand_section(:file_template_repositories)
expand_content(:file_template_repositories)
within_element(:file_template_repository_dropdown) do
current_selection
......@@ -101,7 +101,7 @@ module QA
end
def choose_file_template_repository(path)
expand_section(:file_template_repositories)
expand_content(:file_template_repositories)
within_element(:file_template_repository_dropdown) do
clear_current_selection_if_present
......
......@@ -19,7 +19,7 @@ module QA
end
def expand_merge_request_approvals_settings(&block)
expand_section(:merge_request_approvals_settings) do
expand_content(:merge_request_approvals_settings) do
MergeRequestApprovals.perform(&block)
end
end
......
......@@ -19,7 +19,7 @@ module QA
end
def expand_push_rules(&block)
expand_section(:push_rules_content) do
expand_content(:push_rules_content) do
PushRules.perform(&block)
end
end
......
......@@ -6,7 +6,7 @@ module QA
class Menu < Page::Base
view 'app/views/layouts/nav/sidebar/_admin.html.haml' do
element :admin_sidebar
element :admin_sidebar_settings_submenu
element :admin_sidebar_settings_submenu_content
element :admin_settings_item
element :admin_settings_repository_item
element :admin_settings_general_item
......@@ -22,7 +22,7 @@ module QA
def go_to_preferences_settings
hover_element(:admin_settings_item) do
within_submenu(:admin_sidebar_settings_submenu) do
within_submenu(:admin_sidebar_settings_submenu_content) do
click_element :admin_settings_preferences_link
end
end
......@@ -30,7 +30,7 @@ module QA
def go_to_repository_settings
hover_element(:admin_settings_item) do
within_submenu(:admin_sidebar_settings_submenu) do
within_submenu(:admin_sidebar_settings_submenu_content) do
click_element :admin_settings_repository_item
end
end
......@@ -38,7 +38,7 @@ module QA
def go_to_integration_settings
hover_element(:admin_settings_item) do
within_submenu(:admin_sidebar_settings_submenu) do
within_submenu(:admin_sidebar_settings_submenu_content) do
click_element :integration_settings_link
end
end
......@@ -46,7 +46,7 @@ module QA
def go_to_general_settings
hover_element(:admin_settings_item) do
within_submenu(:admin_sidebar_settings_submenu) do
within_submenu(:admin_sidebar_settings_submenu_content) do
click_element :admin_settings_general_item
end
end
......@@ -54,7 +54,7 @@ module QA
def go_to_metrics_and_profiling_settings
hover_element(:admin_settings_item) do
within_submenu(:admin_sidebar_settings_submenu) do
within_submenu(:admin_sidebar_settings_submenu_content) do
click_element :admin_settings_metrics_and_profiling_item
end
end
......@@ -62,7 +62,7 @@ module QA
def go_to_network_settings
hover_element(:admin_settings_item) do
within_submenu(:admin_sidebar_settings_submenu) do
within_submenu(:admin_sidebar_settings_submenu_content) do
click_element :admin_settings_network_item
end
end
......
......@@ -8,11 +8,11 @@ module QA
include QA::Page::Settings::Common
view 'app/views/admin/application_settings/general.html.haml' do
element :account_and_limit_settings
element :account_and_limit_settings_content
end
def expand_account_and_limit(&block)
expand_section(:account_and_limit_settings) do
expand_content(:account_and_limit_settings_content) do
Component::AccountAndLimit.perform(&block)
end
end
......
......@@ -8,11 +8,11 @@ module QA
include QA::Page::Settings::Common
view 'app/views/admin/application_settings/metrics_and_profiling.html.haml' do
element :performance_bar_settings
element :performance_bar_settings_content
end
def expand_performance_bar(&block)
expand_section(:performance_bar_settings) do
expand_content(:performance_bar_settings_content) do
Component::PerformanceBar.perform(&block)
end
end
......
......@@ -8,18 +8,18 @@ module QA
include QA::Page::Settings::Common
view 'app/views/admin/application_settings/network.html.haml' do
element :ip_limits_section
element :outbound_requests_section
element :ip_limits_content
element :outbound_requests_content
end
def expand_ip_limits(&block)
expand_section(:ip_limits_section) do
expand_content(:ip_limits_content) do
Component::IpLimits.perform(&block)
end
end
def expand_outbound_requests(&block)
expand_section(:outbound_requests_section) do
expand_content(:outbound_requests_content) do
Component::OutboundRequests.perform(&block)
end
end
......
......@@ -8,11 +8,11 @@ module QA
include QA::Page::Settings::Common
view 'app/views/admin/application_settings/repository.html.haml' do
element :repository_storage_settings
element :repository_storage_settings_content
end
def expand_repository_storage(&block)
expand_section(:repository_storage_settings) do
expand_content(:repository_storage_settings_content) do
Component::RepositoryStorage.perform(&block)
end
end
......
......@@ -8,7 +8,7 @@ module QA
include ::QA::Page::Settings::Common
view 'app/views/groups/edit.html.haml' do
element :permission_lfs_2fa_section
element :permission_lfs_2fa_content
end
view 'app/views/groups/settings/_permissions.html.haml' do
......@@ -54,49 +54,49 @@ module QA
end
def set_lfs_enabled
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
check_element :lfs_checkbox
click_element :save_permissions_changes_button
end
def set_lfs_disabled
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
uncheck_element :lfs_checkbox
click_element :save_permissions_changes_button
end
def set_request_access_enabled
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
check_element :request_access_checkbox
click_element :save_permissions_changes_button
end
def set_request_access_disabled
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
uncheck_element :request_access_checkbox
click_element :save_permissions_changes_button
end
def set_require_2fa_enabled
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
check_element :require_2fa_checkbox
click_element :save_permissions_changes_button
end
def set_require_2fa_disabled
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
uncheck_element :require_2fa_checkbox
click_element :save_permissions_changes_button
end
def set_project_creation_level(value)
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
select_element(:project_creation_level_dropdown, value)
click_element :save_permissions_changes_button
end
def toggle_request_access
expand_section :permission_lfs_2fa_section
expand_content :permission_lfs_2fa_content
if find_element(:request_access_checkbox).checked?
uncheck_element :request_access_checkbox
......
......@@ -15,25 +15,25 @@ module QA
end
def expand_general_pipelines(&block)
expand_section(:general_pipelines_settings_content) do
expand_content(:general_pipelines_settings_content) do
Settings::GeneralPipelines.perform(&block)
end
end
def expand_runners_settings(&block)
expand_section(:runners_settings_content) do
expand_content(:runners_settings_content) do
Settings::Runners.perform(&block)
end
end
def expand_ci_variables(&block)
expand_section(:variables_settings_content) do
expand_content(:variables_settings_content) do
Settings::CiVariables.perform(&block)
end
end
def expand_auto_devops(&block)
expand_section(:autodevops_settings_content) do
expand_content(:autodevops_settings_content) do
Settings::AutoDevops.perform(&block)
end
end
......
......@@ -37,19 +37,19 @@ module QA
end
def expand_advanced_settings(&block)
expand_section(:advanced_settings) do
expand_content(:advanced_settings) do
Advanced.perform(&block)
end
end
def expand_merge_requests_settings(&block)
expand_section(:merge_request_settings) do
expand_content(:merge_request_settings) do
MergeRequest.perform(&block)
end
end
def expand_visibility_project_features_permissions(&block)
expand_section(:visibility_features_permissions_content) do
expand_content(:visibility_features_permissions_content) do
VisibilityFeaturesPermissions.perform(&block)
end
end
......
......@@ -12,7 +12,7 @@ module QA
end
def expand_incidents(&block)
expand_section(:incidents_settings_content) do
expand_content(:incidents_settings_content) do
Settings::Incidents.perform(&block)
end
end
......
......@@ -8,19 +8,19 @@ module QA
include QA::Page::Settings::Common
view 'app/views/projects/protected_branches/shared/_index.html.haml' do
element :protected_branches_settings
element :protected_branches_settings_content
end
view 'app/views/projects/mirrors/_mirror_repos.html.haml' do
element :mirroring_repositories_settings_section
element :mirroring_repositories_settings_content
end
view 'app/views/shared/deploy_tokens/_index.html.haml' do
element :deploy_tokens_settings
element :deploy_tokens_settings_content
end
view 'app/views/shared/deploy_keys/_index.html.haml' do
element :deploy_keys_settings
element :deploy_keys_settings_content
end
view 'app/views/projects/protected_tags/shared/_index.html.haml' do
......@@ -28,31 +28,31 @@ module QA
end
def expand_deploy_tokens(&block)
expand_section(:deploy_tokens_settings) do
expand_content(:deploy_tokens_settings_content) do
Settings::DeployTokens.perform(&block)
end
end
def expand_deploy_keys(&block)
expand_section(:deploy_keys_settings) do
expand_content(:deploy_keys_settings_content) do
Settings::DeployKeys.perform(&block)
end
end
def expand_protected_branches(&block)
expand_section(:protected_branches_settings) do
expand_content(:protected_branches_settings_content) do
ProtectedBranches.perform(&block)
end
end
def expand_mirroring_repositories(&block)
expand_section(:mirroring_repositories_settings_section) do
expand_content(:mirroring_repositories_settings_content) do
MirroringRepositories.perform(&block)
end
end
def expand_protected_tags(&block)
expand_section(:protected_tag_settings_content) do
expand_content(:protected_tag_settings_content) do
ProtectedTags.perform(&block)
end
end
......
......@@ -7,7 +7,7 @@ module QA
# Click the Expand button present in the specified section
#
# @param [Symbol] element_name `element` name defined in a `view` block
def expand_section(element_name)
def expand_content(element_name)
within_element(element_name) do
# Because it is possible to click the button before the JS toggle code is bound
wait_until(reload: false) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment