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
60b6d006
Commit
60b6d006
authored
Apr 12, 2022
by
Tiffany Rea
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split cancel MR in merge train spec into 2 specs
parent
2a0657dd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
155 deletions
+176
-155
qa/qa/page/dashboard/todos.rb
qa/qa/page/dashboard/todos.rb
+5
-1
qa/qa/specs/features/ee/browser_ui/4_verify/cancelling_merge_request_in_merge_train_spec.rb
.../4_verify/cancelling_merge_request_in_merge_train_spec.rb
+0
-154
qa/qa/specs/features/ee/browser_ui/4_verify/system_cancel_merge_request_in_merge_train_spec.rb
...verify/system_cancel_merge_request_in_merge_train_spec.rb
+48
-0
qa/qa/specs/features/ee/browser_ui/4_verify/user_cancel_merge_request_in_merge_train_spec.rb
...4_verify/user_cancel_merge_request_in_merge_train_spec.rb
+35
-0
qa/spec/support/shared_contexts/merge_train_spec_with_user_prep.rb
...upport/shared_contexts/merge_train_spec_with_user_prep.rb
+88
-0
No files found.
qa/qa/page/dashboard/todos.rb
View file @
60b6d006
...
@@ -17,7 +17,11 @@ module QA
...
@@ -17,7 +17,11 @@ module QA
end
end
def
has_todo_list?
def
has_todo_list?
has_element?
:todo_item_container
has_element?
(
:todo_item_container
)
end
def
has_no_todo_list?
has_no_element?
(
:todo_item_container
)
end
end
def
has_latest_todo_item_with_content?
(
action
,
title
)
def
has_latest_todo_item_with_content?
(
action
,
title
)
...
...
qa/qa/specs/features/ee/browser_ui/4_verify/cancelling_merge_request_in_merge_train_spec.rb
deleted
100644 → 0
View file @
2a0657dd
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Verify'
do
describe
'Cancelling merge request in merge train'
,
:runner
,
:requires_admin
do
before
(
:all
)
do
executor
=
"qa-runner-
#{
Faker
::
Alphanumeric
.
alphanumeric
(
8
)
}
"
@file_name
=
Faker
::
File
.
unique
.
file_name
@admin_api_client
=
Runtime
::
API
::
Client
.
as_admin
@project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'pipeline-for-merge-train'
end
@runner
=
Resource
::
Runner
.
fabricate_via_api!
do
|
runner
|
runner
.
project
=
@project
runner
.
name
=
executor
runner
.
tags
=
[
executor
]
end
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
@project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
(
[
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
test_merge_train:
tags:
-
#{
executor
}
script:
- sleep 10
- echo 'OK!'
only:
- merge_requests
YAML
},
{
file_path:
@file_name
,
content:
Faker
::
Lorem
.
sentence
}
]
)
end
Flow
::
Login
.
sign_in
@project
.
visit!
Flow
::
MergeRequest
.
enable_merge_trains
end
after
(
:all
)
do
@runner
.
remove_via_api!
@project
.
remove_via_api!
end
before
do
@mr_title
=
Faker
::
Lorem
.
sentence
@user
=
Resource
::
User
.
fabricate_via_api!
do
|
resource
|
resource
.
api_client
=
@admin_api_client
end
@user_api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
,
user:
@user
)
@project
.
add_member
(
@user
,
Resource
::
Members
::
AccessLevel
::
MAINTAINER
)
merge_request
=
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
api_client
=
@user_api_client
merge_request
.
title
=
@mr_title
merge_request
.
project
=
@project
merge_request
.
description
=
Faker
::
Lorem
.
sentence
merge_request
.
target_new_branch
=
false
merge_request
.
update_existing_file
=
true
merge_request
.
file_name
=
@file_name
merge_request
.
file_content
=
Faker
::
Lorem
.
sentence
end
Flow
::
Login
.
sign_in
(
as:
@user
)
Support
::
Retrier
.
retry_until
do
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
show
.
has_title?
@mr_title
end
end
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
show
.
has_pipeline_status?
(
'passed'
)
show
.
try_to_merge!
end
end
after
do
@user
.
remove_via_api!
end
context
'when system cancels the merge request'
,
quarantine:
{
issue:
'https://gitlab.com/gitlab-org/gitlab/-/issues/324122'
,
type: :bug
}
do
it
'creates a TODO task'
,
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347666'
do
# Create a merge conflict
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
api_client
=
@user_api_client
commit
.
project
=
@project
commit
.
commit_message
=
'changing text file'
commit
.
update_files
(
[
{
file_path:
@file_name
,
content:
'Has to be different than before.'
}
]
)
end
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
expect
(
show
).
to
have_system_note
(
'removed this merge request from the merge train'
)
end
Page
::
Main
::
Menu
.
perform
do
|
main
|
main
.
go_to_page_by_shortcut
(
:todos_shortcut_button
)
end
Page
::
Dashboard
::
Todos
.
perform
do
|
todos
|
todos
.
wait_until
(
reload:
true
,
sleep_interval:
1
)
{
todos
.
has_todo_list?
}
expect
(
todos
).
to
have_latest_todo_item_with_content
(
"Removed from Merge Train:"
,
@mr_title
)
end
end
end
context
'when user cancels the merge request'
do
it
'does not create a TODO task'
,
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347665'
do
# Manually removes merge request from the train
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
show
.
wait_until
(
reload:
false
)
do
show
.
has_content?
'started a merge train'
end
show
.
cancel_auto_merge!
expect
(
show
).
to
have_system_note
(
'removed this merge request from the merge train'
)
end
Page
::
Main
::
Menu
.
perform
do
|
main
|
main
.
go_to_page_by_shortcut
(
:todos_shortcut_button
)
end
Page
::
Dashboard
::
Todos
.
perform
do
|
todos
|
expect
(
todos
).
not_to
have_todo_list
,
'This user should not have any to-do item but found at least one!'
end
end
end
end
end
end
qa/qa/specs/features/ee/browser_ui/4_verify/system_cancel_merge_request_in_merge_train_spec.rb
0 → 100644
View file @
60b6d006
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Verify'
do
describe
'Cancelling merge request in merge train'
,
:runner
,
:requires_admin
do
context
'when system cancels the merge request'
do
include_context
'merge train spec with user prep'
it
(
'creates a TODO task'
,
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347666'
,
quarantine:
{
issue:
'https://gitlab.com/gitlab-org/gitlab/-/issues/324122'
,
type: :bug
}
)
do
# Create a merge conflict
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
commit_message
=
'changing text file'
commit
.
update_files
(
[
{
file_path:
file_name
,
content:
'Has to be different than before.'
}
]
)
end
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
expect
(
show
).
to
have_system_note
(
'removed this merge request from the merge train'
)
end
Page
::
Main
::
Menu
.
perform
do
|
main
|
main
.
go_to_page_by_shortcut
(
:todos_shortcut_button
)
end
Page
::
Dashboard
::
Todos
.
perform
do
|
todos
|
todos
.
wait_until
(
reload:
true
,
sleep_interval:
1
)
{
todos
.
has_todo_list?
}
expect
(
todos
).
to
have_latest_todo_item_with_content
(
"Removed from Merge Train:"
,
mr_title
)
end
end
end
end
end
end
qa/qa/specs/features/ee/browser_ui/4_verify/user_cancel_merge_request_in_merge_train_spec.rb
0 → 100644
View file @
60b6d006
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Verify'
do
describe
'Cancelling merge request in merge train'
,
:runner
,
:requires_admin
do
context
'when user cancels the merge request'
do
include_context
'merge train spec with user prep'
it
(
'does not create a TODO task'
,
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347665'
)
do
# Manually removes merge request from the train
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
show
.
wait_until
(
reload:
false
)
do
show
.
has_content?
'started a merge train'
end
show
.
cancel_auto_merge!
expect
(
show
).
to
have_system_note
(
'removed this merge request from the merge train'
)
end
Page
::
Main
::
Menu
.
perform
do
|
main
|
main
.
go_to_page_by_shortcut
(
:todos_shortcut_button
)
end
Page
::
Dashboard
::
Todos
.
perform
do
|
todos
|
expect
(
todos
).
to
have_no_todo_list
,
'This user should not have any to-do item but found at least one!'
end
end
end
end
end
end
qa/spec/support/shared_contexts/merge_train_spec_with_user_prep.rb
0 → 100644
View file @
60b6d006
# frozen_string_literal: true
module
QA
RSpec
.
shared_context
'merge train spec with user prep'
do
let
(
:executor
)
{
"qa-runner-
#{
Faker
::
Alphanumeric
.
alphanumeric
(
number:
8
)
}
"
}
let
(
:file_name
)
{
Faker
::
Lorem
.
word
}
let
(
:mr_title
)
{
Faker
::
Lorem
.
sentence
}
let
(
:admin_api_client
)
{
Runtime
::
API
::
Client
.
as_admin
}
let
(
:user
)
do
Resource
::
User
.
fabricate_via_api!
do
|
user
|
user
.
api_client
=
admin_api_client
end
end
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'pipeline-for-merge-trains'
end
end
let!
(
:runner
)
do
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
project
=
project
runner
.
name
=
executor
runner
.
tags
=
[
executor
]
end
end
let!
(
:project_files
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
(
[
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
test_merge_train:
tags:
-
#{
executor
}
script:
- sleep 10
- echo 'OK!'
only:
- merge_requests
YAML
},
{
file_path:
file_name
,
content:
Faker
::
Lorem
.
sentence
}
]
)
end
end
before
do
project
.
add_member
(
user
,
Resource
::
Members
::
AccessLevel
::
MAINTAINER
)
Flow
::
Login
.
sign_in
project
.
visit!
Flow
::
MergeRequest
.
enable_merge_trains
Flow
::
Login
.
sign_in
(
as:
user
)
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
title
=
mr_title
merge_request
.
project
=
project
merge_request
.
description
=
Faker
::
Lorem
.
sentence
merge_request
.
target_new_branch
=
false
merge_request
.
update_existing_file
=
true
merge_request
.
file_name
=
file_name
merge_request
.
file_content
=
Faker
::
Lorem
.
sentence
end
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
show
.
has_pipeline_status?
(
'passed'
)
show
.
try_to_merge!
end
end
after
do
runner
&
.
remove_via_api!
user
&
.
remove_via_api!
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