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
7e0ac377
Commit
7e0ac377
authored
May 06, 2020
by
Maxime Orefice
Committed by
Heinrich Lee Yu
May 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add accessibility report for a build
parent
4400a604
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
0 deletions
+69
-0
app/models/ci/build.rb
app/models/ci/build.rb
+8
-0
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+6
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+55
-0
No files found.
app/models/ci/build.rb
View file @
7e0ac377
...
...
@@ -869,6 +869,14 @@ module Ci
end
end
def
collect_accessibility_reports!
(
accessibility_report
)
each_report
(
Ci
::
JobArtifact
::
ACCESSIBILITY_REPORT_FILE_TYPES
)
do
|
file_type
,
blob
|
Gitlab
::
Ci
::
Parsers
.
fabricate!
(
file_type
).
parse!
(
blob
,
accessibility_report
)
end
accessibility_report
end
def
collect_coverage_reports!
(
coverage_report
)
each_report
(
Ci
::
JobArtifact
::
COVERAGE_REPORT_FILE_TYPES
)
do
|
file_type
,
blob
|
Gitlab
::
Ci
::
Parsers
.
fabricate!
(
file_type
).
parse!
(
blob
,
coverage_report
)
...
...
spec/factories/ci/builds.rb
View file @
7e0ac377
...
...
@@ -320,6 +320,12 @@ FactoryBot.define do
end
end
trait
:accessibility_reports
do
after
(
:build
)
do
|
build
|
build
.
job_artifacts
<<
create
(
:ci_job_artifact
,
:accessibility
,
job:
build
)
end
end
trait
:coverage_reports
do
after
(
:build
)
do
|
build
|
build
.
job_artifacts
<<
create
(
:ci_job_artifact
,
:cobertura
,
job:
build
)
...
...
spec/models/ci/build_spec.rb
View file @
7e0ac377
...
...
@@ -3834,6 +3834,61 @@ describe Ci::Build do
end
end
describe
'#collect_accessibility_reports!'
do
subject
{
build
.
collect_accessibility_reports!
(
accessibility_report
)
}
let
(
:accessibility_report
)
{
Gitlab
::
Ci
::
Reports
::
AccessibilityReports
.
new
}
it
{
expect
(
accessibility_report
.
urls
).
to
eq
({})
}
context
'when build has an accessibility report'
do
context
'when there is an accessibility report with errors'
do
before
do
create
(
:ci_job_artifact
,
:accessibility
,
job:
build
,
project:
build
.
project
)
end
it
'parses blobs and add the results to the accessibility report'
do
expect
{
subject
}.
not_to
raise_error
expect
(
accessibility_report
.
urls
.
keys
).
to
match_array
([
'https://about.gitlab.com/'
])
expect
(
accessibility_report
.
errors_count
).
to
eq
(
10
)
expect
(
accessibility_report
.
scans_count
).
to
eq
(
1
)
expect
(
accessibility_report
.
passes_count
).
to
eq
(
0
)
end
end
context
'when there is an accessibility report without errors'
do
before
do
create
(
:ci_job_artifact
,
:accessibility_without_errors
,
job:
build
,
project:
build
.
project
)
end
it
'parses blobs and add the results to the accessibility report'
do
expect
{
subject
}.
not_to
raise_error
expect
(
accessibility_report
.
urls
.
keys
).
to
match_array
([
'https://pa11y.org/'
])
expect
(
accessibility_report
.
errors_count
).
to
eq
(
0
)
expect
(
accessibility_report
.
scans_count
).
to
eq
(
1
)
expect
(
accessibility_report
.
passes_count
).
to
eq
(
1
)
end
end
context
'when there is an accessibility report with an invalid url'
do
before
do
create
(
:ci_job_artifact
,
:accessibility_with_invalid_url
,
job:
build
,
project:
build
.
project
)
end
it
'parses blobs and add the results to the accessibility report'
do
expect
{
subject
}.
not_to
raise_error
expect
(
accessibility_report
.
urls
).
to
be_empty
expect
(
accessibility_report
.
errors_count
).
to
eq
(
0
)
expect
(
accessibility_report
.
scans_count
).
to
eq
(
0
)
expect
(
accessibility_report
.
passes_count
).
to
eq
(
0
)
end
end
end
end
describe
'#collect_coverage_reports!'
do
subject
{
build
.
collect_coverage_reports!
(
coverage_report
)
}
...
...
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