Commit 8586391e authored by Lin Jen-Shin's avatar Lin Jen-Shin

Respect the latest changes from master

Basically using the new expand_section
parent 209c4c5e
......@@ -26,12 +26,12 @@
.settings-content
= render 'projects/runners/index'
%section.settings.no-animate.qa-secret-variables{ class: ('expanded' if expanded) }
%section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4
Secret variables
= link_to icon('question-circle'), help_page_path('ci/variables/README', anchor: 'secret-variables'), target: '_blank'
%button.btn.js-settings-toggle.qa-expand-secret-variables
%button.btn.js-settings-toggle
= expanded ? 'Collapse' : 'Expand'
%p
= render "ci/variables/content"
......
......@@ -112,7 +112,6 @@ module QA
autoload :Repository, 'qa/page/project/settings/repository'
autoload :CICD, 'qa/page/project/settings/ci_cd'
autoload :DeployKeys, 'qa/page/project/settings/deploy_keys'
autoload :CICD, 'qa/page/project/settings/cicd'
autoload :SecretVariables, 'qa/page/project/settings/secret_variables'
autoload :Runners, 'qa/page/project/settings/runners'
end
......
......@@ -24,9 +24,7 @@ module QA
def fabricate!
project.visit!
Page::Menu::Side.act do
click_ci_cd_settings
end
Page::Menu::Side.act { click_ci_cd_settings }
Page::Project::Settings::CICD.perform do |setting|
setting.expand_secret_variables do |page|
......
......@@ -29,17 +29,21 @@ module QA
end
end
def click_ci_cd_pipelines
within_sidebar do
click_link('CI / CD')
end
end
private
def hover_settings
within_sidebar do
find('.qa-settings-item').hover
within_fly_out do
yield
end
end
end
def within_sidebar
page.within('.sidebar-top-level-items') do
......
......@@ -7,6 +7,7 @@ module QA
view 'app/views/projects/settings/ci_cd/show.html.haml' do
element :runners_settings, 'Runners settings'
element :secret_variables, 'Secret variables'
end
def expand_runners_settings(&block)
......@@ -14,6 +15,12 @@ module QA
Settings::Runners.perform(&block)
end
end
def expand_secret_variables(&block)
expand_section('Secret variables') do
Settings::SecretVariables.perform(&block)
end
end
end
end
end
......
module QA
module Page
module Project
module Settings
class CICD < Page::Base
include Common
view 'app/views/projects/settings/ci_cd/show.html.haml' do
element :expand_secret_variables
end
def expand_secret_variables(&block)
expand(:expand_secret_variables) do
SecretVariables.perform(&block)
end
end
end
end
end
end
end
......@@ -12,10 +12,17 @@ module QA
end
def expand_section(name)
within_section(name) do
# Don't expand if it's already expanded
click_button 'Expand' unless first('button', text: 'Collapse')
yield
end
end
def within_section(name)
page.within('#content-body') do
page.within('section', text: name) do
click_button 'Expand'
yield
end
end
......
......@@ -3,15 +3,13 @@ module QA
module Project
module Settings
class SecretVariables < Page::Base
include Common
view 'app/views/ci/variables/_table.html.haml' do
element :variable_key, '.variable-key'
element :variable_value, '.variable-value'
end
view 'app/views/projects/settings/ci_cd/show.html.haml' do
element :secret_variable
end
def fill_variable_key(key)
fill_in 'variable_key', with: key
end
......@@ -36,19 +34,10 @@ module QA
private
def within_section
page.within('.qa-secret-variables') do
yield
end
end
def reveal_value
within_section do
click_button('Reveal value')
end
yield.tap do
within_section do
click_button('Hide value')
end
end
......@@ -56,5 +45,4 @@ module QA
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