diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2018-01-26 02:00:51 +0300 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2018-01-26 06:17:33 +0300 |
commit | a33f7050be76c158dfd749dcf4e5856bad7acf46 (patch) | |
tree | 54c44dfd52d89f47523a2d43f6034e77584e83f0 | |
parent | 10d8026f69efe83a0f4759f91c5087effd676191 (diff) |
Backport QA changes from EE
-rw-r--r-- | qa/qa.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/dashboard/projects.rb | 11 | ||||
-rw-r--r-- | qa/qa/page/menu/side.rb | 6 | ||||
-rw-r--r-- | qa/qa/page/project/settings/advanced.rb | 33 | ||||
-rw-r--r-- | qa/qa/page/project/settings/common.rb | 7 | ||||
-rw-r--r-- | qa/qa/page/project/settings/main.rb | 21 | ||||
-rw-r--r-- | qa/qa/page/project/settings/repository.rb | 4 | ||||
-rw-r--r-- | qa/qa/runtime/browser.rb | 4 |
8 files changed, 87 insertions, 11 deletions
@@ -107,18 +107,20 @@ module QA autoload :New, 'qa/page/project/new' autoload :Show, 'qa/page/project/show' + module Pipeline + autoload :Index, 'qa/page/project/pipeline/index' + autoload :Show, 'qa/page/project/pipeline/show' + end + module Settings autoload :Common, 'qa/page/project/settings/common' + autoload :Advanced, 'qa/page/project/settings/advanced' + autoload :Main, 'qa/page/project/settings/main' autoload :Repository, 'qa/page/project/settings/repository' autoload :CICD, 'qa/page/project/settings/ci_cd' autoload :DeployKeys, 'qa/page/project/settings/deploy_keys' autoload :Runners, 'qa/page/project/settings/runners' end - - module Pipeline - autoload :Index, 'qa/page/project/pipeline/index' - autoload :Show, 'qa/page/project/pipeline/show' - end end module Profile diff --git a/qa/qa/page/dashboard/projects.rb b/qa/qa/page/dashboard/projects.rb index 71255b18362..73942cb856a 100644 --- a/qa/qa/page/dashboard/projects.rb +++ b/qa/qa/page/dashboard/projects.rb @@ -3,10 +3,21 @@ module QA module Dashboard class Projects < Page::Base view 'app/views/dashboard/projects/index.html.haml' + view 'app/views/shared/projects/_search_form.html.haml' do + element :form_filter_by_name, /form_tag.+id: 'project-filter-form'/ + end def go_to_project(name) + filter_by_name(name) + find_link(text: name).click end + + def filter_by_name(name) + page.within('form#project-filter-form') do + fill_in :name, with: name + end + end end end end diff --git a/qa/qa/page/menu/side.rb b/qa/qa/page/menu/side.rb index 7f0f924c5e8..aeddc77e4c6 100644 --- a/qa/qa/page/menu/side.rb +++ b/qa/qa/page/menu/side.rb @@ -31,6 +31,12 @@ module QA end end + def go_to_settings + within_sidebar do + click_on 'Settings' + end + end + private def hover_settings diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb new file mode 100644 index 00000000000..5ef00504fdf --- /dev/null +++ b/qa/qa/page/project/settings/advanced.rb @@ -0,0 +1,33 @@ +module QA + module Page + module Project + module Settings + class Advanced < Page::Base + view 'app/views/projects/edit.html.haml' do + element :project_path_field, 'f.text_field :path' + element :project_name_field, 'f.text_field :name' + element :rename_project_button, "f.submit 'Rename project'" + end + + def rename_to(path) + fill_project_name(path) + fill_project_path(path) + rename_project! + end + + def fill_project_path(path) + fill_in :project_path, with: path + end + + def fill_project_name(name) + fill_in :project_name, with: name + end + + def rename_project! + click_on 'Rename project' + 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 1357bf031d5..1d5c919ba4a 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -11,12 +11,15 @@ module QA 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 - click_button 'Expand' + click_button('Expand') - yield + yield if block_given? end end end diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb new file mode 100644 index 00000000000..5d743f4c9c8 --- /dev/null +++ b/qa/qa/page/project/settings/main.rb @@ -0,0 +1,21 @@ +module QA + module Page + module Project + module Settings + class Main < Page::Base + include Common + + view 'app/views/projects/edit.html.haml' do + element :advanced_settings_section, 'Advanced settings' + end + + def expand_advanced_settings(&block) + expand_section('Advanced settings') do + Advanced.perform(&block) + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 6cc68358c8c..22362164a1a 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -6,11 +6,11 @@ module QA include Common view 'app/views/projects/deploy_keys/_index.html.haml' do - element :expand_deploy_keys + element :deploy_keys_section, 'Deploy Keys' end def expand_deploy_keys(&block) - expand(:expand_deploy_keys) do + expand_section('Deploy Keys') do DeployKeys.perform(&block) end end diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb index 7b1be3d5ef3..ce888b51ea5 100644 --- a/qa/qa/runtime/browser.rb +++ b/qa/qa/runtime/browser.rb @@ -23,11 +23,11 @@ module QA # In case of an address that is a symbol we will try to guess address # based on `Runtime::Scenario#something_address`. # - def visit(address, page, &block) + def visit(address, page = nil, &block) Browser::Session.new(address, page).perform(&block) end - def self.visit(address, page, &block) + def self.visit(address, page = nil, &block) new.visit(address, page, &block) end |