-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d9f1ef
commit 483d798
Showing
24 changed files
with
601 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import { stubActionCenter, stubPlus } from "cypress/support/stubs"; | ||
|
||
import { | ||
ACTION_CENTER_ROUTE, | ||
INTEGRATION_MANAGEMENT_ROUTE, | ||
} from "~/features/common/nav/v2/routes"; | ||
|
||
describe("Action center", () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
stubPlus(true); | ||
stubActionCenter(); | ||
}); | ||
|
||
describe("disabled web monitor", () => { | ||
beforeEach(() => { | ||
cy.intercept("GET", "/api/v1/config*", { | ||
body: { | ||
detection_discovery: { | ||
website_monitor_enabled: false, | ||
}, | ||
}, | ||
}).as("getTranslationConfig"); | ||
cy.visit(ACTION_CENTER_ROUTE); | ||
}); | ||
it("should display a message that the web monitor is disabled", () => { | ||
cy.wait("@getTranslationConfig"); | ||
cy.contains("currently disabled").should("exist"); | ||
}); | ||
}); | ||
|
||
describe("empty action center", () => { | ||
beforeEach(() => { | ||
cy.intercept("GET", "/api/v1/plus/discovery-monitor/aggregate-results*", { | ||
fixture: "empty-pagination.json", | ||
}).as("getMonitorResults"); | ||
cy.visit(ACTION_CENTER_ROUTE); | ||
}); | ||
it("should display empty state", () => { | ||
cy.wait("@getMonitorResults"); | ||
cy.get("[data-testid='search-bar']").should("exist"); | ||
cy.get(`[class*='ant-empty'] [class*='ant-empty-image']`).should("exist"); | ||
cy.get( | ||
`[class*='ant-empty'] a[href="${INTEGRATION_MANAGEMENT_ROUTE}"]`, | ||
).should("exist"); | ||
}); | ||
}); | ||
|
||
describe("Action center monitor results", () => { | ||
const webMonitorKey = "my_web_monitor_2"; | ||
const integrationMonitorKey = "My_New_BQ_Monitor"; | ||
beforeEach(() => { | ||
cy.visit(ACTION_CENTER_ROUTE); | ||
}); | ||
it("should render the current monitor results", () => { | ||
cy.get("[data-testid='Action center']").should("exist"); | ||
cy.wait("@getMonitorResults"); | ||
cy.get("[data-testid*='monitor-result-']").should("have.length", 3); | ||
cy.get("[data-testid^='monitor-result-']").each((result) => { | ||
const monitorKey = result | ||
.attr("data-testid") | ||
.replace("monitor-result-", ""); | ||
// linked title | ||
cy.wrap(result) | ||
.contains("assets detected") | ||
.should("have.attr", "href", `${ACTION_CENTER_ROUTE}/${monitorKey}`); | ||
// last monitored relative date with real date in tooltip | ||
cy.wrap(result) | ||
.find("[data-testid='monitor-date']") | ||
.contains(" ago") | ||
.realHover(); | ||
cy.get(".ant-tooltip-inner").should("contain", "December"); | ||
}); | ||
// description | ||
cy.getByTestId(`monitor-result-${webMonitorKey}`).should( | ||
"contain", | ||
"92 Browser Requests, 5 Cookies detected.", | ||
); | ||
// monitor name | ||
cy.getByTestId(`monitor-result-${webMonitorKey}`).should( | ||
"contain", | ||
"my web monitor 2", | ||
); | ||
}); | ||
it("should have appropriate actions for web monitors", () => { | ||
cy.wait("@getMonitorResults"); | ||
// Add button | ||
// TODO: [HJ-337] uncomment when Add button is implemented | ||
// cy.getByTestId(`add-button-${webMonitorKey}`).should("exist"); | ||
// Review button | ||
cy.getByTestId(`review-button-${webMonitorKey}`).should( | ||
"have.attr", | ||
"href", | ||
`${ACTION_CENTER_ROUTE}/${webMonitorKey}`, | ||
); | ||
}); | ||
it.skip("Should have appropriate actions for Integrations monitors", () => { | ||
cy.wait("@getMonitorResults"); | ||
// Classify button | ||
cy.getByTestId(`review-button-${integrationMonitorKey}`).should( | ||
"have.attr", | ||
"href", | ||
`${ACTION_CENTER_ROUTE}/${integrationMonitorKey}`, | ||
); | ||
// Ignore button | ||
cy.getByTestId(`ignore-button-${integrationMonitorKey}`).should("exist"); | ||
}); | ||
it.skip("Should have appropriate actions for SSO monitors", () => { | ||
cy.wait("@getMonitorResults"); | ||
// Add button | ||
cy.getByTestId(`add-button-${webMonitorKey}`).should("exist"); | ||
// Ignore button | ||
cy.getByTestId(`ignore-button-${webMonitorKey}`).should("exist"); | ||
}); | ||
it.skip("Should paginate results", () => { | ||
// TODO: mock pagination and also test skeleton loading state | ||
}); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
clients/admin-ui/cypress/fixtures/detection-discovery/results/aggregate-results.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"items": [ | ||
{ | ||
"name": "my web monitor 2", | ||
"key": "my_web_monitor_2", | ||
"last_monitored": "2024-12-17T17:31:20.791014Z", | ||
"updates": { | ||
"Browser Request": 92, | ||
"Cookie": 5 | ||
}, | ||
"total_updates": 97 | ||
}, | ||
{ | ||
"name": "my web monitor 1", | ||
"key": "my_web_monitor_1", | ||
"last_monitored": "2024-12-17T17:31:02.319068Z", | ||
"updates": { | ||
"Browser Request": 201, | ||
"Cookie": 24 | ||
}, | ||
"total_updates": 225 | ||
}, | ||
{ | ||
"name": "My New BQ Monitor", | ||
"key": "My_New_BQ_Monitor", | ||
"last_monitored": "2024-12-16T20:04:16.824025Z", | ||
"updates": { | ||
"Database": 2, | ||
"Field": 216, | ||
"Schema": 13, | ||
"Table": 22 | ||
}, | ||
"total_updates": 253 | ||
} | ||
], | ||
"total": 3, | ||
"page": 1, | ||
"size": 25, | ||
"pages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
.../admin-ui/src/features/data-discovery-and-detection/action-center/DisabledMonitorPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { AntAlert as Alert, AntFlex as Flex, Spinner } from "fidesui"; | ||
|
||
import Layout from "~/features/common/Layout"; | ||
|
||
interface DisabledMonitorPageProps { | ||
isConfigLoading: boolean; | ||
} | ||
|
||
const DISABLED_MONITOR_MESSAGE = "Action center is currently disabled."; | ||
|
||
export const DisabledMonitorPage = ({ | ||
isConfigLoading, | ||
}: DisabledMonitorPageProps) => ( | ||
<Layout title="Action center" mainProps={{ className: "h-full" }}> | ||
<Flex justify="center" align="center" className="h-full"> | ||
{isConfigLoading ? ( | ||
<Spinner color="minos.500" /> | ||
) : ( | ||
<Alert | ||
message="Coming soon..." | ||
description={DISABLED_MONITOR_MESSAGE} | ||
type="info" | ||
showIcon | ||
/> | ||
)} | ||
</Flex> | ||
</Layout> | ||
); |
15 changes: 15 additions & 0 deletions
15
...s/admin-ui/src/features/data-discovery-and-detection/action-center/EmptyMonitorResult.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AntButton as Button, AntEmpty as Empty } from "fidesui"; | ||
import NextLink from "next/link"; | ||
|
||
import { INTEGRATION_MANAGEMENT_ROUTE } from "~/features/common/nav/v2/routes"; | ||
|
||
export const EmptyMonitorResult = () => ( | ||
<Empty | ||
image={Empty.PRESENTED_IMAGE_SIMPLE} | ||
description="All caught up! Set up an integration monitor to track your infrastructure in greater detail." | ||
> | ||
<NextLink href={INTEGRATION_MANAGEMENT_ROUTE} passHref legacyBehavior> | ||
<Button type="primary">Visit integrations</Button> | ||
</NextLink> | ||
</Empty> | ||
); |
Oops, something went wrong.