mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* groups test by context * renames 'openHostsAndStatsTables' to 'openStatsAndTables' * replaces map method for forEach * adds timeout for modal-inspect-close Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
bf4a540e59
commit
b9ae1bf660
3 changed files with 103 additions and 65 deletions
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { DEFAULT_TIMEOUT } from '../util/helpers';
|
||||
|
||||
import { INSPECT_BUTTON_ICON, InspectButtonMetadata } from './selectors';
|
||||
|
||||
export const openStatsAndTables = (table: InspectButtonMetadata) => {
|
||||
if (table.tabId) {
|
||||
cy.get(table.tabId).click({ force: true });
|
||||
}
|
||||
cy.get(table.id, { timeout: DEFAULT_TIMEOUT });
|
||||
if (table.altInspectId) {
|
||||
cy.get(table.altInspectId, { timeout: DEFAULT_TIMEOUT }).trigger('click', {
|
||||
force: true,
|
||||
});
|
||||
} else {
|
||||
cy.get(`${table.id} ${INSPECT_BUTTON_ICON}`, {
|
||||
timeout: DEFAULT_TIMEOUT,
|
||||
}).trigger('click', { force: true });
|
||||
}
|
||||
};
|
||||
|
||||
export const closesModal = () => {
|
||||
cy.get('[data-test-subj="modal-inspect-close"]', { timeout: DEFAULT_TIMEOUT }).click();
|
||||
};
|
|
@ -4,95 +4,86 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { HOSTS_PAGE, HOSTS_PAGE_TAB_URLS, NETWORK_PAGE, NETWORK_TAB_URLS } from '../urls';
|
||||
|
||||
export const INSPECT_BUTTON_ICON = '[data-test-subj="inspect-icon-button"]';
|
||||
export const INSPECT_MODAL = '[data-test-subj="modal-inspect-euiModal"]';
|
||||
export const TIMELINE_SETTINGS_ICON = '[data-test-subj="settings-gear"]';
|
||||
export const TIMELINE_INSPECT_BUTTON = '[data-test-subj="inspect-empty-button"]';
|
||||
|
||||
interface InspectButtonMetadata {
|
||||
export interface InspectButtonMetadata {
|
||||
altInspectId?: string;
|
||||
id: string;
|
||||
title: string;
|
||||
url: string;
|
||||
tabId?: string;
|
||||
}
|
||||
|
||||
export const INSPECT_BUTTONS_IN_SIEM: InspectButtonMetadata[] = [
|
||||
export const INSPECT_HOSTS_BUTTONS_IN_SIEM: InspectButtonMetadata[] = [
|
||||
{
|
||||
id: '[data-test-subj="stat-hosts"]',
|
||||
title: 'Hosts Stat',
|
||||
url: HOSTS_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-authentication"]',
|
||||
title: 'User Authentications Stat',
|
||||
url: HOSTS_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-uniqueIps"]',
|
||||
title: 'Unique IPs Stat',
|
||||
url: HOSTS_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-networkEvents"]',
|
||||
title: 'Network events Stat',
|
||||
url: NETWORK_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-dnsQueries"]',
|
||||
title: 'DNS queries Stat',
|
||||
url: NETWORK_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-uniqueFlowId"]',
|
||||
title: 'Unique flow IDs Stat',
|
||||
url: NETWORK_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-tlsHandshakes"]',
|
||||
title: 'TLS handshakes Stat',
|
||||
url: NETWORK_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-UniqueIps"]',
|
||||
title: 'Unique private IPs Stat',
|
||||
url: NETWORK_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-topNFlowSource-loading-false"]',
|
||||
title: 'Source IPs Table',
|
||||
url: NETWORK_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-topNFlowDestination-loading-false"]',
|
||||
title: 'Destination IPs Table',
|
||||
url: NETWORK_PAGE,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-dns-loading-false"]',
|
||||
title: 'Top DNS Domains Table',
|
||||
url: NETWORK_TAB_URLS.dns,
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-allHosts-loading-false"]',
|
||||
title: 'All Hosts Table',
|
||||
url: HOSTS_PAGE_TAB_URLS.allHosts,
|
||||
tabId: '[data-test-subj="navigation-allHosts"]',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-authentications-loading-false"]',
|
||||
title: 'Authentications Table',
|
||||
url: HOSTS_PAGE_TAB_URLS.authentications,
|
||||
tabId: '[data-test-subj="navigation-authentications"]',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-uncommonProcesses-loading-false"]',
|
||||
title: 'Uncommon processes Table',
|
||||
url: HOSTS_PAGE_TAB_URLS.uncommonProcesses,
|
||||
tabId: '[data-test-subj="navigation-uncommonProcesses"]',
|
||||
},
|
||||
{
|
||||
altInspectId: `[data-test-subj="events-viewer-panel"] ${INSPECT_BUTTON_ICON}`,
|
||||
id: '[data-test-subj="events-container-loading-false"]',
|
||||
title: 'Events Table',
|
||||
url: HOSTS_PAGE_TAB_URLS.events,
|
||||
tabId: '[data-test-subj="navigation-events"]',
|
||||
},
|
||||
];
|
||||
|
||||
export const INSPECT_NETWORK_BUTTONS_IN_SIEM: InspectButtonMetadata[] = [
|
||||
{
|
||||
id: '[data-test-subj="stat-networkEvents"]',
|
||||
title: 'Network events Stat',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-dnsQueries"]',
|
||||
title: 'DNS queries Stat',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-uniqueFlowId"]',
|
||||
title: 'Unique flow IDs Stat',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-tlsHandshakes"]',
|
||||
title: 'TLS handshakes Stat',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="stat-UniqueIps"]',
|
||||
title: 'Unique private IPs Stat',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-topNFlowSource-loading-false"]',
|
||||
title: 'Source IPs Table',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-topNFlowDestination-loading-false"]',
|
||||
title: 'Destination IPs Table',
|
||||
},
|
||||
{
|
||||
id: '[data-test-subj="table-dns-loading-false"]',
|
||||
title: 'Top DNS Domains Table',
|
||||
tabId: '[data-test-subj="navigation-dns"]',
|
||||
},
|
||||
];
|
||||
|
|
|
@ -4,34 +4,52 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { HOSTS_PAGE } from '../../lib/urls';
|
||||
import { HOSTS_PAGE, NETWORK_PAGE } from '../../lib/urls';
|
||||
import {
|
||||
INSPECT_BUTTON_ICON,
|
||||
INSPECT_MODAL,
|
||||
INSPECT_BUTTONS_IN_SIEM,
|
||||
INSPECT_NETWORK_BUTTONS_IN_SIEM,
|
||||
INSPECT_HOSTS_BUTTONS_IN_SIEM,
|
||||
TIMELINE_SETTINGS_ICON,
|
||||
TIMELINE_INSPECT_BUTTON,
|
||||
} from '../../lib/inspect/selectors';
|
||||
import { DEFAULT_TIMEOUT, loginAndWaitForPage } from '../../lib/util/helpers';
|
||||
import { executeKQL, hostExistsQuery, toggleTimelineVisibility } from '../../lib/timeline/helpers';
|
||||
import { closesModal, openStatsAndTables } from '../../lib/inspect/helpers';
|
||||
|
||||
describe('Inspect', () => {
|
||||
describe('Hosts and network stats and tables', () => {
|
||||
INSPECT_BUTTONS_IN_SIEM.map(table =>
|
||||
context('Hosts stats and tables', () => {
|
||||
before(() => {
|
||||
loginAndWaitForPage(HOSTS_PAGE);
|
||||
});
|
||||
afterEach(() => {
|
||||
closesModal();
|
||||
});
|
||||
|
||||
INSPECT_HOSTS_BUTTONS_IN_SIEM.forEach(table =>
|
||||
it(`inspects the ${table.title}`, () => {
|
||||
loginAndWaitForPage(table.url);
|
||||
cy.get(table.id, { timeout: DEFAULT_TIMEOUT });
|
||||
if (table.altInspectId) {
|
||||
cy.get(table.altInspectId).trigger('click', { force: true });
|
||||
} else {
|
||||
cy.get(`${table.id} ${INSPECT_BUTTON_ICON}`).trigger('click', { force: true });
|
||||
}
|
||||
openStatsAndTables(table);
|
||||
cy.get(INSPECT_MODAL, { timeout: DEFAULT_TIMEOUT }).should('be.visible');
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
describe('Timeline', () => {
|
||||
context('Network stats and tables', () => {
|
||||
before(() => {
|
||||
loginAndWaitForPage(NETWORK_PAGE);
|
||||
});
|
||||
afterEach(() => {
|
||||
closesModal();
|
||||
});
|
||||
|
||||
INSPECT_NETWORK_BUTTONS_IN_SIEM.forEach(table =>
|
||||
it(`inspects the ${table.title}`, () => {
|
||||
openStatsAndTables(table);
|
||||
cy.get(INSPECT_MODAL, { timeout: DEFAULT_TIMEOUT }).should('be.visible');
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
context('Timeline', () => {
|
||||
it('inspects the timeline', () => {
|
||||
loginAndWaitForPage(HOSTS_PAGE);
|
||||
toggleTimelineVisibility();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue