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

Ensure we look into the correct setion only when expanding a settings' section

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent fba123a3
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
.settings-content .settings-content
= render 'logging' = render 'logging'
%section.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded) } %section.qa-repository-storage-settings.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
= _('Repository storage') = _('Repository storage')
......
- expanded = Rails.env.test? - expanded = Rails.env.test?
%section.settings.no-animate{ class: ('expanded' if expanded) } %section.qa-deploy-keys-settings.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Deploy Keys Deploy Keys
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
= render_if_exists 'projects/issues_settings' = render_if_exists 'projects/issues_settings'
%section.settings.merge-requests-feature.no-animate{ class: [('expanded' if expanded), ('hidden' if @project.project_feature.send(:merge_requests_access_level) == 0)] } %section.qa-merge-request-settings.settings.merge-requests-feature.no-animate{ class: [('expanded' if expanded), ('hidden' if @project.project_feature.send(:merge_requests_access_level) == 0)] }
.settings-header .settings-header
%h4 %h4
Merge request Merge request
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
= render 'export', project: @project = render 'export', project: @project
%section.settings.advanced-settings.no-animate{ class: ('expanded' if expanded) } %section.qa-advanced-settings.settings.advanced-settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Advanced Advanced
......
- expanded = Rails.env.test? - expanded = Rails.env.test?
%section.settings.no-animate{ class: ('expanded' if expanded) } %section.qa-protected-branches-settings.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Protected Branches Protected Branches
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
.settings-content .settings-content
= render 'form' = render 'form'
%section.settings#autodevops-settings.no-animate{ class: ('expanded' if expanded) } %section.qa-autodevops-settings.settings#autodevops-settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
= s_('CICD|Auto DevOps') = s_('CICD|Auto DevOps')
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
.settings-content .settings-content
= render 'autodevops_form' = render 'autodevops_form'
%section.settings.no-animate{ class: ('expanded' if expanded) } %section.qa-runners-settings.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Runners Runners
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
.settings-content .settings-content
= render 'projects/runners/index' = render 'projects/runners/index'
%section.settings.no-animate{ class: ('expanded' if expanded) } %section.qa-variables-settings.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
= _('Variables') = _('Variables')
......
...@@ -6,11 +6,11 @@ module QA ...@@ -6,11 +6,11 @@ module QA
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/show.html.haml' do
element :advanced_settings_section, 'Repository storage' element :repository_storage_settings
end end
def expand_repository_storage(&block) def expand_repository_storage(&block)
expand_section('Repository storage') do expand_section(:repository_storage_settings) do
RepositoryStorage.perform(&block) RepositoryStorage.perform(&block)
end end
end end
......
...@@ -4,9 +4,9 @@ module QA ...@@ -4,9 +4,9 @@ module QA
module Settings module Settings
class Advanced < Page::Base class Advanced < Page::Base
view 'app/views/projects/edit.html.haml' do view 'app/views/projects/edit.html.haml' do
element :project_path_field, 'f.text_field :path' element :project_path_field, 'text_field :path'
element :project_name_field, 'f.text_field :name' element :project_name_field, 'text_field :name'
element :rename_project_button, "f.submit 'Rename project'" element :rename_project_button, "submit 'Rename project'"
end end
def rename_to(path) def rename_to(path)
......
...@@ -6,31 +6,33 @@ module QA # rubocop:disable Naming/FileName ...@@ -6,31 +6,33 @@ module QA # rubocop:disable Naming/FileName
include Common include Common
view 'app/views/projects/settings/ci_cd/show.html.haml' do view 'app/views/projects/settings/ci_cd/show.html.haml' do
element :runners_settings, 'Runners' element :autodevops_settings
element :secret_variables, 'Variables' element :runners_settings
element :auto_devops_section, 'Auto DevOps' element :variables_settings
end end
view 'app/views/projects/settings/ci_cd/_autodevops_form.html.haml' do view 'app/views/projects/settings/ci_cd/_autodevops_form.html.haml' do
element :enable_auto_devops_button, 'Enable Auto DevOps' element :enable_auto_devops_field, 'radio_button :enabled'
element :domain_input, 'Domain' element :domain_field, 'text_field :domain'
element :enable_auto_devops_button, "%strong= s_('CICD|Enable Auto DevOps')"
element :domain_input, "%strong= _('Domain')"
element :save_changes_button, "submit 'Save changes'" element :save_changes_button, "submit 'Save changes'"
end end
def expand_runners_settings(&block) def expand_runners_settings(&block)
expand_section('Runners') do expand_section(:runners_settings) do
Settings::Runners.perform(&block) Settings::Runners.perform(&block)
end end
end end
def expand_secret_variables(&block) def expand_secret_variables(&block)
expand_section('Variables') do expand_section(:variables_settings) do
Settings::SecretVariables.perform(&block) Settings::SecretVariables.perform(&block)
end end
end end
def enable_auto_devops_with_domain(domain) def enable_auto_devops_with_domain(domain)
expand_section('Auto DevOps') do expand_section(:autodevops_settings) do
choose 'Enable Auto DevOps' choose 'Enable Auto DevOps'
fill_in 'Domain', with: domain fill_in 'Domain', with: domain
click_on 'Save changes' click_on 'Save changes'
......
...@@ -6,11 +6,11 @@ module QA ...@@ -6,11 +6,11 @@ module QA
include Common include Common
view 'app/views/projects/edit.html.haml' do view 'app/views/projects/edit.html.haml' do
element :advanced_settings_section, 'Advanced' element :advanced_settings
end end
def expand_advanced_settings(&block) def expand_advanced_settings(&block)
expand_section('Advanced settings') do expand_section(:advanced_settings) do
Advanced.perform(&block) Advanced.perform(&block)
end end
end end
......
...@@ -5,17 +5,17 @@ module QA ...@@ -5,17 +5,17 @@ module QA
class MergeRequest < QA::Page::Base class MergeRequest < QA::Page::Base
include Common include Common
view 'app/views/projects/_merge_request_merge_method_settings.html.haml' do
element :radio_button_merge_ff
end
view 'app/views/projects/edit.html.haml' do view 'app/views/projects/edit.html.haml' do
element :merge_request_settings, 'Merge request' element :merge_request_settings
element :save_merge_request_changes element :save_merge_request_changes
end end
view 'app/views/projects/_merge_request_merge_method_settings.html.haml' do
element :radio_button_merge_ff
end
def enable_ff_only def enable_ff_only
expand_section('Merge request') do expand_section(:merge_request_settings) do
click_element :radio_button_merge_ff click_element :radio_button_merge_ff
click_element :save_merge_request_changes click_element :save_merge_request_changes
end end
......
...@@ -6,17 +6,21 @@ module QA ...@@ -6,17 +6,21 @@ module QA
include Common include Common
view 'app/views/projects/deploy_keys/_index.html.haml' do view 'app/views/projects/deploy_keys/_index.html.haml' do
element :deploy_keys_section, 'Deploy Keys' element :deploy_keys_settings
end
view 'app/views/projects/protected_branches/shared/_index.html.haml' do
element :protected_branches_settings
end end
def expand_deploy_keys(&block) def expand_deploy_keys(&block)
expand_section('Deploy Keys') do expand_section(:deploy_keys_settings) do
DeployKeys.perform(&block) DeployKeys.perform(&block)
end end
end end
def expand_protected_branches(&block) def expand_protected_branches(&block)
expand_section('Protected Branches') do expand_section(:protected_branches_settings) do
ProtectedBranches.perform(&block) ProtectedBranches.perform(&block)
end end
end end
......
...@@ -4,10 +4,9 @@ module QA ...@@ -4,10 +4,9 @@ module QA
module Common module Common
# Click the Expand button present in the specified section # Click the Expand button present in the specified section
# #
# @param [String] name present in the container in the DOM # @param [Symbol] and `element` name defined in a `view` block
def expand_section(name) def expand_section(element_name)
page.within('#content-body') do within_element(element_name) do
page.within('section', text: name) do
# Because it is possible to click the button before the JS toggle code is bound # Because it is possible to click the button before the JS toggle code is bound
wait(reload: false) do wait(reload: false) do
click_button 'Expand' unless first('button', text: 'Collapse') click_button 'Expand' unless first('button', text: 'Collapse')
...@@ -21,5 +20,4 @@ module QA ...@@ -21,5 +20,4 @@ module QA
end end
end end
end end
end
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