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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
2a119cca
Commit
2a119cca
authored
Jun 12, 2019
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feture spec for Merge Train
Adding feature spec
parent
1620dd74
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
199 additions
and
0 deletions
+199
-0
ee/spec/features/merge_trains/user_adds_merge_request_to_merge_train_spec.rb
...rge_trains/user_adds_merge_request_to_merge_train_spec.rb
+103
-0
ee/spec/features/merge_trains/user_adds_to_merge_train_when_pipeline_succeeds_spec.rb
...s/user_adds_to_merge_train_when_pipeline_succeeds_spec.rb
+96
-0
No files found.
ee/spec/features/merge_trains/user_adds_merge_request_to_merge_train_spec.rb
0 → 100644
View file @
2a119cca
# frozen_string_literal: true
require
'rails_helper'
describe
'User adds a merge request to a merge train'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:merge_request
)
do
create
(
:merge_request
,
:with_merge_request_pipeline
,
source_project:
project
,
source_branch:
'feature'
,
target_project:
project
,
target_branch:
'master'
)
end
let
(
:ci_yaml
)
do
{
test:
{
stage:
'test'
,
script:
'echo'
,
only:
[
'merge_requests'
]
}
}
end
before
do
stub_licensed_features
(
merge_pipelines:
true
,
merge_trains:
true
)
project
.
add_maintainer
(
user
)
project
.
update!
(
merge_pipelines_enabled:
true
,
merge_trains_enabled:
true
)
merge_request
.
all_pipelines
.
first
.
succeed!
merge_request
.
update_head_pipeline
stub_ci_pipeline_yaml_file
(
YAML
.
dump
(
ci_yaml
))
sign_in
(
user
)
end
it
"shows 'Start merge train' button"
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
to
have_button
(
'Start merge train'
)
end
context
'when merge_trains EEP license is not available'
do
before
do
stub_licensed_features
(
merge_trains:
false
)
end
it
'does not show Start merge train'
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
not_to
have_button
(
'Start merge train'
)
end
end
context
"when user clicks 'Start merge train' button"
do
before
do
visit
project_merge_request_path
(
project
,
merge_request
)
click_button
'Start merge train'
wait_for_requests
end
it
'informs merge request that auto merge is enabled'
do
within
(
'.mr-widget-section'
)
do
expect
(
page
).
to
have_content
(
"Added to the merge train by
#{
user
.
name
}
"
)
expect
(
page
).
to
have_content
(
'The source branch will not be deleted'
)
expect
(
page
).
to
have_link
(
'Remove from merge train'
)
expect
(
page
).
to
have_link
(
'Delete source branch'
)
end
end
context
"when user clicks 'Remove from merge train' button"
do
before
do
click_link
'Remove from merge train'
end
it
'cancels automatic merge'
do
within
(
'.mr-widget-section'
)
do
expect
(
page
).
not_to
have_content
(
"Added to the merge train by
#{
user
.
name
}
"
)
expect
(
page
).
to
have_button
(
'Start merge train'
)
end
end
end
context
"when user clicks 'Delete source branch"
do
before
do
click_link
'Delete source branch'
end
it
'updates the merge option'
do
within
(
'.mr-widget-section'
)
do
expect
(
page
).
to
have_content
(
'The source branch will be deleted'
)
end
end
end
end
context
'when the merge request is not the first queue on the train'
do
before
do
create
(
:merge_request
,
:on_train
,
source_project:
project
,
source_branch:
'signed-commits'
,
target_project:
project
,
target_branch:
'master'
)
end
it
"shows 'Add to merge train' button"
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
to
have_button
(
'Add to merge train'
)
end
end
end
ee/spec/features/merge_trains/user_adds_to_merge_train_when_pipeline_succeeds_spec.rb
0 → 100644
View file @
2a119cca
# frozen_string_literal: true
require
'rails_helper'
describe
'User adds to merge train when pipeline succeeds'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:merge_request
)
do
create
(
:merge_request
,
:with_merge_request_pipeline
,
source_project:
project
,
source_branch:
'feature'
,
target_project:
project
,
target_branch:
'master'
)
end
before
do
stub_licensed_features
(
merge_pipelines:
true
,
merge_trains:
true
)
project
.
add_maintainer
(
user
)
project
.
update!
(
merge_pipelines_enabled:
true
,
merge_trains_enabled:
true
)
merge_request
.
update_head_pipeline
sign_in
(
user
)
end
it
'shows Start merge train when pipeline succeeds button'
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
to
have_button
(
'Start merge train when pipeline succeeds'
)
end
context
'when merge_trains EEP license is not available'
do
before
do
stub_licensed_features
(
merge_trains:
false
)
end
it
'does not show Start merge train when pipeline succeeds button'
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
not_to
have_button
(
'Start merge train when pipeline succeeds'
)
end
end
context
"when user clicks 'Start merge train when pipeline succeeds' button"
do
before
do
visit
project_merge_request_path
(
project
,
merge_request
)
click_button
'Start merge train when pipeline succeeds'
end
it
'informs merge request that auto merge is enabled'
do
within
(
'.mr-widget-section'
)
do
expect
(
page
).
to
have_content
(
"Set by
#{
user
.
name
}
to start a merge train when the pipeline succeeds"
)
expect
(
page
).
to
have_content
(
'The source branch will not be deleted'
)
expect
(
page
).
to
have_link
(
'Cancel automatic merge'
)
expect
(
page
).
to
have_link
(
'Delete source branch'
)
end
end
context
"when user clicks 'Cancel automatic merge' button"
do
before
do
click_link
'Cancel automatic merge'
end
it
'cancels automatic merge'
do
within
(
'.mr-widget-section'
)
do
expect
(
page
).
not_to
have_content
(
"Set by
#{
user
.
name
}
to start a merge train when the pipeline succeeds"
)
expect
(
page
).
to
have_button
(
'Start merge train when pipeline succeeds'
)
end
end
end
context
"when user clicks 'Delete source branch"
do
before
do
click_link
'Delete source branch'
end
it
'updates the merge option'
do
within
(
'.mr-widget-section'
)
do
expect
(
page
).
to
have_content
(
'The source branch will be deleted'
)
end
end
end
end
context
'when the merge request is not the first queue on the train'
do
before
do
create
(
:merge_request
,
:on_train
,
source_project:
project
,
source_branch:
'signed-commits'
,
target_project:
project
,
target_branch:
'master'
)
end
it
'shows Add to merge train when pipeline succeeds button'
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
to
have_button
(
'Add to merge train when pipeline succeeds'
)
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