Commit cd8da77a authored by Gabriel Mazetto's avatar Gabriel Mazetto

Refactored expand_section to use name instead of selector

Removed previously added class elements
parent ca425ff2
- expanded = Rails.env.test? - expanded = Rails.env.test?
%section.settings.repository-deploy-keys.no-animate{ class: ('expanded' if expanded) } %section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Deploy Keys Deploy Keys
......
- expanded = Rails.env.test? - expanded = Rails.env.test?
%section.settings.project-protected-branches.no-animate{ class: ('expanded' if expanded) } %section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Protected Branches Protected Branches
......
- expanded = Rails.env.test? - expanded = Rails.env.test?
%section.settings.project-protected-tags.no-animate{ class: ('expanded' if expanded) } %section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Protected Tags Protected Tags
......
- expanded = Rails.env.test? - expanded = Rails.env.test?
%section.settings.project-remote-mirror-settings.no-animate{ class: ('expanded' if expanded) } %section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Push to a remote repository Push to a remote repository
......
- return unless @project.feature_available?(:push_rules) - return unless @project.feature_available?(:push_rules)
- expanded = Rails.env.test? - expanded = Rails.env.test?
%section.settings.repository-push-rules.no-animate{ class: ('expanded' if expanded) } %section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Push Rules Push Rules
......
...@@ -11,11 +11,16 @@ module QA ...@@ -11,11 +11,16 @@ module QA
end end
end end
def expand_section(selector) # Click the Expand button present in the specified section
page.within(selector) do #
find_button('Expand').click # @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')
yield if block_given? yield if block_given?
end
end end
end end
end end
......
...@@ -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, '%section.settings.advanced-settings' element :advanced_settings_section, 'Advanced settings'
end end
def expand_advanced_settings(&block) def expand_advanced_settings(&block)
expand_section('section.advanced-settings') do expand_section('Advanced settings') do
Advanced.perform(&block) Advanced.perform(&block)
end end
end end
......
...@@ -6,11 +6,11 @@ module QA ...@@ -6,11 +6,11 @@ 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 :expand_deploy_keys_section, '.repository-deploy-keys' element :deploy_keys_section, 'Deploy Keys'
end end
def expand_deploy_keys(&block) def expand_deploy_keys(&block)
expand_section('section.repository-deploy-keys') do expand_section('Deploy Keys') do
DeployKeys.perform(&block) DeployKeys.perform(&block)
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