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
4d7fbe95
Commit
4d7fbe95
authored
Apr 03, 2020
by
mfluharty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs to check codequality report links
parent
b2213d1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
ee/spec/features/projects/pipelines/pipeline_spec.rb
ee/spec/features/projects/pipelines/pipeline_spec.rb
+61
-0
ee/spec/frontend/codequality_report/codequality_report_spec.js
...ec/frontend/codequality_report/codequality_report_spec.js
+9
-0
No files found.
ee/spec/features/projects/pipelines/pipeline_spec.rb
View file @
4d7fbe95
...
...
@@ -165,6 +165,67 @@ describe 'Pipeline', :js do
end
end
describe
'GET /:project/pipelines/:id/codequality_report'
do
shared_examples_for
'full codequality report'
do
context
'with no code quality artifact'
do
before
do
create
(
:ee_ci_build
,
pipeline:
pipeline
)
visit
project_pipeline_path
(
project
,
pipeline
)
end
it
'does not show code quality tab'
do
expect
(
page
).
not_to
have_content
(
'Code Quality'
)
expect
(
page
).
not_to
have_css
(
'#js-tab-codequality'
)
end
end
context
'with code quality artifact'
do
before
do
create
(
:ee_ci_build
,
:codequality
,
pipeline:
pipeline
)
visit
codequality_report_namespace_project_pipeline_path
(
project
.
namespace
,
project
,
pipeline
)
end
it
'shows code quality tab pane as active'
do
expect
(
page
).
to
have_content
(
'Code Quality'
)
expect
(
page
).
to
have_css
(
'#js-tab-codequality'
)
end
it
'shows code quality report section'
do
expect
(
page
).
to
have_content
(
'Loading codeclimate report'
)
end
it
'shows code quality issue with link to file'
do
wait_for_requests
expect
(
page
).
to
have_content
(
'Function `simulateEvent` has 28 lines of code (exceeds 25 allowed). Consider refactoring.'
)
expect
(
find_link
(
'app/assets/javascripts/test_utils/simulate_drag.js:1'
)[
:href
]).
to
end_with
(
project_blob_path
(
project
,
File
.
join
(
pipeline
.
commit
.
id
,
'app/assets/javascripts/test_utils/simulate_drag.js'
))
+
'#L1'
)
end
end
end
context
'for a branch pipeline'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
ref:
'master'
,
sha:
project
.
commit
.
id
)
}
it_behaves_like
'full codequality report'
end
context
'for a merge request pipeline'
do
let
(
:merge_request
)
do
create
(
:merge_request
,
:with_merge_request_pipeline
,
source_project:
project
,
target_project:
project
,
merge_sha:
project
.
commit
.
id
)
end
let
(
:pipeline
)
do
merge_request
.
all_pipelines
.
last
end
it_behaves_like
'full codequality report'
end
end
private
def
create_link
(
source_pipeline
,
pipeline
)
...
...
ee/spec/frontend/codequality_report/codequality_report_spec.js
View file @
4d7fbe95
...
...
@@ -71,6 +71,15 @@ describe('Codequality report app', () => {
expect
(
findStatus
().
text
()).
toBe
(
`Found
${
expectedIssueTotal
}
code quality issues`
);
expect
(
wrapper
.
findAll
(
'
.report-block-list-issue
'
).
length
).
toBe
(
expectedIssueTotal
);
});
it
(
'
renders a link to the line where the issue was found
'
,
()
=>
{
const
issueLink
=
wrapper
.
find
(
'
.report-block-list-issue a
'
);
expect
(
issueLink
.
text
()).
toBe
(
'
ee/spec/features/admin/geo/admin_geo_projects_spec.rb:152
'
);
expect
(
issueLink
.
attributes
(
'
href
'
)).
toBe
(
'
/root/test-codequality/blob/feature-branch/ee/spec/features/admin/geo/admin_geo_projects_spec.rb#L152
'
,
);
});
});
describe
(
'
when there are no codequality issues
'
,
()
=>
{
...
...
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