Commit c2c46013 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Refactor QA code to use common expand_section method

parent 51a2e376
- expanded = Rails.env.test?
%section.settings.no-animate{ class: ('expanded' if expanded) }
%section.settings.repository-deploy-keys.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4
Deploy Keys
%button.btn.js-settings-toggle.qa-expand-deploy-keys
%button.btn.js-settings-toggle
= expanded ? 'Collapse' : 'Expand'
%p
Deploy keys allow read-only or read-write (if enabled) access to your repository. Deploy keys can be used for CI, staging or production servers. You can create a deploy key or add an existing one.
......
- expanded = Rails.env.test?
%section.settings.no-animate{ class: ('expanded' if expanded) }
%section.settings.project-protected-branches.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4
Protected Branches
......
- expanded = Rails.env.test?
%section.settings.no-animate{ class: ('expanded' if expanded) }
%section.settings.project-protected-tags.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4
Protected Tags
......
- expanded = Rails.env.test?
%section.settings.no-animate{ class: ('expanded' if expanded) }
%section.settings.project-remote-mirror-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.no-animate{ class: ('expanded' if expanded) }
%section.settings.repository-push-rules.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4
Push Rules
......
......@@ -3,9 +3,9 @@ module QA
module Project
module Settings
module Common
def expand(element_name)
page.within('#content-body') do
click_element(element_name)
def expand_section(selector)
page.within(selector) do
find_button('Expand').click
yield
end
......
......@@ -3,10 +3,10 @@ module QA
module Project
module Settings
class Main < Page::Base
include Common
def expand_advanced_settings
within('section.advanced-settings') do
find_button('Expand').click
end
expand_section('section.advanced-settings')
end
def rename_to(path)
......
......@@ -6,11 +6,11 @@ module QA
include Common
view 'app/views/projects/deploy_keys/_index.html.haml' do
element :expand_deploy_keys
element :expand_deploy_keys, '%section.settings.repository-deploy-keys'
end
def expand_deploy_keys(&block)
expand(:expand_deploy_keys) do
expand_section('section.repository-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