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
dd2854c6
Commit
dd2854c6
authored
Apr 21, 2020
by
Maxime Orefice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add accessibility report for a pipeline
parent
3df9df27
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
0 deletions
+62
-0
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+8
-0
spec/factories/ci/pipelines.rb
spec/factories/ci/pipelines.rb
+8
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+46
-0
No files found.
app/models/ci/pipeline.rb
View file @
dd2854c6
...
...
@@ -811,6 +811,14 @@ module Ci
end
end
def
accessibility_reports
Gitlab
::
Ci
::
Reports
::
AccessibilityReports
.
new
.
tap
do
|
accessibility_reports
|
builds
.
latest
.
with_reports
(
Ci
::
JobArtifact
.
accessibility_reports
).
each
do
|
build
|
build
.
collect_accessibility_reports!
(
accessibility_reports
)
end
end
end
def
coverage_reports
Gitlab
::
Ci
::
Reports
::
CoverageReports
.
new
.
tap
do
|
coverage_reports
|
builds
.
latest
.
with_reports
(
Ci
::
JobArtifact
.
coverage_reports
).
each
do
|
build
|
...
...
spec/factories/ci/pipelines.rb
View file @
dd2854c6
...
...
@@ -83,6 +83,14 @@ FactoryBot.define do
end
end
trait
:with_accessibility_reports
do
status
{
:success
}
after
(
:build
)
do
|
pipeline
,
evaluator
|
pipeline
.
builds
<<
build
(
:ci_build
,
:accessibility_reports
,
pipeline:
pipeline
,
project:
pipeline
.
project
)
end
end
trait
:with_coverage_reports
do
status
{
:success
}
...
...
spec/models/ci/pipeline_spec.rb
View file @
dd2854c6
...
...
@@ -364,6 +364,16 @@ describe Ci::Pipeline, :mailer do
end
end
context
'when pipeline has an accessibility report'
do
subject
{
described_class
.
with_reports
(
Ci
::
JobArtifact
.
accessibility_reports
)
}
let
(
:pipeline_with_report
)
{
create
(
:ci_pipeline
,
:with_accessibility_reports
)
}
it
'selects the pipeline'
do
is_expected
.
to
eq
([
pipeline_with_report
])
end
end
context
'when pipeline has a terraform report'
do
it
'selects the pipeline'
do
pipeline_with_report
=
create
(
:ci_pipeline
,
:with_terraform_reports
)
...
...
@@ -2799,6 +2809,42 @@ describe Ci::Pipeline, :mailer do
end
end
describe
'#accessibility_reports'
do
subject
{
pipeline
.
accessibility_reports
}
context
'when pipeline has multiple builds with accessibility reports'
do
let
(
:build_rspec
)
{
create
(
:ci_build
,
:success
,
name:
'rspec'
,
pipeline:
pipeline
,
project:
project
)
}
let
(
:build_golang
)
{
create
(
:ci_build
,
:success
,
name:
'golang'
,
pipeline:
pipeline
,
project:
project
)
}
before
do
create
(
:ci_job_artifact
,
:accessibility
,
job:
build_rspec
,
project:
project
)
create
(
:ci_job_artifact
,
:accessibility_without_errors
,
job:
build_golang
,
project:
project
)
end
it
'returns accessibility report with collected data'
do
expect
(
subject
.
urls
.
keys
).
to
match_array
([
"https://pa11y.org/"
,
"https://about.gitlab.com/"
])
end
context
'when builds are retried'
do
let
(
:build_rspec
)
{
create
(
:ci_build
,
:retried
,
:success
,
name:
'rspec'
,
pipeline:
pipeline
,
project:
project
)
}
let
(
:build_golang
)
{
create
(
:ci_build
,
:retried
,
:success
,
name:
'golang'
,
pipeline:
pipeline
,
project:
project
)
}
it
'returns empty urls for accessibility reports'
do
expect
(
subject
.
urls
).
to
be_empty
end
end
end
context
'when pipeline does not have any builds with accessibility reports'
do
it
'returns empty urls for accessibility reports'
do
expect
(
subject
.
urls
).
to
be_empty
end
end
end
describe
'#coverage_reports'
do
subject
{
pipeline
.
coverage_reports
}
...
...
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