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
128aaba1
Commit
128aaba1
authored
Mar 22, 2021
by
Dheeraj Joshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature specs for DAST Scanner Profile
This adds feature specs to cover related to DAST Scanner Profile Form
parent
2d6d8702
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
0 deletions
+133
-0
ee/app/assets/javascripts/security_configuration/dast_scanner_profiles/components/dast_scanner_profile_form.vue
...scanner_profiles/components/dast_scanner_profile_form.vue
+3
-0
ee/spec/features/projects/security/dast_scanner_profiles_spec.rb
.../features/projects/security/dast_scanner_profiles_spec.rb
+59
-0
ee/spec/frontend_integration/dast_profiles/dast_scanner_profile_init_integration_spec.js
...st_profiles/dast_scanner_profile_init_integration_spec.js
+71
-0
No files found.
ee/app/assets/javascripts/security_configuration/dast_scanner_profiles/components/dast_scanner_profile_form.vue
View file @
128aaba1
...
...
@@ -278,6 +278,7 @@ export default {
<gl-form-group
:label=
"s__('DastProfiles|Profile name')"
>
<gl-form-input
v-model=
"form.profileName.value"
name=
"profile_name"
class=
"mw-460"
data-testid=
"profile-name-input"
type=
"text"
...
...
@@ -311,6 +312,7 @@ export default {
</
template
>
<gl-form-input-group
v-model.number=
"form.spiderTimeout.value"
name=
"spider_timeout"
class=
"mw-460"
data-testid=
"spider-timeout-input"
type=
"number"
...
...
@@ -338,6 +340,7 @@ export default {
</
template
>
<gl-form-input-group
v-model.number=
"form.targetTimeout.value"
name=
"target_timeout"
class=
"mw-460"
data-testid=
"target-timeout-input"
type=
"number"
...
...
ee/spec/features/projects/security/dast_scanner_profiles_spec.rb
0 → 100644
View file @
128aaba1
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'User sees Scanner profile'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:profile_form_path
)
{
new_project_security_configuration_dast_scans_dast_scanner_profile_path
(
project
)}
let
(
:profile_library_path
)
{
project_security_configuration_dast_scans_path
(
project
)
}
before_all
do
project
.
add_developer
(
user
)
end
before
do
sign_in
(
user
)
end
context
'when feature is available'
do
before
do
stub_licensed_features
(
security_on_demand_scans:
true
)
visit
(
profile_form_path
)
end
it
'shows the form'
do
expect
(
page
).
to
have_gitlab_http_status
(
:ok
)
expect
(
page
).
to
have_content
(
"New scanner profile"
)
end
it
'on submit'
,
:js
do
fill_in_profile_form
expect
(
current_path
).
to
eq
(
profile_library_path
)
end
it
'on cancel'
,
:js
do
click_button
'Cancel'
expect
(
current_path
).
to
eq
(
profile_library_path
)
end
end
context
'when feature is not available'
do
before
do
visit
(
profile_form_path
)
end
it
'renders a 404'
do
expect
(
page
).
to
have_gitlab_http_status
(
:not_found
)
end
end
def
fill_in_profile_form
fill_in
'profile_name'
,
with:
"hello"
fill_in
'spider_timeout'
,
with:
"1"
fill_in
'target_timeout'
,
with:
"2"
click_button
'Save profile'
wait_for_requests
end
end
ee/spec/frontend_integration/dast_profiles/dast_scanner_profile_init_integration_spec.js
0 → 100644
View file @
128aaba1
import
{
screen
,
within
}
from
'
@testing-library/dom
'
;
import
initBundler
from
'
ee/security_configuration/dast_scanner_profiles/dast_scanner_profiles_bundle
'
;
import
{
waitForText
}
from
'
helpers/wait_for_text
'
;
import
{
mockIssueLink
}
from
'
../test_helpers/mock_data/vulnerabilities_mock_data
'
;
// import { mockVulnerability } from './mock_data';
describe
(
'
Scanner Profile
'
,
()
=>
{
let
vm
;
let
container
;
const
createComponent
=
()
=>
{
setFixtures
(
'
<div class="js-dast-scanner-profile-form"></div>
'
);
const
el
=
document
.
querySelector
(
'
.js-dast-scanner-profile-form
'
);
const
elDataSet
=
{
profilesLibraryPath
:
'
group/project
'
,
projectFullPath
:
'
/security/configuration/a
'
,
onDemandScansPath
:
'
/security/configuration/b
'
,
};
Object
.
assign
(
el
.
dataset
,
{
...
elDataSet
,
});
container
.
appendChild
(
el
);
return
initBundler
(
el
);
};
beforeEach
(()
=>
{
vm
=
createComponent
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
vm
=
null
;
container
=
null
;
});
it
(
"
displays the vulnerability's status
"
,
()
=>
{
const
headerBody
=
screen
.
getByTestId
(
'
vulnerability-detail-body
'
);
expect
(
within
(
headerBody
).
getByText
(
mockVulnerability
.
state
)).
toBeInstanceOf
(
HTMLElement
);
});
it
(
"
displays the vulnerability's severity
"
,
()
=>
{
const
severitySection
=
screen
.
getByTestId
(
'
severity
'
);
const
severityValue
=
within
(
severitySection
).
getByTestId
(
'
value
'
);
expect
(
severityValue
.
textContent
.
toLowerCase
()).
toContain
(
mockVulnerability
.
severity
.
toLowerCase
(),
);
});
it
(
"
displays a heading containing the vulnerability's title
"
,
()
=>
{
expect
(
screen
.
getByRole
(
'
heading
'
,
{
name
:
mockVulnerability
.
title
})).
toBeInstanceOf
(
HTMLElement
,
);
});
it
(
"
displays the vulnerability's description
"
,
()
=>
{
expect
(
screen
.
getByText
(
mockVulnerability
.
description
)).
toBeInstanceOf
(
HTMLElement
);
});
it
(
'
displays related issues
'
,
async
()
=>
{
const
relatedIssueTitle
=
await
waitForText
(
mockIssueLink
.
title
);
expect
(
relatedIssueTitle
).
toBeInstanceOf
(
HTMLElement
);
});
});
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