Skip to content

Commit

Permalink
divide endpoint list checking function
Browse files Browse the repository at this point in the history
  • Loading branch information
szwarckonrad committed Apr 25, 2023
1 parent 7d03f5c commit f5ce24d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import type { Agent } from '@kbn/fleet-plugin/common';
import { APP_CASES_PATH, APP_ENDPOINTS_PATH } from '../../../../../common/constants';
import { closeAllToasts } from '../../tasks/close_all_toasts';
import {
checkEndpointListForIsolatedHosts,
checkEndpointListForOnlyIsolatedHosts,
checkEndpointListForOnlyUnIsolatedHosts,
checkFlyoutEndpointIsolation,
createAgentPolicyTask,
filterOutEndpoints,
Expand Down Expand Up @@ -69,7 +70,7 @@ describe('Isolate command', () => {
it('should allow filtering endpoint by Isolated status', () => {
cy.visit(APP_ENDPOINTS_PATH);
closeAllToasts();
checkEndpointListForIsolatedHosts(false);
checkEndpointListForOnlyUnIsolatedHosts();

filterOutIsolatedHosts();
cy.contains('No items found');
Expand All @@ -87,7 +88,7 @@ describe('Isolate command', () => {
cy.getByTestSubj('rowHostStatus-actionStatuses').should('contain.text', 'Isolated');
filterOutIsolatedHosts();

checkEndpointListForIsolatedHosts();
checkEndpointListForOnlyIsolatedHosts();

cy.getByTestSubj('endpointTableRowActions').click();
cy.getByTestSubj('unIsolateLink').click();
Expand All @@ -96,7 +97,7 @@ describe('Isolate command', () => {
cy.getByTestSubj('euiFlyoutCloseButton').click();
cy.getByTestSubj('adminSearchBar').click().type('{selectall}{backspace}');
cy.getByTestSubj('querySubmitButton').click();
checkEndpointListForIsolatedHosts(false);
checkEndpointListForOnlyUnIsolatedHosts();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { getEndpointListPath } from '../../../common/routing';
import {
checkEndpointListForIsolatedHosts,
checkEndpointListForOnlyIsolatedHosts,
checkFlyoutEndpointIsolation,
filterOutIsolatedHosts,
interceptActionRequests,
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('Isolate command', () => {
closeAllToasts();
filterOutIsolatedHosts();
cy.contains('Showing 2 endpoints');
checkEndpointListForIsolatedHosts();
checkEndpointListForOnlyIsolatedHosts();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const filterOutIsolatedHosts = (): void => {
cy.getByTestSubj('querySubmitButton').click();
};

export const checkEndpointListForIsolatedHosts = (expectIsolated = true): void => {
const checkEndpointListForIsolatedHosts = (expectIsolated: boolean): void => {
const chainer = expectIsolated ? 'contain.text' : 'not.contain.text';
cy.getByTestSubj('endpointListTable').within(() => {
cy.get('tbody tr').each(($tr) => {
Expand All @@ -140,6 +140,7 @@ export const checkEndpointListForIsolatedHosts = (expectIsolated = true): void =
});
};

export const checkEndpointListForOnlyUnIsolatedHosts = () =>
export const checkEndpointListForOnlyUnIsolatedHosts = (): void =>
checkEndpointListForIsolatedHosts(false);
export const checkEndpointListForOnlyIsolatedHosts = () => checkEndpointListForIsolatedHosts(true);
export const checkEndpointListForOnlyIsolatedHosts = (): void =>
checkEndpointListForIsolatedHosts(true);

0 comments on commit f5ce24d

Please sign in to comment.