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? - 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 .settings-header
%h4 %h4
Deploy Keys Deploy Keys
%button.btn.js-settings-toggle.qa-expand-deploy-keys %button.btn.js-settings-toggle
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %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. 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? - 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 .settings-header
%h4 %h4
Protected Branches Protected Branches
......
- expanded = Rails.env.test? - 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 .settings-header
%h4 %h4
Protected Tags Protected Tags
......
- expanded = Rails.env.test? - 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 .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.no-animate{ class: ('expanded' if expanded) } %section.settings.repository-push-rules.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
Push Rules Push Rules
......
...@@ -3,9 +3,9 @@ module QA ...@@ -3,9 +3,9 @@ module QA
module Project module Project
module Settings module Settings
module Common module Common
def expand(element_name) def expand_section(selector)
page.within('#content-body') do page.within(selector) do
click_element(element_name) find_button('Expand').click
yield yield
end end
......
...@@ -3,10 +3,10 @@ module QA ...@@ -3,10 +3,10 @@ module QA
module Project module Project
module Settings module Settings
class Main < Page::Base class Main < Page::Base
include Common
def expand_advanced_settings def expand_advanced_settings
within('section.advanced-settings') do expand_section('section.advanced-settings')
find_button('Expand').click
end
end end
def rename_to(path) def rename_to(path)
......
...@@ -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 element :expand_deploy_keys, '%section.settings.repository-deploy-keys'
end end
def expand_deploy_keys(&block) def expand_deploy_keys(&block)
expand(:expand_deploy_keys) do expand_section('section.repository-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