Browse Source

SONAR-14513 Add e2e tests for security hotspots

tags/8.8.0.42792
Philippe Perrin 3 years ago
parent
commit
26ca7559fa

+ 1
- 1
server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx View File

@@ -144,7 +144,7 @@ export function FilterBar(props: FilterBarProps) {
<DeferredSpinner loading={loadingMeasure}>
{hotspotsReviewedMeasure && <CoverageRating value={hotspotsReviewedMeasure} />}
<Measure
className="spacer-left huge"
className="spacer-left huge it__hs-review-percentage"
metricKey={
onBranch && !filters.sinceLeakPeriod
? 'security_hotspots_reviewed'

+ 2
- 2
server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistory.tsx View File

@@ -111,7 +111,7 @@ export default function HotspotReviewHistory(props: HotspotReviewHistoryProps) {
</DropdownOverlay>
}>
<EditButton
className="it__hotspots-comment-edit button-small"
className="button-small"
onClick={() => setEditedCommentKey(key)}
/>
</Toggler>
@@ -129,7 +129,7 @@ export default function HotspotReviewHistory(props: HotspotReviewHistoryProps) {
</div>
}
overlayPlacement={PopupPlacement.BottomRight}>
<DeleteButton className="it__hotspots-comment-delete button-small" />
<DeleteButton className="button-small" />
</Dropdown>
</div>
)}

+ 2
- 2
server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistoryAndComments.tsx View File

