) => void;
+ actionDisabled: boolean;
+ dataTestSubj: string;
+}>(({ loading, onActionClick, actionDisabled, dataTestSubj }) => {
+ const policySteps = useMemo(
+ () => [
+ {
+ title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepOneTitle', {
+ defaultMessage: 'Head over to Ingest Manager.',
+ }),
+ children: (
+
+
+
+ ),
+ },
+ {
+ title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepTwoTitle', {
+ defaultMessage: 'We’ll create a recommended security policy for you.',
+ }),
+ children: (
+
+
+
+ ),
+ },
+ {
+ title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepThreeTitle', {
+ defaultMessage: 'Enroll your agents through Fleet.',
+ }),
+ children: (
+
+
+
+ ),
+ },
+ ],
+ []
+ );
+ return (
+
+ {loading ? (
+
+ ) : (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )}
+
+ );
+});
+
+EmptyPolicyTable.displayName = 'EmptyPolicyTable';
+
const ConfirmDelete = React.memo<{
hostCount: number;
isDeleting: boolean;
diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_list.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_list.ts
index 1f5b6889f8fed..941a100416740 100644
--- a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_list.ts
+++ b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_list.ts
@@ -36,29 +36,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const createButtonTitle = await testSubjects.getVisibleText('headerCreateNewPolicyButton');
expect(createButtonTitle).to.equal('Create new policy');
});
- it('shows policy count total', async () => {
- const policyTotal = await testSubjects.getVisibleText('policyTotalCount');
- expect(policyTotal).to.equal('0 Policies');
- });
- it('has correct table headers', async () => {
- const allHeaderCells = await pageObjects.endpointPageUtils.tableHeaderVisibleText(
- 'policyTable'
- );
- expect(allHeaderCells).to.eql([
- 'Policy Name',
- 'Created By',
- 'Created Date',
- 'Last Updated By',
- 'Last Updated',
- 'Version',
- 'Actions',
- ]);
- });
- it('should show empty table results message', async () => {
- const [, [noItemsFoundMessage]] = await pageObjects.endpointPageUtils.tableData(
- 'policyTable'
- );
- expect(noItemsFoundMessage).to.equal('No items found');
+ it('shows empty state', async () => {
+ await testSubjects.existOrFail('emptyPolicyTable');
});
describe('and policies exists', () => {
@@ -76,6 +55,21 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
}
});
+ it('has correct table headers', async () => {
+ const allHeaderCells = await pageObjects.endpointPageUtils.tableHeaderVisibleText(
+ 'policyTable'
+ );
+ expect(allHeaderCells).to.eql([
+ 'Policy Name',
+ 'Created By',
+ 'Created Date',
+ 'Last Updated By',
+ 'Last Updated',
+ 'Version',
+ 'Actions',
+ ]);
+ });
+
it('should show policy on the list', async () => {
const [, policyRow] = await pageObjects.endpointPageUtils.tableData('policyTable');
// Validate row data with the exception of the Date columns - since those are initially
@@ -106,9 +100,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await pageObjects.policy.launchAndFindDeleteModal();
await testSubjects.existOrFail('policyListDeleteModal');
await pageObjects.common.clickConfirmOnModal();
- await pageObjects.endpoint.waitForTableToNotHaveData('policyTable');
- const policyTotal = await testSubjects.getVisibleText('policyTotalCount');
- expect(policyTotal).to.equal('0 Policies');
+ const emptyPolicyTable = await testSubjects.find('emptyPolicyTable');
+ expect(emptyPolicyTable).not.to.be(null);
});
});
@@ -148,5 +141,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await policyTestResources.deletePolicyByName(newPolicyName);
});
});
+
+ describe('and user clicks on page header create button', () => {
+ it('should direct users to the ingest management integrations add datasource', async () => {
+ await pageObjects.policy.navigateToPolicyList();
+ await (await pageObjects.policy.findOnboardingStartButton()).click();
+ await pageObjects.ingestManagerCreateDatasource.ensureOnCreatePageOrFail();
+ });
+ });
});
}
diff --git a/x-pack/test/security_solution_endpoint/page_objects/policy_page.ts b/x-pack/test/security_solution_endpoint/page_objects/policy_page.ts
index a2b0f9a671039..3ffd7eb032c22 100644
--- a/x-pack/test/security_solution_endpoint/page_objects/policy_page.ts
+++ b/x-pack/test/security_solution_endpoint/page_objects/policy_page.ts
@@ -101,5 +101,13 @@ export function EndpointPolicyPageProvider({ getService, getPageObjects }: FtrPr
async findDatasourceEndpointCustomConfiguration(onEditPage: boolean = false) {
return await testSubjects.find(`endpointDatasourceConfig_${onEditPage ? 'edit' : 'create'}`);
},
+
+ /**
+ * Finds and returns the onboarding button displayed in empty List pages
+ */
+ async findOnboardingStartButton() {
+ await testSubjects.waitForEnabled('onboardingStartButton');
+ return await testSubjects.find('onboardingStartButton');
+ },
};
}