summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-03-30 13:42:09 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-03-30 13:42:09 +0300
commitea941b3b11ae3ed626682cfe7bd07beb5c1d2ddc (patch)
tree7cc3db7e6541a1ef757206f199f5c26d9233ded9 /qa
parentd0213253b10844512fc2dc57efdc52e72e90f77e (diff)
downloadgitlab-ce-dz-improve-app-settings-4.tar.gz
Update qa to match new admin settings structuredz-improve-app-settings-4
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb5
-rw-r--r--qa/qa/factory/settings/hashed_storage.rb8
-rw-r--r--qa/qa/page/admin/settings.rb26
-rw-r--r--qa/qa/page/admin/settings/main.rb37
-rw-r--r--qa/qa/page/admin/settings/repo_storage.rb33
-rw-r--r--qa/spec/page/validator_spec.rb2
6 files changed, 80 insertions, 31 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 7220af5088e..846197181b5 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -150,7 +150,10 @@ module QA
end
module Admin
- autoload :Settings, 'qa/page/admin/settings'
+ module Settings
+ autoload :RepoStorage, 'qa/page/admin/settings/repo_storage'
+ autoload :Main, 'qa/page/admin/settings/main'
+ end
end
module Mattermost
diff --git a/qa/qa/factory/settings/hashed_storage.rb b/qa/qa/factory/settings/hashed_storage.rb
index 13ce2435fe4..c9a28ca6e86 100644
--- a/qa/qa/factory/settings/hashed_storage.rb
+++ b/qa/qa/factory/settings/hashed_storage.rb
@@ -9,9 +9,11 @@ module QA
Page::Menu::Main.act { go_to_admin_area }
Page::Menu::Admin.act { go_to_settings }
- Page::Admin::Settings.act do
- enable_hashed_storage
- save_settings
+ Page::Admin::Settings::Main.perform do |setting|
+ setting.expand_repo_storage do |page|
+ enable_hashed_storage
+ save_settings
+ end
end
QA::Page::Menu::Main.act { sign_out }
diff --git a/qa/qa/page/admin/settings.rb b/qa/qa/page/admin/settings.rb
deleted file mode 100644
index 1f646103e7f..00000000000
--- a/qa/qa/page/admin/settings.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-module QA
- module Page
- module Admin
- class Settings < Page::Base
- view 'app/views/admin/application_settings/_form.html.haml' do
- element :form_actions, '.form-actions'
- element :submit, "submit 'Save'"
- element :repository_storage, '%legend Repository Storage'
- element :hashed_storage,
- 'Create new projects using hashed storage paths'
- end
-
- def enable_hashed_storage
- scroll_to 'legend', text: 'Repository Storage'
- check 'Create new projects using hashed storage paths'
- end
-
- def save_settings
- scroll_to '.form-actions' do
- click_button 'Save'
- end
- end
- end
- end
- end
-end
diff --git a/qa/qa/page/admin/settings/main.rb b/qa/qa/page/admin/settings/main.rb
new file mode 100644
index 00000000000..9b284fe7be1
--- /dev/null
+++ b/qa/qa/page/admin/settings/main.rb
@@ -0,0 +1,37 @@
+module QA
+ module Page
+ module Admin
+ module Settings
+ class Main < Page::Base
+ view 'app/views/admin/application_settings/show.html.haml' do
+ element :advanced_settings_section, 'Repository storage'
+ end
+
+ def expand_repo_storage(&block)
+ expand_section('Repository storage') do
+ RepoStorage.perform(&block)
+ end
+ end
+
+ # Click the Expand button present in the specified section
+ #
+ # @param [String] name present in the container in the DOM
+ def expand_section(name)
+ page.within('#content-body') do
+ page.within('section', text: name) do
+ # Because it is possible to click the button before the JS toggle code is bound
+ wait(reload: false) do
+ click_button 'Expand' unless first('button', text: 'Collapse')
+
+ page.has_content?('Collapse')
+ end
+
+ yield if block_given?
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/admin/settings/repo_storage.rb b/qa/qa/page/admin/settings/repo_storage.rb
new file mode 100644
index 00000000000..dc648c77abd
--- /dev/null
+++ b/qa/qa/page/admin/settings/repo_storage.rb
@@ -0,0 +1,33 @@
+module QA
+ module Page
+ module Admin
+ module Settings
+ class RepoStorage < Page::Base
+ view 'app/views/admin/application_settings/_repo_storage.html.haml' do
+ element :submit, "submit 'Save changes'"
+ element :hashed_storage,
+ 'Create new projects using hashed storage paths'
+ end
+
+ def enable_hashed_storage
+ within_repo_storage do
+ check 'Create new projects using hashed storage paths'
+ end
+ end
+
+ def save_settings
+ within_repo_storage do
+ click_button 'Save changes'
+ end
+ end
+
+ def within_repo_storage
+ page.within('.as-repo-storage') do
+ yield
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/spec/page/validator_spec.rb b/qa/spec/page/validator_spec.rb
index 02822d7d18f..55957649904 100644
--- a/qa/spec/page/validator_spec.rb
+++ b/qa/spec/page/validator_spec.rb
@@ -30,7 +30,7 @@ describe QA::Page::Validator do
let(:view) { spy('view') }
before do
- allow(QA::Page::Admin::Settings)
+ allow(QA::Page::Admin::Settings::Main)
.to receive(:views).and_return([view])
end