Commit 18296631 authored by Rémy Coutable's avatar Rémy Coutable

[QA] Improve admin hashed-storage settings

This was introduced by https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/7371
for which no QA was run, even though QA files were changed.

This is a follow-up to
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/7531.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 7287fd09
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
.sub-section .sub-section
.form-group .form-group
.form-check .form-check
= f.check_box :hashed_storage_enabled, class: 'form-check-input' = f.check_box :hashed_storage_enabled, class: 'form-check-input qa-hashed-storage-checkbox'
= f.label :hashed_storage_enabled, class: 'form-check-label' do = f.label :hashed_storage_enabled, class: 'form-check-label' do
Use hashed storage paths for newly created and renamed projects Use hashed storage paths for newly created and renamed projects
.form-text.text-muted .form-text.text-muted
...@@ -48,4 +48,4 @@ ...@@ -48,4 +48,4 @@
.form-text.text-muted .form-text.text-muted
= circuitbreaker_failure_reset_time_help_text = circuitbreaker_failure_reset_time_help_text
= f.submit 'Save changes', class: "btn btn-success" = f.submit 'Save changes', class: "btn btn-success qa-save-changes-button"
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
.settings-content .settings-content
= render partial: 'repository_mirrors_form' = render partial: 'repository_mirrors_form'
%section.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded_by_default?) } %section.settings.qa-repository-storage-settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded_by_default?) }
.settings-header .settings-header
%h4 %h4
= _('Repository storage') = _('Repository storage')
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
.settings-content .settings-content
= render 'signin' = render 'signin'
%section.qa-terms-settings.settings.as-terms.no-animate#js-terms-settings{ class: ('expanded' if expanded_by_default?) } %section.settings.as-terms.no-animate#js-terms-settings{ class: ('expanded' if expanded_by_default?) }
.settings-header .settings-header
%h4 %h4
= _('Terms of Service and Privacy Policy') = _('Terms of Service and Privacy Policy')
......
.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?) } .nav-sidebar.qa-admin-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?) }
.nav-sidebar-inner-scroll .nav-sidebar-inner-scroll
.context-header .context-header
= link_to admin_root_path, title: _('Admin Overview') do = link_to admin_root_path, title: _('Admin Overview') do
...@@ -197,10 +197,10 @@ ...@@ -197,10 +197,10 @@
= link_to admin_application_settings_path do = link_to admin_application_settings_path do
.nav-icon-container .nav-icon-container
= sprite_icon('settings') = sprite_icon('settings')
%span.nav-item-name %span.nav-item-name.qa-admin-settings-item
= _('Settings') = _('Settings')
%ul.sidebar-sub-level-items %ul.sidebar-sub-level-items.qa-admin-sidebar-submenu
= nav_link(controller: :application_settings, html_options: { class: "fly-out-top-item" } ) do = nav_link(controller: :application_settings, html_options: { class: "fly-out-top-item" } ) do
= link_to admin_application_settings_path do = link_to admin_application_settings_path do
%strong.fly-out-top-item-name %strong.fly-out-top-item-name
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
%span %span
= _('Integrations') = _('Integrations')
= nav_link(path: 'application_settings#repository') do = nav_link(path: 'application_settings#repository') do
= link_to repository_admin_application_settings_path, title: _('Repository') do = link_to repository_admin_application_settings_path, title: _('Repository'), class: 'qa-admin-settings-repository-item' do
%span %span
= _('Repository') = _('Repository')
- if template_exists?('admin/application_settings/templates') - if template_exists?('admin/application_settings/templates')
......
...@@ -236,8 +236,11 @@ module QA ...@@ -236,8 +236,11 @@ module QA
module Admin module Admin
module Settings module Settings
autoload :RepositoryStorage, 'qa/page/admin/settings/repository_storage' autoload :Repository, 'qa/page/admin/settings/repository'
autoload :Main, 'qa/page/admin/settings/main'
module Component
autoload :RepositoryStorage, 'qa/page/admin/settings/component/repository_storage'
end
end end
end end
......
# frozen_string_literal: true
module QA
module Page
module Admin
module Settings
module Component
class RepositoryStorage < Page::Base
view 'app/views/admin/application_settings/_repository_storage.html.haml' do
element :hashed_storage_checkbox
element :save_changes_button
end
def enable_hashed_storage
check_element :hashed_storage_checkbox
end
def save_settings
click_element :save_changes_button
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA module QA
module Page module Page
module Admin module Admin
module Settings module Settings
class Main < Page::Base class Repository < Page::Base
include QA::Page::Settings::Common include QA::Page::Settings::Common
view 'app/views/admin/application_settings/show.html.haml' do view 'app/views/admin/application_settings/repository.html.haml' do
element :terms_settings element :repository_storage_settings
end end
def expand_repository_storage(&block) def expand_repository_storage(&block)
expand_section(:terms_settings) do expand_section(:repository_storage_settings) do
RepositoryStorage.perform(&block) Component::RepositoryStorage.perform(&block)
end end
end end
end end
......
module QA
module Page
module Admin
module Settings
class RepositoryStorage < Page::Base
view 'app/views/admin/application_settings/_repository_storage.html.haml' do
element :submit, "submit 'Save changes'"
element :hashed_storage,
'Use hashed storage paths for newly created and renamed projects'
end
def enable_hashed_storage
check 'Use hashed storage paths for newly created and renamed projects'
end
def save_settings
click_button 'Save changes'
end
end
end
end
end
end
...@@ -68,6 +68,10 @@ module QA ...@@ -68,6 +68,10 @@ module QA
all(element_selector_css(name)) all(element_selector_css(name))
end end
def check_element(name)
find_element(name).set(true)
end
def click_element(name) def click_element(name)
find_element(name).click find_element(name).click
end end
...@@ -86,6 +90,10 @@ module QA ...@@ -86,6 +90,10 @@ module QA
end end
end end
def scroll_to_element(name, *args)
scroll_to(element_selector_css(name), *args)
end
def element_selector_css(name) def element_selector_css(name)
Page::Element.new(name).selector_css Page::Element.new(name).selector_css
end end
......
...@@ -3,11 +3,41 @@ module QA ...@@ -3,11 +3,41 @@ module QA
module Menu module Menu
class Admin < Page::Base class Admin < Page::Base
view 'app/views/layouts/nav/sidebar/_admin.html.haml' do view 'app/views/layouts/nav/sidebar/_admin.html.haml' do
element :settings, "_('Settings')" element :admin_sidebar
element :admin_sidebar_submenu
element :admin_settings_item
element :admin_settings_repository_item
end end
def go_to_settings def go_to_repository_settings
click_link 'Settings' hover_settings do
within_submenu do
click_element :admin_settings_repository_item
end
end
end
private
def hover_settings
within_sidebar do
scroll_to_element(:admin_settings_item)
find_element(:admin_settings_item).hover
yield
end
end
def within_sidebar
within_element(:admin_sidebar) do
yield
end
end
def within_submenu
within_element(:admin_sidebar_submenu) do
yield
end
end end
end end
end end
......
...@@ -30,7 +30,7 @@ describe QA::Page::Validator do ...@@ -30,7 +30,7 @@ describe QA::Page::Validator do
let(:view) { spy('view') } let(:view) { spy('view') }
before do before do
allow(QA::Page::Admin::Settings::Main) allow(QA::Page::Admin::Settings::Repository)
.to receive(:views).and_return([view]) .to receive(:views).and_return([view])
end end
......
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