@@ -96,7 +96,7 @@ export default class HotspotReviewHistoryAndComments extends React.PureComponent
return (
<>
<h1>{translate('hotspot.section.activity')}</h1>
<div className="padded">
<div className="padded it__hs-review-history">
<HotspotReviewHistory
hotspot={hotspot}
onDeleteComment={this.handleDeleteComment}
@@ -108,7 +108,7 @@ export default class HotspotReviewHistoryAndComments extends React.PureComponent
<hr />
<div className="big-spacer-top">
<Button
className={classNames({ invisible: commentVisible })}
className={classNames('it__hs-add-comment', { invisible: commentVisible })}
id="hotspot-comment-box-display"
onClick={this.props.onOpenComment}>
{translate('hotspots.comment.open')}

+ 2
- 2
server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx View File

@@ -83,7 +83,7 @@ export function HotspotViewerRenderer(props: HotspotViewerRendererProps) {
{isLoggedIn(currentUser) && (
<>
<div className="dropdown spacer-right flex-1-0-auto">
<Button onClick={props.onOpenComment}>
<Button className="it__hs-add-comment" onClick={props.onOpenComment}>
{translate('hotspots.comment.open')}
</Button>
</div>
@@ -120,7 +120,7 @@ export function HotspotViewerRenderer(props: HotspotViewerRendererProps) {
{translate('risk_exposure', hotspot.rule.vulnerabilityProbability)}
</div>
</div>
<div className="display-flex-center">
<div className="display-flex-center it__hs-assignee">
<span className="big-spacer-right">{translate('assignee')}</span>
<div>
<Assignee hotspot={hotspot} onAssigneeChange={props.onUpdateHotspot} />

+ 4
- 4
server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/FilterBar-test.tsx.snap View File

@@ -108,7 +108,7 @@ exports[`should render correctly: anonymous 1`] = `
loading={false}
>
<Measure
className="spacer-left huge"
className="spacer-left huge it__hs-review-percentage"
metricKey="security_hotspots_reviewed"
metricType="PERCENT"
/>
@@ -224,7 +224,7 @@ exports[`should render correctly: logged-in 1`] = `
loading={false}
>
<Measure
className="spacer-left huge"
className="spacer-left huge it__hs-review-percentage"
metricKey="security_hotspots_reviewed"
metricType="PERCENT"
/>
@@ -396,7 +396,7 @@ exports[`should render correctly: on Pull request 1`] = `
loading={false}
>
<Measure
className="spacer-left huge"
className="spacer-left huge it__hs-review-percentage"
metricKey="new_security_hotspots_reviewed"
metricType="PERCENT"
/>
@@ -496,7 +496,7 @@ exports[`should render correctly: with hotspots reviewed measure 1`] = `
value="23.30"
/>
<Measure
className="spacer-left huge"
className="spacer-left huge it__hs-review-percentage"
metricKey="security_hotspots_reviewed"
metricType="PERCENT"
value="23.30"

+ 2
- 2
server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotReviewHistory-test.tsx.snap View File

@@ -92,7 +92,7 @@ exports[`should render correctly 1`] = `
}
>
<EditButton
className="it__hotspots-comment-edit button-small"
className="button-small"
onClick={[Function]}
/>
</Toggler>
@@ -117,7 +117,7 @@ exports[`should render correctly 1`] = `
overlayPlacement="bottom-right"
>
<DeleteButton
className="it__hotspots-comment-delete button-small"
className="button-small"
/>
</Dropdown>
</div>

+ 3
- 3
server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotReviewHistoryAndComments-test.tsx.snap View File

@@ -6,7 +6,7 @@ exports[`should render correctly 1`] = `
hotspot.section.activity
</h1>
<div
className="padded"
className="padded it__hs-review-history"
>
<HotspotReviewHistory
hotspot={
@@ -114,7 +114,7 @@ exports[`should render correctly 1`] = `
className="big-spacer-top"
>
<Button
className=""
className="it__hs-add-comment"
id="hotspot-comment-box-display"
onClick={[MockFunction]}
>
@@ -169,7 +169,7 @@ exports[`should render correctly without user 1`] = `
hotspot.section.activity
</h1>
<div
className="padded"
className="padded it__hs-review-history"
>
<HotspotReviewHistory
hotspot={

+ 10
- 5
server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotViewerRenderer-test.tsx.snap View File

@@ -23,6 +23,7 @@ exports[`should render correctly 1`] = `
className="dropdown spacer-right flex-1-0-auto"
>
<Button
className="it__hs-add-comment"
onClick={[MockFunction]}
>
hotspots.comment.open
@@ -84,7 +85,7 @@ exports[`should render correctly 1`] = `
</div>
</div>
<div
className="display-flex-center"
className="display-flex-center it__hs-assignee"
>
<span
className="big-spacer-right"
@@ -668,6 +669,7 @@ exports[`should render correctly: anonymous user 1`] = `
className="dropdown spacer-right flex-1-0-auto"
>
<Button
className="it__hs-add-comment"
onClick={[MockFunction]}
>
hotspots.comment.open
@@ -729,7 +731,7 @@ exports[`should render correctly: anonymous user 1`] = `
</div>
</div>
<div
className="display-flex-center"
className="display-flex-center it__hs-assignee"
>
<span
className="big-spacer-right"
@@ -1313,6 +1315,7 @@ exports[`should render correctly: assignee without name 1`] = `
className="dropdown spacer-right flex-1-0-auto"
>
<Button
className="it__hs-add-comment"
onClick={[MockFunction]}
>
hotspots.comment.open
@@ -1374,7 +1377,7 @@ exports[`should render correctly: assignee without name 1`] = `
</div>
</div>
<div
className="display-flex-center"
className="display-flex-center it__hs-assignee"
>
<span
className="big-spacer-right"
@@ -1958,6 +1961,7 @@ exports[`should render correctly: deleted assignee 1`] = `
className="dropdown spacer-right flex-1-0-auto"
>
<Button
className="it__hs-add-comment"
onClick={[MockFunction]}
>
hotspots.comment.open
@@ -2019,7 +2023,7 @@ exports[`should render correctly: deleted assignee 1`] = `
</div>
</div>
<div
className="display-flex-center"
className="display-flex-center it__hs-assignee"
>
<span
className="big-spacer-right"
@@ -2610,6 +2614,7 @@ exports[`should render correctly: unassigned 1`] = `
className="dropdown spacer-right flex-1-0-auto"
>
<Button
className="it__hs-add-comment"
onClick={[MockFunction]}
>
hotspots.comment.open
@@ -2671,7 +2676,7 @@ exports[`should render correctly: unassigned 1`] = `
</div>
</div>
<div
className="display-flex-center"
className="display-flex-center it__hs-assignee"
>
<span
className="big-spacer-right"

Loading…
Cancel
Save