Skip to content

Commit

Permalink
ROX-21476: Fix title on browser tab for exception management (stackro…
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaudh authored Jan 31, 2024
1 parent 069982c commit a8f92d9
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { selectors as vulnSelectors } from '../vulnerabilities.selectors';

const basePath = '/main/vulnerabilities/exception-management';
export const pendingRequestsPath = `${basePath}/pending-requests`;
export const approvedDeferralsPath = `${basePath}/approved-deferrals`;
export const approvedFalsePositivesPath = `${basePath}/approved-false-positives`;
export const deniedRequestsPath = `${basePath}/denied-requests`;

export function visitExceptionManagement() {
visit(pendingRequestsPath);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import withAuth from '../../../helpers/basicAuth';
import { hasFeatureFlag } from '../../../helpers/features';
import { getRegExpForTitleWithBranding } from '../../../helpers/title';
import { visit } from '../../../helpers/visit';
import { cancelAllCveExceptions } from '../workloadCves/WorkloadCves.helpers';
import {
approvedDeferralsPath,
approvedFalsePositivesPath,
deferAndVisitRequestDetails,
deniedRequestsPath,
pendingRequestsPath,
} from './ExceptionManagement.helpers';

describe('Exception Management', () => {
withAuth();

before(function () {
if (
!hasFeatureFlag('ROX_VULN_MGMT_WORKLOAD_CVES') ||
!hasFeatureFlag('ROX_VULN_MGMT_UNIFIED_CVE_DEFERRAL') ||
!hasFeatureFlag('ROX_WORKLOAD_CVES_FIXABILITY_FILTERS')
) {
this.skip();
}
});

beforeEach(() => {
if (
hasFeatureFlag('ROX_VULN_MGMT_WORKLOAD_CVES') &&
hasFeatureFlag('ROX_VULN_MGMT_UNIFIED_CVE_DEFERRAL') &&
hasFeatureFlag('ROX_WORKLOAD_CVES_FIXABILITY_FILTERS')
) {
cancelAllCveExceptions();
}
});

after(() => {
if (
hasFeatureFlag('ROX_VULN_MGMT_WORKLOAD_CVES') &&
hasFeatureFlag('ROX_VULN_MGMT_UNIFIED_CVE_DEFERRAL') &&
hasFeatureFlag('ROX_WORKLOAD_CVES_FIXABILITY_FILTERS')
) {
cancelAllCveExceptions();
}
});

it('should have the correct browser title for pending requests', () => {
visit(pendingRequestsPath);
cy.title().should(
'match',
getRegExpForTitleWithBranding('Exception Management - Pending Requests')
);
});

it('should have the correct browser title for approved deferrals', () => {
visit(approvedDeferralsPath);
cy.title().should(
'match',
getRegExpForTitleWithBranding('Exception Management - Approved Deferrals')
);
});

it('should have the correct browser title for approved false positives', () => {
visit(approvedFalsePositivesPath);
cy.title().should(
'match',
getRegExpForTitleWithBranding('Exception Management - Approved False Positives')
);
});

it('should have the correct browser title for denied requests', () => {
visit(deniedRequestsPath);
cy.title().should(
'match',
getRegExpForTitleWithBranding('Exception Management - Denied Requests')
);
});

it('should have the correct browser title for request details', () => {
const comment = 'Defer me';
const expiry = 'When all CVEs are fixable';
const scope = 'All images';
deferAndVisitRequestDetails({
comment,
expiry,
scope,
});
cy.title().should(
'match',
getRegExpForTitleWithBranding('Exception Management - Request Details')
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { fetchVulnerabilityExceptions } from 'services/VulnerabilityExceptionSer

import SearchFilterChips from 'Components/PatternFly/SearchFilterChips';
import NotFoundMessage from 'Components/NotFoundMessage';
import PageTitle from 'Components/PageTitle';
import {
RequestExpires,
RequestIDLink,
Expand Down Expand Up @@ -118,6 +119,7 @@ function ApprovedDeferrals() {

return (
<PageSection>
<PageTitle title="Exception Management - Approved Deferrals" />
<Toolbar>
<ToolbarContent>
<FilterAutocompleteSelect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { fetchVulnerabilityExceptions } from 'services/VulnerabilityExceptionSer
import useRestQuery from 'hooks/useRestQuery';
import useURLSort from 'hooks/useURLSort';
import NotFoundMessage from 'Components/NotFoundMessage';
import PageTitle from 'Components/PageTitle';
import {
RequestIDLink,
RequestedAction,
Expand Down Expand Up @@ -111,6 +112,7 @@ function ApprovedFalsePositives() {

return (
<PageSection>
<PageTitle title="Exception Management - Approved False Positives" />
<Toolbar>
<ToolbarContent>
<FilterAutocompleteSelect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { fetchVulnerabilityExceptions } from 'services/VulnerabilityExceptionSer

import SearchFilterChips from 'Components/PatternFly/SearchFilterChips';
import NotFoundMessage from 'Components/NotFoundMessage';
import PageTitle from 'Components/PageTitle';
import {
RequestExpires,
RequestIDLink,
Expand Down Expand Up @@ -119,6 +120,7 @@ function DeniedRequests() {

return (
<PageSection>
<PageTitle title="Exception Management - Denied Requests" />
<Toolbar>
<ToolbarContent>
<FilterAutocompleteSelect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
isFalsePositiveException,
} from 'services/VulnerabilityExceptionService';

import PageTitle from 'Components/PageTitle';
import NotFoundMessage from 'Components/NotFoundMessage';
import BreadcrumbItemLink from 'Components/BreadcrumbItemLink';
import RequestCVEsTable from './components/RequestCVEsTable';
Expand Down Expand Up @@ -167,6 +168,7 @@ function ExceptionRequestDetailsPage() {

return (
<>
<PageTitle title="Exception Management - Request Details" />
{successMessage && (
<Alert
variant={AlertVariant.success}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Route, Switch, Redirect, useLocation, useHistory } from 'react-router-d

import { exceptionManagementPath } from 'routePaths';

import PageTitle from 'Components/PageTitle';
import PendingRequests from './PendingRequests';
import ApprovedDeferrals from './ApprovedDeferrals';
import ApprovedFalsePositives from './ApprovedFalsePositives';
Expand Down Expand Up @@ -58,6 +59,7 @@ function ExceptionRequestsPage() {

return (
<>
<PageTitle title="Exception Management" />
<PageSection
className="pf-u-display-flex pf-u-flex-direction-row pf-u-align-items-center"
variant="light"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { fetchVulnerabilityExceptions } from 'services/VulnerabilityExceptionSer
import SearchFilterChips from 'Components/PatternFly/SearchFilterChips';
import useURLSort from 'hooks/useURLSort';
import NotFoundMessage from 'Components/NotFoundMessage';
import PageTitle from 'Components/PageTitle';
import {
RequestExpires,
RequestIDLink,
Expand Down Expand Up @@ -117,6 +118,7 @@ function PendingApprovals() {

return (
<PageSection>
<PageTitle title="Exception Management - Pending Requests" />
<Toolbar>
<ToolbarContent>
<FilterAutocompleteSelect
Expand Down

0 comments on commit a8f92d9

Please sign in to comment.