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?
%section.settings.repository-deploy-keys.no-animate{ class: ('expanded' if expanded) }
%section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4
Deploy Keys
......
- 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
%h4
Protected Branches
......
- 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
%h4
Protected Tags
......
- 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
%h4
Push to a remote repository
......
- return unless @project.feature_available?(:push_rules)
- 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
%h4
Push Rules
......
......@@ -11,11 +11,16 @@ module QA
end
end
def expand_section(selector)
page.within(selector) do
find_button('Expand').click
# 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')
yield if block_given?
yield if block_given?
end
end
end
end
......
......@@ -6,11 +6,11 @@ module QA
include Common
view 'app/views/projects/edit.html.haml' do
element :advanced_settings_section, '%section.settings.advanced-settings'
element :advanced_settings_section, 'Advanced settings'
end
def expand_advanced_settings(&block)
expand_section('section.advanced-settings') do
expand_section('Advanced settings') do
Advanced.perform(&block)
end
end
......
......@@ -6,11 +6,11 @@ module QA
include Common
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
def expand_deploy_keys(&block)
expand_section('section.repository-deploy-keys') do
expand_section('Deploy Keys') do
DeployKeys.perform(&block)
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