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
c98c8f9a
Commit
c98c8f9a
authored
Jun 29, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix feature tests
parent
2dba0cf0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
80 deletions
+21
-80
spec/features/projects/pipeline_schedules_spec.rb
spec/features/projects/pipeline_schedules_spec.rb
+21
-80
No files found.
spec/features/projects/pipeline_schedules_spec.rb
View file @
c98c8f9a
...
@@ -19,12 +19,19 @@ feature 'Pipeline Schedules', :feature, js: true do
...
@@ -19,12 +19,19 @@ feature 'Pipeline Schedules', :feature, js: true do
visit_pipelines_schedules
visit_pipelines_schedules
end
end
it
'avoids N + 1 queries'
do
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
visit_pipelines_schedules
}.
count
create_list
(
:ci_pipeline_schedule
,
2
,
project:
project
)
expect
{
visit_pipelines_schedules
}.
not_to
exceed_query_limit
(
control_count
)
end
describe
'The view'
do
describe
'The view'
do
it
'displays the required information description'
do
it
'displays the required information description'
do
page
.
within
(
'.pipeline-schedule-table-row'
)
do
page
.
within
(
'.pipeline-schedule-table-row'
)
do
expect
(
page
).
to
have_content
(
'pipeline schedule'
)
expect
(
page
).
to
have_content
(
'pipeline schedule'
)
expect
(
find
(
".next-run-cell time"
)[
'data-original-title'
])
expect
(
page
).
to
have_content
(
pipeline_schedule
.
real_next_run
.
strftime
(
'%b %d, %Y'
))
.
to
include
(
pipeline_schedule
.
real_next_run
.
strftime
(
'%b %-d, %Y'
))
expect
(
page
).
to
have_link
(
'master'
)
expect
(
page
).
to
have_link
(
'master'
)
expect
(
page
).
to
have_link
(
"#
#{
pipeline
.
id
}
"
)
expect
(
page
).
to
have_link
(
"#
#{
pipeline
.
id
}
"
)
end
end
...
@@ -55,7 +62,7 @@ feature 'Pipeline Schedules', :feature, js: true do
...
@@ -55,7 +62,7 @@ feature 'Pipeline Schedules', :feature, js: true do
it
'deletes the pipeline'
do
it
'deletes the pipeline'
do
click_link
'Delete'
click_link
'Delete'
expect
(
page
).
not_to
have_c
ss
(
".pipeline-schedule-table-row"
)
expect
(
page
).
not_to
have_c
ontent
(
'pipeline schedule'
)
end
end
end
end
...
@@ -93,15 +100,6 @@ feature 'Pipeline Schedules', :feature, js: true do
...
@@ -93,15 +100,6 @@ feature 'Pipeline Schedules', :feature, js: true do
expect
(
page
).
to
have_content
(
'This field is required'
)
expect
(
page
).
to
have_content
(
'This field is required'
)
end
end
it
'sets a variable'
do
fill_in_schedule_form
fill_in_variable
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([{
key:
'foo'
,
value:
'bar'
,
public:
false
}])
end
end
end
describe
'PATCH /projects/pipelines_schedules/:id/edit'
do
describe
'PATCH /projects/pipelines_schedules/:id/edit'
do
...
@@ -124,14 +122,6 @@ feature 'Pipeline Schedules', :feature, js: true do
...
@@ -124,14 +122,6 @@ feature 'Pipeline Schedules', :feature, js: true do
expect
(
page
).
to
have_content
(
'my brand new description'
)
expect
(
page
).
to
have_content
(
'my brand new description'
)
end
end
it
'adds a new variable'
do
fill_in_variable
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([{
key:
'foo'
,
value:
'bar'
,
public:
false
}])
end
context
'when ref is nil'
do
context
'when ref is nil'
do
before
do
before
do
pipeline_schedule
.
update_attribute
(
:ref
,
nil
)
pipeline_schedule
.
update_attribute
(
:ref
,
nil
)
...
@@ -144,40 +134,6 @@ feature 'Pipeline Schedules', :feature, js: true do
...
@@ -144,40 +134,6 @@ feature 'Pipeline Schedules', :feature, js: true do
end
end
end
end
end
end
context
'when variables already exist'
do
before
do
create
(
:ci_pipeline_schedule_variable
,
key:
'some_key'
,
value:
'some_value'
,
pipeline_schedule:
pipeline_schedule
)
edit_pipeline_schedule
end
it
'edits existing variable'
do
expect
(
first
(
'[name="schedule[variables_attributes][][key]"]'
).
value
).
to
eq
(
'some_key'
)
expect
(
first
(
'[name="schedule[variables_attributes][][value]"]'
).
value
).
to
eq
(
'some_value'
)
fill_in_variable
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([{
key:
'foo'
,
value:
'bar'
,
public:
false
}])
end
it
'removes an existing variable'
do
remove_variable
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([])
end
it
'adds another variable'
do
fill_in_variable
(
1
)
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([
{
key:
'some_key'
,
value:
'some_value'
,
public:
false
},
{
key:
'foo'
,
value:
'bar'
,
public:
false
}
])
end
end
end
end
context
'when user creates a new pipeline schedule with variables'
do
context
'when user creates a new pipeline schedule with variables'
do
...
@@ -194,18 +150,16 @@ feature 'Pipeline Schedules', :feature, js: true do
...
@@ -194,18 +150,16 @@ feature 'Pipeline Schedules', :feature, js: true do
scenario
'user sees the new variable in edit window'
do
scenario
'user sees the new variable in edit window'
do
find
(
".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']"
).
click
find
(
".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']"
).
click
page
.
within
(
'.pipeline-variable-list'
)
do
expect
(
find
(
".pipeline-variable-list .pipeline-variable-row:nth-child(1) .pipeline-variable-key-input"
).
value
).
to
eq
(
'AAA'
)
expect
(
find
(
".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input"
).
value
).
to
eq
(
'AAA'
)
expect
(
find
(
".pipeline-variable-list .pipeline-variable-row:nth-child(1) .pipeline-variable-value-input"
).
value
).
to
eq
(
'AAA123'
)
expect
(
find
(
".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input"
).
value
).
to
eq
(
'AAA123'
)
expect
(
find
(
".pipeline-variable-list .pipeline-variable-row:nth-child(2) .pipeline-variable-key-input"
).
value
).
to
eq
(
'BBB'
)
expect
(
find
(
".pipeline-variable-row:nth-child(2) .pipeline-variable-key-input"
).
value
).
to
eq
(
'BBB'
)
expect
(
find
(
".pipeline-variable-list .pipeline-variable-row:nth-child(2) .pipeline-variable-value-input"
).
value
).
to
eq
(
'BBB123'
)
expect
(
find
(
".pipeline-variable-row:nth-child(2) .pipeline-variable-value-input"
).
value
).
to
eq
(
'BBB123'
)
end
end
end
end
end
context
'when user edits a variable of a pipeline schedule'
do
context
'when user edits a variable of a pipeline schedule'
do
background
do
background
do
create
(
:ci_pipeline_schedule
,
project:
project
,
owner:
user
).
tap
do
|
pipeline_schedule
|
create
(
:ci_pipeline_schedule
,
owner:
user
).
tap
do
|
pipeline_schedule
|
create
(
:ci_pipeline_schedule_variable
,
key:
'AAA'
,
value:
'AAA123'
,
pipeline_schedule:
pipeline_schedule
)
create
(
:ci_pipeline_schedule_variable
,
key:
'AAA'
,
value:
'AAA123'
,
pipeline_schedule:
pipeline_schedule
)
end
end
visit_pipelines_schedules
visit_pipelines_schedules
...
@@ -217,30 +171,26 @@ feature 'Pipeline Schedules', :feature, js: true do
...
@@ -217,30 +171,26 @@ feature 'Pipeline Schedules', :feature, js: true do
scenario
'user sees the updated variable in edit window'
do
scenario
'user sees the updated variable in edit window'
do
find
(
".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']"
).
click
find
(
".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']"
).
click
page
.
within
(
'.pipeline-variable-list'
)
do
expect
(
find
(
".pipeline-variable-list .pipeline-variable-row:nth-child(1) .pipeline-variable-key-input"
).
value
).
to
eq
(
'foo'
)
expect
(
find
(
".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input"
).
value
).
to
eq
(
'foo'
)
expect
(
find
(
".pipeline-variable-list .pipeline-variable-row:nth-child(1) .pipeline-variable-value-input"
).
value
).
to
eq
(
'bar'
)
expect
(
find
(
".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input"
).
value
).
to
eq
(
'bar'
)
end
end
end
end
end
context
'when user removes a variable of a pipeline schedule'
do
context
'when user removes a variable of a pipeline schedule'
do
background
do
background
do
create
(
:ci_pipeline_schedule
,
project:
project
,
owner:
user
).
tap
do
|
pipeline_schedule
|
create
(
:ci_pipeline_schedule
,
owner:
user
).
tap
do
|
pipeline_schedule
|
create
(
:ci_pipeline_schedule_variable
,
key:
'AAA'
,
value:
'AAA123'
,
pipeline_schedule:
pipeline_schedule
)
create
(
:ci_pipeline_schedule_variable
,
key:
'AAA'
,
value:
'AAA123'
,
pipeline_schedule:
pipeline_schedule
)
end
end
visit_pipelines_schedules
visit_pipelines_schedules
find
(
".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']"
).
click
find
(
".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']"
).
click
fi
nd
(
'.pipeline-variable-list .pipeline-variable-row-remove-button'
).
click
fi
rst
(
'.pipeline-variable-list .pipeline-variable-row-remove-button'
).
click
click_button
'Save pipeline schedule'
click_button
'Save pipeline schedule'
end
end
scenario
'user does not see the removed variable in edit window'
do
scenario
'user does not see the removed variable in edit window'
do
find
(
".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']"
).
click
find
(
".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']"
).
click
page
.
within
(
'.pipeline-variable-list'
)
do
expect
(
find
(
".pipeline-variable-list .pipeline-variable-row:nth-child(1) .pipeline-variable-key-input"
).
value
).
to
eq
(
''
)
expect
(
find
(
".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input"
).
value
).
to
eq
(
''
)
expect
(
find
(
".pipeline-variable-list .pipeline-variable-row:nth-child(1) .pipeline-variable-value-input"
).
value
).
to
eq
(
''
)
expect
(
find
(
".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input"
).
value
).
to
eq
(
''
)
end
end
end
end
end
...
@@ -270,15 +220,6 @@ feature 'Pipeline Schedules', :feature, js: true do
...
@@ -270,15 +220,6 @@ feature 'Pipeline Schedules', :feature, js: true do
click_button
'Save pipeline schedule'
click_button
'Save pipeline schedule'
end
end
def
fill_in_variable
(
index
=
0
)
all
(
'[name="schedule[variables_attributes][][key]"]'
)[
index
].
set
(
'foo'
)
all
(
'[name="schedule[variables_attributes][][value]"]'
)[
index
].
set
(
'bar'
)
end
def
remove_variable
first
(
'.js-pipeline-variable-list .js-row-remove-button'
).
click
end
def
fill_in_schedule_form
def
fill_in_schedule_form
fill_in
'schedule_description'
,
with:
'my fancy description'
fill_in
'schedule_description'
,
with:
'my fancy description'
fill_in
'schedule_cron'
,
with:
'* 1 2 3 4'
fill_in
'schedule_cron'
,
with:
'* 1 2 3 4'
...
...
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