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
b353949b
Commit
b353949b
authored
Jul 28, 2021
by
Tiffany Rea
Committed by
Ramya Authappan
Jul 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor MR page pipeline status check
parent
1d854f3e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
91 deletions
+79
-91
qa/qa/page/merge_request/show.rb
qa/qa/page/merge_request/show.rb
+7
-2
qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb
..._verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb
+1
-1
qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb
...es/browser_ui/4_verify/testing/view_code_coverage_spec.rb
+1
-3
qa/qa/specs/features/ee/browser_ui/4_verify/transient/merge_trains_transient_bug_spec.rb
..._ui/4_verify/transient/merge_trains_transient_bug_spec.rb
+7
-28
qa/qa/specs/features/ee/browser_ui/6_release/multi-project_pipelines_spec.rb
...s/ee/browser_ui/6_release/multi-project_pipelines_spec.rb
+62
-54
qa/qa/specs/features/ee/browser_ui/secure/project_security_dashboard_spec.rb
...s/ee/browser_ui/secure/project_security_dashboard_spec.rb
+1
-3
No files found.
qa/qa/page/merge_request/show.rb
View file @
b353949b
...
...
@@ -202,7 +202,9 @@ module QA
def
has_pipeline_status?
(
text
)
# Pipelines can be slow, so we wait a bit longer than the usual 10 seconds
has_element?
(
:merge_request_pipeline_info_content
,
text:
text
,
wait:
60
)
wait_until
(
sleep_interval:
5
,
reload:
false
)
do
has_element?
(
:merge_request_pipeline_info_content
,
text:
text
,
wait:
15
)
end
end
def
has_title?
(
title
)
...
...
@@ -236,7 +238,10 @@ module QA
end
def
merged?
# Revisit after merge page re-architect is done https://gitlab.com/gitlab-org/gitlab/-/issues/300042
# Reloads the page at this point to avoid the problem of the merge status failing to update
# That's the transient UX issue this test is checking for, so if the MR is merged but the UI still shows the
# status as unmerged, the test will fail.
# Revisit after merge page re-architect is done https://gitlab.com/groups/gitlab-org/-/epics/5598
# 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
)
...
...
qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb
View file @
b353949b
...
...
@@ -73,7 +73,7 @@ module QA
it
'can still merge MR successfully'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/971'
do
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
# waiting for manual action status shows status badge 'blocked' on pipelines page
show
.
wait_until
(
reload:
false
)
{
show
.
has_pipeline_status?
(
'waiting for manual action'
)
}
show
.
has_pipeline_status?
(
'waiting for manual action'
)
show
.
merge!
expect
(
show
).
to
be_merged
...
...
qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb
View file @
b353949b
...
...
@@ -39,9 +39,7 @@ module QA
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
mr_widget
|
Support
::
Retrier
.
retry_until
(
max_attempts:
5
,
sleep_interval:
5
)
do
mr_widget
.
has_pipeline_status?
(
'passed'
)
end
mr_widget
.
has_pipeline_status?
(
'passed'
)
expect
(
mr_widget
).
to
have_content
(
'Test coverage 66.67%'
)
end
end
...
...
qa/qa/specs/features/ee/browser_ui/4_verify/transient/merge_trains_transient_bug_spec.rb
View file @
b353949b
...
...
@@ -75,22 +75,17 @@ module QA
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
check_pipeline_status
(
show
)
# Wait for MR first pipeline to pass first before starting merge trains
show
.
has_pipeline_status?
(
'passed'
)
show
.
merge_via_merge_train
check_merge_train_starts
(
show
)
# This is also tested in pipelines_for_merged_results_and_merge_trains_spec.rb as a regular e2e test.
# That test reloads the page at this point to avoid the problem of the merge status failing to update
# That's the transient UX issue this test is checking for, so if the MR is merged but the UI still shows the
# status as unmerged, the test will fail.
merge_request
=
project
.
merge_request_with_title
(
title
)
expect
(
merge_request
).
not_to
be_nil
,
'There was a problem fetching the merge request'
show
.
wait_until
(
sleep_interval:
5
,
reload:
false
)
do
show
.
has_content?
(
'started a merge train'
)
end
# Merge train should start another pipeline and MR won't merged until this is finished
check_pipeline_status
(
show
)
show
.
has_pipeline_status?
(
'passed'
)
# We use the API to wait until the MR has been merged so that we know the UI should be ready to update
show
.
wait_until
(
reload:
false
)
do
...
...
@@ -108,26 +103,10 @@ module QA
SecureRandom
.
hex
(
8
)
end
def
check_pipeline_status
(
page_object
)
pipeline_passed
=
page_object
.
retry_until
(
max_attempts:
5
,
sleep_interval:
5
)
do
page_object
.
has_pipeline_status?
(
'passed'
)
end
expect
(
pipeline_passed
).
to
be_truthy
,
'Expected the merged result pipeline to pass.'
end
def
check_merge_train_starts
(
page_object
)
train_started
=
page_object
.
wait_until
(
reload:
false
)
do
page_object
.
has_content?
'started a merge train'
end
expect
(
train_started
).
to
be_truthy
,
'Expected to have system note indicating merge train has started.'
end
def
merge_request_state
(
merge_request
)
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
mr
|
mr
.
project
=
project
mr
.
iid
=
merge_request
[
:iid
]
mr
.
iid
=
merge_request
.
iid
end
.
state
end
end
...
...
qa/qa/specs/features/ee/browser_ui/6_release/multi-project_pipelines_spec.rb
View file @
b353949b
...
...
@@ -5,92 +5,100 @@ require 'securerandom'
module
QA
RSpec
.
describe
'Release'
do
describe
'Multi-project pipelines'
do
let
(
:upstream_project_name
)
{
"upstream-project-
#{
SecureRandom
.
hex
(
8
)
}
"
}
let
(
:downstream_project_name
)
{
"downstream-project-
#{
SecureRandom
.
hex
(
8
)
}
"
}
let
(
:downstream_job_name
)
{
'downstream_job'
}
let
(
:executor
)
{
"qa-runner-
#{
SecureRandom
.
hex
(
4
)
}
"
}
let!
(
:group
)
{
Resource
::
Group
.
fabricate_via_api!
}
let
(
:upstream_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
upstream_project_name
project
.
group
=
group
project
.
name
=
'upstream-project'
end
end
let
(
:downstream_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
downstream_project_name
project
.
group
=
group
project
.
name
=
'downstream-project'
end
end
let!
(
:runner
)
do
Resource
::
Runner
.
fabricate_via_api!
do
|
runner
|
runner
.
project
=
upstream_project
runner
.
token
=
upstream_project
.
group
.
sandbox
.
runners_token
runner
.
name
=
upstream_project_name
runner
.
tags
=
[
upstream_project_name
]
runner
.
token
=
group
.
sandbox
.
runners_token
runner
.
name
=
executor
runner
.
tags
=
[
executor
]
end
end
before
do
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
project_push
|
project_push
.
project
=
upstream_project
project_push
.
file_name
=
'.gitlab-ci.yml'
project_push
.
commit_message
=
'Add .gitlab-ci.yml'
project_push
.
file_content
=
<<~
CI
stages:
- test
- deploy
job1:
stage: test
tags: ["
#{
upstream_project_name
}
"]
script: echo "done"
staging:
stage: deploy
trigger:
project:
#{
downstream_project
.
path_with_namespace
}
strategy: depend
CI
end
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
project_push
|
project_push
.
project
=
downstream_project
project_push
.
file_name
=
'.gitlab-ci.yml'
project_push
.
commit_message
=
'Add .gitlab-ci.yml'
project_push
.
file_content
=
<<~
CI
downstream_job:
stage: test
tags: ["
#{
upstream_project_name
}
"]
script: echo "done"
CI
end
add_ci_file
(
downstream_project
,
downstream_ci_file
)
add_ci_file
(
upstream_project
,
upstream_ci_file
)
Flow
::
Login
.
sign_in
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
project
=
upstream_project
merge_request
.
target_new_branch
=
false
end
.
visit!
upstream_project
.
visit!
Flow
::
Pipeline
.
visit_latest_pipeline
(
pipeline_condition:
'succeeded'
)
end
after
do
runner
.
remove_via_api!
[
upstream_project
,
downstream_project
].
each
(
&
:remove_via_api!
)
end
it
'creates a multi-project pipeline'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/560'
do
Page
::
MergeRequest
::
Show
.
perform
do
|
show
|
expect
(
show
.
has_pipeline_status?
(
'passed'
)).
to
be_truthy
show
.
click_pipeline_link
end
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
show
|
expect
(
show
).
to
have_passed
expect
(
show
).
not_to
have_job
(
"downstream_job"
)
expect
(
show
).
not_to
have_job
(
downstream_job_name
)
show
.
expand_child_pipeline
expect
(
show
).
to
have_job
(
"downstream_job"
)
expect
(
show
).
to
have_job
(
downstream_job_name
)
end
end
private
def
add_ci_file
(
project
,
file
)
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
commit_message
=
'Add CI config file'
commit
.
add_files
([
file
])
end
end
def
upstream_ci_file
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
stages:
- test
- deploy
job1:
stage: test
tags: ["
#{
executor
}
"]
script: echo 'done'
staging:
stage: deploy
trigger:
project:
#{
downstream_project
.
path_with_namespace
}
strategy: depend
YAML
}
end
def
downstream_ci_file
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
"
#{
downstream_job_name
}
":
stage: test
tags: ["
#{
executor
}
"]
script: echo 'done'
YAML
}
end
end
end
end
qa/qa/specs/features/ee/browser_ui/secure/project_security_dashboard_spec.rb
View file @
b353949b
...
...
@@ -47,9 +47,7 @@ module QA
@merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request
|
# Give time for the runner on Staging to complete pipeline
Support
::
Retrier
.
retry_until
(
max_attempts:
5
,
sleep_interval:
5
)
do
merge_request
.
has_pipeline_status?
(
'passed'
)
end
merge_request
.
has_pipeline_status?
(
'passed'
)
merge_request
.
merge!
end
Flow
::
Pipeline
.
wait_for_latest_pipeline
(
pipeline_condition:
'succeeded'
)
...
...
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