Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
ca7e1058
Commit
ca7e1058
authored
Jan 22, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a scenario for adding secret variables
parent
68cc9ea2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
167 additions
and
3 deletions
+167
-3
app/views/projects/settings/ci_cd/show.html.haml
app/views/projects/settings/ci_cd/show.html.haml
+2
-2
qa/qa.rb
qa/qa.rb
+3
-0
qa/qa/factory/resource/secret_variable.rb
qa/qa/factory/resource/secret_variable.rb
+43
-0
qa/qa/page/menu/side.rb
qa/qa/page/menu/side.rb
+19
-1
qa/qa/page/project/settings/cicd.rb
qa/qa/page/project/settings/cicd.rb
+21
-0
qa/qa/page/project/settings/secret_variables.rb
qa/qa/page/project/settings/secret_variables.rb
+60
-0
qa/qa/specs/features/project/add_secret_variable_spec.rb
qa/qa/specs/features/project/add_secret_variable_spec.rb
+19
-0
No files found.
app/views/projects/settings/ci_cd/show.html.haml
View file @
ca7e1058
...
...
@@ -26,12 +26,12 @@
.settings-content
=
render
'projects/runners/index'
%section
.settings.no-animate
{
class:
(
'expanded'
if
expanded
)
}
%section
.settings.no-animate
.qa-secret-variables
{
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
%button
.btn.js-settings-toggle
.qa-expand-secret-variables
=
expanded
?
'Collapse'
:
'Expand'
%p
=
render
"ci/variables/content"
...
...
qa/qa.rb
View file @
ca7e1058
...
...
@@ -26,6 +26,7 @@ module QA
autoload
:Group
,
'qa/factory/resource/group'
autoload
:Project
,
'qa/factory/resource/project'
autoload
:DeployKey
,
'qa/factory/resource/deploy_key'
autoload
:SecretVariable
,
'qa/factory/resource/secret_variable'
end
module
Repository
...
...
@@ -105,6 +106,8 @@ module QA
autoload
:Common
,
'qa/page/project/settings/common'
autoload
:Repository
,
'qa/page/project/settings/repository'
autoload
:DeployKeys
,
'qa/page/project/settings/deploy_keys'
autoload
:CICD
,
'qa/page/project/settings/cicd'
autoload
:SecretVariables
,
'qa/page/project/settings/secret_variables'
end
end
...
...
qa/qa/factory/resource/secret_variable.rb
0 → 100644
View file @
ca7e1058
module
QA
module
Factory
module
Resource
class
SecretVariable
<
Factory
::
Base
attr_accessor
:key
,
:value
product
:key
do
Page
::
Project
::
Settings
::
CICD
.
act
do
expand_secret_variables
(
&
:variable_key
)
end
end
product
:value
do
Page
::
Project
::
Settings
::
CICD
.
act
do
expand_secret_variables
(
&
:variable_value
)
end
end
dependency
Factory
::
Resource
::
Project
,
as: :project
do
|
project
|
project
.
name
=
'project-with-secret-variables'
project
.
description
=
'project for adding secret variable test'
end
def
fabricate!
project
.
visit!
Page
::
Menu
::
Side
.
act
do
click_cicd_setting
end
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
setting
|
setting
.
expand_secret_variables
do
|
page
|
page
.
fill_variable_key
(
key
)
page
.
fill_variable_value
(
value
)
page
.
add_variable
end
end
end
end
end
end
end
qa/qa/page/menu/side.rb
View file @
ca7e1058
...
...
@@ -8,19 +8,31 @@ module QA
element
:top_level_items
,
'.sidebar-top-level-items'
end
view
'app/assets/javascripts/fly_out_nav.js'
do
element
:fly_out
,
"IS_SHOWING_FLY_OUT_CLASS = 'is-showing-fly-out'"
end
def
click_repository_setting
hover_setting
do
click_link
(
'Repository'
)
end
end
def
click_cicd_setting
hover_setting
do
click_link
(
'CI / CD'
)
end
end
private
def
hover_setting
within_sidebar
do
find
(
'.qa-settings-item'
).
hover
yield
within_fly_out
do
yield
end
end
end
...
...
@@ -29,6 +41,12 @@ module QA
yield
end
end
def
within_fly_out
page
.
within
(
'.is-showing-fly-out'
)
do
yield
end
end
end
end
end
...
...
qa/qa/page/project/settings/cicd.rb
0 → 100644
View file @
ca7e1058
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
qa/qa/page/project/settings/secret_variables.rb
0 → 100644
View file @
ca7e1058
module
QA
module
Page
module
Project
module
Settings
class
SecretVariables
<
Page
::
Base
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
def
fill_variable_value
(
value
)
fill_in
'variable_value'
,
with:
value
end
def
add_variable
click_on
'Add new variable'
end
def
variable_key
page
.
find
(
'.variable-key'
).
text
end
def
variable_value
reveal_value
do
page
.
find
(
'.variable-value'
).
text
end
end
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
end
end
end
end
end
end
qa/qa/specs/features/project/add_secret_variable_spec.rb
0 → 100644
View file @
ca7e1058
module
QA
feature
'secret variables support'
,
:core
do
given
(
:variable_key
)
{
'VARIABLE_KEY'
}
given
(
:variable_value
)
{
'variable value'
}
scenario
'user adds a secret variable'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
variable
=
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
resource
.
key
=
variable_key
resource
.
value
=
variable_value
end
expect
(
variable
.
key
).
to
eq
(
variable_key
)
expect
(
variable
.
value
).
to
eq
(
variable_value
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment