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
Léo-Paul Géneau
gitlab-ce
Commits
a69b3626
Commit
a69b3626
authored
Feb 16, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and simplify end-to-end tests for secret variables
parent
1192526b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
39 deletions
+33
-39
qa/qa/factory/resource/secret_variable.rb
qa/qa/factory/resource/secret_variable.rb
+0
-12
qa/qa/page/base.rb
qa/qa/page/base.rb
+4
-0
qa/qa/page/project/settings/secret_variables.rb
qa/qa/page/project/settings/secret_variables.rb
+12
-14
qa/qa/specs/features/project/add_secret_variable_spec.rb
qa/qa/specs/features/project/add_secret_variable_spec.rb
+12
-7
qa/spec/page/base_spec.rb
qa/spec/page/base_spec.rb
+5
-6
No files found.
qa/qa/factory/resource/secret_variable.rb
View file @
a69b3626
...
@@ -4,18 +4,6 @@ module QA
...
@@ -4,18 +4,6 @@ module QA
class
SecretVariable
<
Factory
::
Base
class
SecretVariable
<
Factory
::
Base
attr_accessor
:key
,
:value
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
|
dependency
Factory
::
Resource
::
Project
,
as: :project
do
|
project
|
project
.
name
=
'project-with-secret-variables'
project
.
name
=
'project-with-secret-variables'
project
.
description
=
'project for adding secret variable test'
project
.
description
=
'project for adding secret variable test'
...
...
qa/qa/page/base.rb
View file @
a69b3626
...
@@ -98,6 +98,10 @@ module QA
...
@@ -98,6 +98,10 @@ module QA
views
.
map
(
&
:errors
).
flatten
views
.
map
(
&
:errors
).
flatten
end
end
def
self
.
elements
views
.
map
(
&
:elements
).
flatten
end
class
DSL
class
DSL
attr_reader
:views
attr_reader
:views
...
...
qa/qa/page/project/settings/secret_variables.rb
View file @
a69b3626
...
@@ -6,39 +6,37 @@ module QA
...
@@ -6,39 +6,37 @@ module QA
include
Common
include
Common
view
'app/views/ci/variables/_variable_row.html.haml'
do
view
'app/views/ci/variables/_variable_row.html.haml'
do
element
:variable_row
,
'.ci-variable-row-body'
element
:variable_key
,
'.js-ci-variable-input-key'
element
:variable_key
,
'.js-ci-variable-input-key'
element
:variable_value
,
'.js-ci-variable-input-value'
element
:variable_value
,
'.js-ci-variable-input-value'
element
:key_placeholder
,
'Input variable key'
element
:value_placeholder
,
'Input variable value'
end
end
view
'app/views/ci/variables/_index.html.haml'
do
view
'app/views/ci/variables/_index.html.haml'
do
element
:save_variables
,
'.js-secret-variables-save-button'
element
:save_variables
,
'.js-secret-variables-save-button'
element
:reveal_values
,
'.js-secret-value-reveal-button'
end
end
def
fill_variable_key
(
key
)
def
fill_variable_key
(
key
)
page
.
within
(
'.js-ci-variable-list-section .js-row:nth-child(1)'
)
do
fill_in
(
'Input variable key'
,
with:
key
,
match: :first
)
page
.
find
(
'.js-ci-variable-input-key'
).
set
(
key
)
end
end
end
def
fill_variable_value
(
value
)
def
fill_variable_value
(
value
)
page
.
within
(
'.js-ci-variable-list-section .js-row:nth-child(1)'
)
do
fill_in
(
'Input variable value'
,
with:
value
,
match: :first
)
page
.
find
(
'.js-ci-variable-input-value'
).
set
(
value
)
end
end
end
def
save_variables
def
save_variables
click_button
(
'Save variables'
)
find
(
'.js-secret-variables-save-button'
).
click
end
end
def
variable_key
def
reveal_variables
page
.
within
(
'.js-ci-variable-list-section .js-row:nth-child(1)'
)
do
find
(
'.js-secret-value-reveal-button'
).
click
page
.
find
(
'.js-ci-variable-input-key'
).
value
end
end
end
def
variable_value
def
variable_value
(
key
)
page
.
within
(
'.js-ci-variable-list-section .js-row:nth-child(1)'
)
do
within
(
'.ci-variable-row-body'
,
text:
key
)
do
page
.
find
(
'.js-ci-variable-input-value'
).
value
find
(
'.js-ci-variable-input-value'
).
value
end
end
end
end
end
end
...
...
qa/qa/specs/features/project/add_secret_variable_spec.rb
View file @
a69b3626
...
@@ -4,16 +4,21 @@ module QA
...
@@ -4,16 +4,21 @@ module QA
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
variable_key
=
'VARIABLE_KEY'
variable_value
=
'variable value'
variable
=
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
variable
=
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
resource
.
key
=
variable_key
resource
.
key
=
'VARIABLE_KEY'
resource
.
value
=
variable_value
resource
.
value
=
'some secret variable'
end
end
expect
(
variable
.
key
).
to
eq
(
variable_key
)
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
settings
|
expect
(
variable
.
value
).
to
eq
(
variable_value
)
settings
.
expand_secret_variables
do
|
page
|
expect
(
page
).
to
have_field
(
with:
'VARIABLE_KEY'
)
expect
(
page
).
not_to
have_field
(
with:
'some secret variable'
)
page
.
reveal_variables
expect
(
page
).
to
have_field
(
with:
'some secret variable'
)
end
end
end
end
end
end
end
end
qa/spec/page/base_spec.rb
View file @
a69b3626
...
@@ -14,7 +14,7 @@ describe QA::Page::Base do
...
@@ -14,7 +14,7 @@ describe QA::Page::Base do
end
end
view
'path/to/some/_partial.html.haml'
do
view
'path/to/some/_partial.html.haml'
do
element
:
something
,
'string pattern'
element
:
another_element
,
'string pattern'
end
end
end
end
end
end
...
@@ -25,11 +25,10 @@ describe QA::Page::Base do
...
@@ -25,11 +25,10 @@ describe QA::Page::Base do
end
end
it
'populates views objects with data about elements'
do
it
'populates views objects with data about elements'
do
subject
.
views
.
first
.
elements
.
tap
do
|
elements
|
expect
(
subject
.
elements
.
size
).
to
eq
3
expect
(
elements
.
size
).
to
eq
2
expect
(
subject
.
elements
).
to
all
(
be_an_instance_of
QA
::
Page
::
Element
)
expect
(
elements
).
to
all
(
be_an_instance_of
QA
::
Page
::
Element
)
expect
(
subject
.
elements
.
map
(
&
:name
))
expect
(
elements
.
map
(
&
:name
)).
to
eq
[
:something
,
:something_else
]
.
to
eq
[
:something
,
:something_else
,
:another_element
]
end
end
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