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
74bb62c7
Commit
74bb62c7
authored
Feb 17, 2021
by
Tiffany Rea
Committed by
Dan Davison
Feb 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify test and add wait and retry logics
parent
7281c770
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
80 deletions
+42
-80
qa/qa/ee/page/merge_request/show.rb
qa/qa/ee/page/merge_request/show.rb
+4
-1
qa/qa/page/merge_request/show.rb
qa/qa/page/merge_request/show.rb
+9
-3
qa/qa/specs/features/ee/browser_ui/4_verify/pipelines_for_merged_results_and_merge_trains_spec.rb
...ify/pipelines_for_merged_results_and_merge_trains_spec.rb
+29
-76
No files found.
qa/qa/ee/page/merge_request/show.rb
View file @
74bb62c7
...
...
@@ -225,9 +225,12 @@ module QA
end
def
merge_via_merge_train
# Revisit after merge page re-architect is done https://gitlab.com/gitlab-org/gitlab/-/issues/300042
# To remove page refresh logic if possible
wait_until_ready_to_merge
wait_until
{
!
find_element
(
:merge_button
).
has_text?
(
"when pipeline succeeds"
)
}
click_element
(
:merge_button
,
text:
"Start merge train"
)
click_element
(
:merge_button
)
finished_loading?
end
...
...
qa/qa/page/merge_request/show.rb
View file @
74bb62c7
...
...
@@ -224,8 +224,7 @@ module QA
end
def
merge!
wait_until_ready_to_merge
click_element
(
:merge_button
)
try_to_merge!
finished_loading?
raise
"Merge did not appear to be successful"
unless
merged?
...
...
@@ -237,7 +236,11 @@ module QA
end
def
merged?
has_element?
(
:merged_status_content
,
text:
'The changes were merged into'
,
wait:
60
)
# Revisit after merge page re-architect is done https://gitlab.com/gitlab-org/gitlab/-/issues/300042
# To remove page refresh logic if possible
retry_until
(
max_attempts:
3
,
reload:
true
)
do
has_element?
(
:merged_status_content
,
text:
'The changes were merged into'
,
wait:
20
)
end
end
# Check if the MR is able to be merged
...
...
@@ -280,7 +283,10 @@ module QA
end
def
try_to_merge!
# Revisit after merge page re-architect is done https://gitlab.com/gitlab-org/gitlab/-/issues/300042
# To remove page refresh logic if possible
wait_until_ready_to_merge
wait_until
{
!
find_element
(
:merge_button
).
has_text?
(
"when pipeline succeeds"
)
}
click_element
(
:merge_button
)
end
...
...
qa/qa/specs/features/ee/browser_ui/4_verify/pipelines_for_merged_results_and_merge_trains_spec.rb
View file @
74bb62c7
# frozen_string_literal: true
require
'
securerandom
'
require
'
faker
'
module
QA
RSpec
.
describe
'Verify'
,
:runner
do
describe
'Pipelines for merged results and merge trains'
do
let
(
:
group
)
{
Resource
::
Group
.
fabricate_via_api!
}
let
(
:
executor
)
{
"qa-runner-
#{
Faker
::
Alphanumeric
.
alphanumeric
(
8
)
}
"
}
let!
(
:runner
)
do
Resource
::
Runner
.
fabricate_via_api!
do
|
runner
|
runner
.
token
=
group
.
reload!
.
runners_token
runner
.
name
=
group
.
name
runner
.
tags
=
[
group
.
name
]
runner
.
project
=
project
runner
.
name
=
executor
runner
.
tags
=
[
executor
]
end
end
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'pipelines-for-merged-results-and-merge-trains'
project
.
group
=
group
project
.
name
=
'pipelines-for-merge-trains'
end
end
before
do
let!
(
:ci_file
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
...
...
@@ -31,29 +29,33 @@ module QA
[
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
EOF
content:
<<~
YAML
test:
tags: [
#{
group
.
name
}
]
tags: [
#{
executor
}
]
script: echo 'OK'
only:
- merge_requests
EOF
YAML
}
]
)
end
end
let
(
:merge_request
)
do
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
description
=
Faker
::
Lorem
.
sentence
merge_request
.
target_new_branch
=
false
merge_request
.
file_name
=
Faker
::
Lorem
.
word
merge_request
.
file_content
=
Faker
::
Lorem
.
sentence
end
end
before
do
Flow
::
Login
.
sign_in
project
.
visit!
Page
::
Project
::
Menu
.
perform
(
&
:go_to_general_settings
)
Page
::
Project
::
Settings
::
Main
.
perform
do
|
main
|
main
.
expand_merge_requests_settings
do
|
settings
|
settings
.
click_pipelines_for_merged_results_checkbox
settings
.
click_merge_trains_checkbox
settings
.
click_save_changes
end
end
Flow
::
MergeRequest
.
enable_merge_trains
end
after
do
...
...
@@ -61,77 +63,28 @@ module QA
end
it
'creates a pipeline with merged results'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/562'
do
branch_name
=
"merged-results-
#{
SecureRandom
.
hex
(
8
)
}
"
# Create a branch that will be merged into the default branch
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
project_push
|
project_push
.
project
=
project
project_push
.
new_branch
=
true
project_push
.
branch_name
=
branch_name
project_push
.
file_name
=
"file-
#{
SecureRandom
.
hex
(
8
)
}
.txt"
end
# Create a merge request to merge the branch we just created
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
source_branch
=
branch_name
merge_request
.
no_preparation
=
true
end
.
visit!
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
pipeline_passed
=
Support
::
Retrier
.
retry_until
(
max_attempts:
5
,
sleep_interval:
5
)
do
show
.
has_pipeline_status?
(
/Merged result pipeline #\d+ passed/
)
end
expect
(
pipeline_passed
).
to
be_truthy
,
"Expected the merged result pipeline to pass."
expect
(
show
).
to
have_pipeline_status
(
'passed'
),
'Expected the merge request pipeline to pass.'
# The default option is to merge via merge train,
# but that is covered by the 'merges via a merge train' test
show
.
skip_merge_train_and_merge_immediately
end
merged
=
Page
::
MergeRequest
::
Show
.
perform
(
&
:merged?
)
expect
(
merged
).
to
be_truthy
,
"Expected content 'The changes were merged' but it did not appear."
expect
(
show
).
to
be_merged
,
"Expected content 'The changes were merged' but it did not appear."
end
end
it
'merges via a merge train'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/561'
do
branch_name
=
"merge-train-
#{
SecureRandom
.
hex
(
8
)
}
"
# Create a branch that will be merged into the default branch
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
project_push
|
project_push
.
project
=
project
project_push
.
new_branch
=
true
project_push
.
branch_name
=
branch_name
project_push
.
file_name
=
"file-
#{
SecureRandom
.
hex
(
8
)
}
.txt"
project_push
.
file_content
=
"merge me"
end
# Create a merge request to merge the branch we just created
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
source_branch
=
branch_name
merge_request
.
no_preparation
=
true
end
.
visit!
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
pipeline_passed
=
show
.
retry_until
(
max_attempts:
5
,
sleep_interval:
5
)
do
show
.
has_pipeline_status?
(
/Merged result pipeline #\d+ passed/
)
end
expect
(
pipeline_passed
).
to
be_truthy
,
"Expected the merged result pipeline to pass."
expect
(
show
).
to
have_pipeline_status
(
'passed'
),
'Expected the merge request pipeline to pass.'
show
.
merge_via_merge_train
# It's faster to refresh the page than to wait for the UI to
# automatically refresh, so we reload if the merge status
# doesn't update quickly.
merged
=
show
.
retry_until
(
max_attempts:
5
,
reload:
true
,
sleep_interval:
5
)
do
show
.
merged?
end
expect
(
merged
).
to
be_truthy
,
"Expected content 'The changes were merged' but it did not appear."
expect
(
show
).
to
have_pipeline_status
(
/Merge train pipeline #\d+ passed/
)
expect
(
show
).
to
be_merged
,
"Expected content 'The changes were merged' but it did not appear."
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