diff options
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 9 | ||||
-rw-r--r-- | qa/qa/factory/settings/hashed_storage.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/admin/settings.rb | 26 | ||||
-rw-r--r-- | qa/qa/page/admin/settings/main.rb | 21 | ||||
-rw-r--r-- | qa/qa/page/admin/settings/repository_storage.rb | 23 | ||||
-rw-r--r-- | qa/qa/page/project/settings/common.rb | 20 | ||||
-rw-r--r-- | qa/qa/page/settings/common.rb | 25 | ||||
-rw-r--r-- | qa/qa/scenario/bootable.rb | 2 | ||||
-rw-r--r-- | qa/qa/scenario/test/instance.rb | 8 | ||||
-rw-r--r-- | qa/qa/scenario/test/integration/mattermost.rb | 4 | ||||
-rw-r--r-- | qa/qa/specs/runner.rb | 6 | ||||
-rw-r--r-- | qa/spec/page/validator_spec.rb | 2 | ||||
-rw-r--r-- | qa/spec/scenario/test/instance_spec.rb | 4 |
13 files changed, 97 insertions, 61 deletions
@@ -90,6 +90,10 @@ module QA autoload :OAuth, 'qa/page/main/oauth' end + module Settings + autoload :Common, 'qa/page/settings/common' + end + module Menu autoload :Main, 'qa/page/menu/main' autoload :Side, 'qa/page/menu/side' @@ -150,7 +154,10 @@ module QA end module Admin - autoload :Settings, 'qa/page/admin/settings' + module Settings + autoload :RepositoryStorage, 'qa/page/admin/settings/repository_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..c69ebed3c6b 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_repository_storage do |page| + page.enable_hashed_storage + page.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..e7c1220c967 --- /dev/null +++ b/qa/qa/page/admin/settings/main.rb @@ -0,0 +1,21 @@ +module QA + module Page + module Admin + module Settings + class Main < Page::Base + include QA::Page::Settings::Common + + view 'app/views/admin/application_settings/show.html.haml' do + element :advanced_settings_section, 'Repository storage' + end + + def expand_repository_storage(&block) + expand_section('Repository storage') do + RepositoryStorage.perform(&block) + end + end + end + end + end + end +end diff --git a/qa/qa/page/admin/settings/repository_storage.rb b/qa/qa/page/admin/settings/repository_storage.rb new file mode 100644 index 00000000000..b4a1344216e --- /dev/null +++ b/qa/qa/page/admin/settings/repository_storage.rb @@ -0,0 +1,23 @@ +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, + 'Create new projects using hashed storage paths' + end + + def enable_hashed_storage + check 'Create new projects using hashed storage paths' + end + + def save_settings + click_button 'Save changes' + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index 319cb1045b6..874fb381554 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -3,6 +3,8 @@ module QA module Project module Settings module Common + include QA::Page::Settings::Common + def self.included(base) base.class_eval do view 'app/views/projects/edit.html.haml' do @@ -10,24 +12,6 @@ module QA end 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 diff --git a/qa/qa/page/settings/common.rb b/qa/qa/page/settings/common.rb new file mode 100644 index 00000000000..a683a6829d5 --- /dev/null +++ b/qa/qa/page/settings/common.rb @@ -0,0 +1,25 @@ +module QA + module Page + module Settings + module Common + # 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 diff --git a/qa/qa/scenario/bootable.rb b/qa/qa/scenario/bootable.rb index d6de4d404c8..dd12ea6d492 100644 --- a/qa/qa/scenario/bootable.rb +++ b/qa/qa/scenario/bootable.rb @@ -23,7 +23,7 @@ module QA arguments.parse!(argv) - self.perform(**Runtime::Scenario.attributes) + self.perform(Runtime::Scenario.attributes, *arguments.default_argv) end private diff --git a/qa/qa/scenario/test/instance.rb b/qa/qa/scenario/test/instance.rb index 0af9afd1ea4..567e5fd6cca 100644 --- a/qa/qa/scenario/test/instance.rb +++ b/qa/qa/scenario/test/instance.rb @@ -11,7 +11,7 @@ module QA tags :core - def perform(address, *files) + def perform(address, *rspec_options) Runtime::Scenario.define(:gitlab_address, address) ## @@ -22,9 +22,9 @@ module QA Specs::Runner.perform do |specs| specs.tty = true specs.tags = self.class.focus - specs.files = - if files.any? - files + specs.options = + if rspec_options.any? + rspec_options else File.expand_path('../../specs/features', __dir__) end diff --git a/qa/qa/scenario/test/integration/mattermost.rb b/qa/qa/scenario/test/integration/mattermost.rb index d939f52ab16..13bfad28b0b 100644 --- a/qa/qa/scenario/test/integration/mattermost.rb +++ b/qa/qa/scenario/test/integration/mattermost.rb @@ -9,10 +9,10 @@ module QA class Mattermost < Test::Instance tags :core, :mattermost - def perform(address, mattermost, *files) + def perform(address, mattermost, *rspec_options) Runtime::Scenario.define(:mattermost_address, mattermost) - super(address, *files) + super(address, *rspec_options) end end end diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index 752e3e60b8c..f8f6fe65599 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -3,19 +3,19 @@ require 'rspec/core' module QA module Specs class Runner < Scenario::Template - attr_accessor :tty, :tags, :files + attr_accessor :tty, :tags, :options def initialize @tty = false @tags = [] - @files = [File.expand_path('./features', __dir__)] + @options = [File.expand_path('./features', __dir__)] end def perform args = [] args.push('--tty') if tty tags.to_a.each { |tag| args.push(['-t', tag.to_s]) } - args.push(files) + args.push(options) Runtime::Browser.configure! 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 diff --git a/qa/spec/scenario/test/instance_spec.rb b/qa/spec/scenario/test/instance_spec.rb index bd09c28e924..a74a9538be8 100644 --- a/qa/spec/scenario/test/instance_spec.rb +++ b/qa/spec/scenario/test/instance_spec.rb @@ -29,7 +29,7 @@ describe QA::Scenario::Test::Instance do it 'should call runner with default arguments' do subject.perform("test") - expect(runner).to have_received(:files=) + expect(runner).to have_received(:options=) .with(File.expand_path('../../../qa/specs/features', __dir__)) end end @@ -38,7 +38,7 @@ describe QA::Scenario::Test::Instance do it 'should call runner with paths' do subject.perform('test', 'path1', 'path2') - expect(runner).to have_received(:files=).with(%w[path1 path2]) + expect(runner).to have_received(:options=).with(%w[path1 path2]) end end end |