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
080d39fa
Commit
080d39fa
authored
Feb 17, 2022
by
Alexander Turinske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add snapshot testing
- to verify visual changes
parent
cc88dc11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
5 deletions
+106
-5
ee/spec/frontend/threat_monitoring/components/policy_drawer/__snapshots__/policy_drawer_layout_spec.js.snap
...cy_drawer/__snapshots__/policy_drawer_layout_spec.js.snap
+102
-0
ee/spec/frontend/threat_monitoring/components/policy_drawer/policy_drawer_layout_spec.js
...ing/components/policy_drawer/policy_drawer_layout_spec.js
+4
-5
No files found.
ee/spec/frontend/threat_monitoring/components/policy_drawer/__snapshots__/policy_drawer_layout_spec.js.snap
0 → 100644
View file @
080d39fa
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PolicyDrawerLayout component enabled policy matches the snapshots 1`] = `
<div>
<div
data-testid="policy-summary"
>
<span
data-testid="summary-text"
>
Summary
</span>
</div>
<policy-info-row-stub
data-testid="policy-type"
label="Policy Type"
>
Scan Execution
</policy-info-row-stub>
<policy-info-row-stub
label="Description"
>
<div
data-testid="custom-description-text"
>
This policy enforces pipeline configuration to have a job with DAST scan
</div>
</policy-info-row-stub>
<policy-info-row-stub
label="Status"
>
<div
class="gl-text-green-500"
data-testid="enabled-status-text"
>
<gl-icon-stub
class="gl-mr-3"
name="check-circle-filled"
size="16"
/>
Enabled
</div>
</policy-info-row-stub>
</div>
`;
exports[`PolicyDrawerLayout component not enabled policy matches the snapshots 1`] = `
<div>
<div
data-testid="policy-summary"
>
<span
data-testid="summary-text"
>
Summary
</span>
</div>
<policy-info-row-stub
data-testid="policy-type"
label="Policy Type"
>
Scan Execution
</policy-info-row-stub>
<policy-info-row-stub
label="Description"
>
<div
class="gl-text-gray-500"
data-testid="default-description-text"
>
No description
</div>
</policy-info-row-stub>
<policy-info-row-stub
label="Status"
>
<div
class="gl-text-gray-500"
data-testid="not-enabled-status-text"
>
Not enabled
</div>
</policy-info-row-stub>
</div>
`;
ee/spec/frontend/threat_monitoring/components/policy_drawer/policy_drawer_layout_spec.js
View file @
080d39fa
...
...
@@ -11,15 +11,12 @@ describe('PolicyDrawerLayout component', () => {
let
wrapper
;
const
DESCRIPTION
=
'
This policy enforces pipeline configuration to have a job with DAST scan
'
;
const
SUMMARY
=
'
Summary
'
;
const
TYPE
=
'
Scan Execution
'
;
const
findCustomDescription
=
()
=>
wrapper
.
findByTestId
(
'
custom-description-text
'
);
const
findDefaultDescription
=
()
=>
wrapper
.
findByTestId
(
'
default-description-text
'
);
const
findEnabledText
=
()
=>
wrapper
.
findByTestId
(
'
enabled-status-text
'
);
const
findNotEnabledText
=
()
=>
wrapper
.
findByTestId
(
'
not-enabled-status-text
'
);
const
findSummaryText
=
()
=>
wrapper
.
findByTestId
(
'
summary-text
'
);
const
findTypeText
=
()
=>
wrapper
.
findByTestId
(
'
policy-type
'
);
const
componentStatusText
=
(
status
)
=>
(
status
?
'
does
'
:
'
does not
'
);
...
...
@@ -50,8 +47,6 @@ describe('PolicyDrawerLayout component', () => {
it
.
each
`
component | status | finder | exists | text
${
'
type text
'
}
|
${
'
does
'
}
|
${
findTypeText
}
|
${
true
}
|
${
TYPE
}
${
'
summary text
'
}
|
${
'
does
'
}
|
${
findSummaryText
}
|
${
true
}
|
${
SUMMARY
}
${
'
custom description
'
}
|
${
componentStatusText
(
hasDescription
)}
|
${
findCustomDescription
}
|
${
hasDescription
}
|
${
DESCRIPTION
}
${
'
default description
'
}
|
${
componentStatusText
(
!
hasDescription
)}
|
${
findDefaultDescription
}
|
${
!
hasDescription
}
|
${
DEFAULT_DESCRIPTION_LABEL
}
${
'
enabled text
'
}
|
${
componentStatusText
(
enabled
)}
|
${
findEnabledText
}
|
${
enabled
}
|
${
ENABLED_LABEL
}
...
...
@@ -63,5 +58,9 @@ describe('PolicyDrawerLayout component', () => {
expect
(
component
.
text
()).
toBe
(
text
);
}
});
it
(
'
matches the snapshots
'
,
()
=>
{
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
});
});
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