Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlog committed Jun 18, 2020
1 parent e427de5 commit 399752c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ describe('when on the policies page', () => {

it('should display the onboarding steps', async () => {
const renderResult = render();
const table = await renderResult.findByTestId('onboardingSteps');
expect(table).not.toBeNull();
const onboardingSteps = await renderResult.findByTestId('onboardingSteps');
expect(onboardingSteps).not.toBeNull();
});

describe('when list data loads', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
EuiButton,
EuiSteps,
EuiTitle,
EuiProgress,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
Expand Down Expand Up @@ -474,54 +475,54 @@ const EmptyPolicyTable = React.memo<{
actionDisabled: boolean;
dataTestSubj: string;
}>(({ loading, onActionClick, actionDisabled, dataTestSubj }) => {
const policySteps = [
{
title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepOneTitle', {
defaultMessage: 'Head over to Ingest Manager.',
}),
children: (
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.securitySolution.endpoint.policyList.stepOne"
defaultMessage="Here, you’ll add the Elastic Endpoint Security Integration to your Agent Configuration."
/>
</EuiText>
),
},
{
title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepTwoTitle', {
defaultMessage: 'We’ll create a recommended security policy for you.',
}),
children: (
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.securitySolution.endpoint.policyList.stepTwo"
defaultMessage="You can edit this policy in the “Policies” tab after you’ve added the Elastic Endpoint integration."
/>
</EuiText>
),
},
{
title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepThreeTitle', {
defaultMessage: 'Enroll your agents through Fleet.',
}),
children: (
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.securitySolution.endpoint.policyList.stepThree"
defaultMessage="If you haven’t already, enroll your agents through Fleet using the same agent configuration."
/>
</EuiText>
),
},
];
const policySteps = useMemo(
() => [
{
title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepOneTitle', {
defaultMessage: 'Head over to Ingest Manager.',
}),
children: (
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.securitySolution.endpoint.policyList.stepOne"
defaultMessage="Here, you’ll add the Elastic Endpoint Security Integration to your Agent Configuration."
/>
</EuiText>
),
},
{
title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepTwoTitle', {
defaultMessage: 'We’ll create a recommended security policy for you.',
}),
children: (
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.securitySolution.endpoint.policyList.stepTwo"
defaultMessage="You can edit this policy in the “Policies” tab after you’ve added the Elastic Endpoint integration."
/>
</EuiText>
),
},
{
title: i18n.translate('xpack.securitySolution.endpoint.policyList.stepThreeTitle', {
defaultMessage: 'Enroll your agents through Fleet.',
}),
children: (
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.securitySolution.endpoint.policyList.stepThree"
defaultMessage="If you haven’t already, enroll your agents through Fleet using the same agent configuration."
/>
</EuiText>
),
},
],
[]
);
return (
<div data-test-subj={dataTestSubj}>
{loading ? (
<FormattedMessage
id="xpack.securitySolution.endpoint.policyList.loading"
defaultMessage="Loading..."
/>
<EuiProgress size="xs" color="accent" className="essentialAnimation" />
) : (
<>
<EuiSpacer size="xxl" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await pageObjects.policy.launchAndFindDeleteModal();
await testSubjects.existOrFail('policyListDeleteModal');
await pageObjects.common.clickConfirmOnModal();
let emptyPolicyTable;
await retry.waitForWithTimeout(
'table to not have data and empty state returns',
2000,
async () => {
emptyPolicyTable = await testSubjects.find('emptyPolicyTable');
if (emptyPolicyTable) {
return true;
}
return false;
}
);
const emptyPolicyTable = await testSubjects.find('emptyPolicyTable');
expect(emptyPolicyTable).not.to.be(null);
});
});
Expand Down Expand Up @@ -157,7 +146,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
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.findEmptyStateButton()).click();
await (await pageObjects.policy.findOnboardingStartButton()).click();
await pageObjects.ingestManagerCreateDatasource.ensureOnCreatePageOrFail();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function EndpointPolicyPageProvider({ getService, getPageObjects }: FtrPr
/**
* Finds and returns the onboarding button displayed in empty List pages
*/
async findEmptyStateButton() {
async findOnboardingStartButton() {
await testSubjects.waitForEnabled('onboardingStartButton');
return await testSubjects.find('onboardingStartButton');
},
Expand Down

0 comments on commit 399752c

Please sign in to comment.