Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.14] [EDR Workflows] Proper undefined routeState handling (#181432) #181529

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ const getRoleWithoutArtifactPrivilege = (privilegePrefix: string) => {

const visitArtifactTab = (tabId: string) => {
visitPolicyDetailsPage();
clickArtifactTab(tabId);
};

const clickArtifactTab = (tabId: string) => {
cy.get(`#${tabId}`).click();
};

Expand Down Expand Up @@ -135,6 +139,8 @@ describe('Artifact tabs in Policy Details page', { tags: ['@ess', '@serverless']

cy.getByTestSubj('backToOrigin').click();
cy.getByTestSubj('policyDetailsPage').should('exist');
clickArtifactTab(testData.nextTabId); // Make sure the next tab is accessible and backLink doesn't throw errors
cy.getByTestSubj('policyDetailsPage');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface ArtifactsFixtureType {
title: string;
pagePrefix: string;
tabId: string;
nextTabId: string;
artifactName: string;
privilegePrefix: string;
urlPath: string;
Expand All @@ -46,6 +47,7 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [
title: 'Trusted applications',
pagePrefix: 'trustedAppsListPage',
tabId: 'trustedApps',
nextTabId: 'eventFilters',
artifactName: 'Trusted application name',
privilegePrefix: 'trusted_applications_',
create: {
Expand Down Expand Up @@ -142,7 +144,6 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [
},
urlPath: 'trusted_apps',
emptyState: 'trustedAppsListPage-emptyState',

createRequestBody: {
list_id: ENDPOINT_ARTIFACT_LISTS.trustedApps.id,
entries: [
Expand Down Expand Up @@ -172,6 +173,7 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [
title: 'Event Filters',
pagePrefix: 'EventFiltersListPage',
tabId: 'eventFilters',
nextTabId: 'blocklists',
artifactName: 'Event filter name',
privilegePrefix: 'event_filters_',
create: {
Expand Down Expand Up @@ -274,7 +276,6 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [
},
urlPath: 'event_filters',
emptyState: 'EventFiltersListPage-emptyState',

createRequestBody: {
list_id: ENDPOINT_ARTIFACT_LISTS.eventFilters.id,
entries: [
Expand All @@ -292,6 +293,7 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [
title: 'Blocklist',
pagePrefix: 'blocklistPage',
tabId: 'blocklists',
nextTabId: 'hostIsolationExceptions',
artifactName: 'Blocklist name',
privilegePrefix: 'blocklist_',
create: {
Expand Down Expand Up @@ -397,7 +399,6 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [
},
urlPath: 'blocklist',
emptyState: 'blocklistPage-emptyState',

createRequestBody: {
list_id: ENDPOINT_ARTIFACT_LISTS.blocklists.id,
entries: [
Expand All @@ -421,6 +422,7 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [
title: 'Host isolation exceptions',
pagePrefix: 'hostIsolationExceptionsListPage',
tabId: 'hostIsolationExceptions',
nextTabId: 'trustedApps',
artifactName: 'Host Isolation exception name',
privilegePrefix: 'host_isolation_exceptions_',
create: {
Expand Down Expand Up @@ -499,7 +501,6 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [
},
urlPath: 'host_isolation_exceptions',
emptyState: 'hostIsolationExceptionsListPage-emptyState',

createRequestBody: {
list_id: ENDPOINT_ARTIFACT_LISTS.hostIsolationExceptions.id,
entries: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export const PolicyTabs = React.memo(() => {
cancelUnsavedChangesModal,
history,
policyId,
routeState.backLink,
routeState?.backLink,
unsavedChangesModal.showModal,
]
);
Expand Down
Loading