adds kibana navigation tests (#69733)

This commit is contained in:
MadameSheema 2020-06-23 22:30:02 +02:00 committed by GitHub
parent e87a4b2a31
commit 71d54c8cae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 148 additions and 47 deletions

View file

@ -44,7 +44,7 @@ import { backToCases, createNewCase } from '../tasks/create_new_case';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
import { CASES } from '../urls/navigation';
import { CASES_URL } from '../urls/navigation';
describe('Cases', () => {
before(() => {
@ -56,7 +56,7 @@ describe('Cases', () => {
});
it('Creates a new case with timeline and opens the timeline', () => {
loginAndWaitForPageWithoutDateRange(CASES);
loginAndWaitForPageWithoutDateRange(CASES_URL);
goToCreateNewCase();
createNewCase(case1);
backToCases();

View file

@ -15,7 +15,7 @@ import {
} from '../tasks/configure_cases';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';
import { CASES } from '../urls/navigation';
import { CASES_URL } from '../urls/navigation';
describe('Cases connectors', () => {
before(() => {
@ -25,7 +25,7 @@ describe('Cases connectors', () => {
});
it('Configures a new connector', () => {
loginAndWaitForPageWithoutDateRange(CASES);
loginAndWaitForPageWithoutDateRange(CASES_URL);
goToEditExternalConnection();
openAddNewConnectorOption();
addServiceNowConnector(serviceNowConnector);

View file

@ -33,7 +33,7 @@ import {
} from '../tasks/hosts/events';
import { clearSearchBar, kqlSearch } from '../tasks/security_header';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
import { resetFields } from '../tasks/timeline';
const defaultHeadersInDefaultEcsCategory = [
@ -49,7 +49,7 @@ const defaultHeadersInDefaultEcsCategory = [
describe('Events Viewer', () => {
context('Fields rendering', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
});
@ -75,7 +75,7 @@ describe('Events Viewer', () => {
context('Events viewer query modal', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
});
@ -93,7 +93,7 @@ describe('Events Viewer', () => {
context('Events viewer fields behaviour', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
});
@ -124,7 +124,7 @@ describe('Events Viewer', () => {
context('Events behaviour', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
waitsForEventsToBeLoaded();
});
@ -155,7 +155,7 @@ describe('Events Viewer', () => {
context.skip('Events columns', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
waitsForEventsToBeLoaded();
});

View file

@ -31,7 +31,7 @@ import { loginAndWaitForPage } from '../tasks/login';
import { openTimeline } from '../tasks/security_main';
import { openTimelineFieldsBrowser, populateTimeline } from '../tasks/timeline';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
const defaultHeaders = [
{ id: '@timestamp' },
@ -47,7 +47,7 @@ const defaultHeaders = [
describe('Fields Browser', () => {
context('Fields Browser rendering', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openTimeline();
populateTimeline();
openTimelineFieldsBrowser();
@ -110,7 +110,7 @@ describe('Fields Browser', () => {
context('Editing the timeline', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openTimeline();
populateTimeline();
openTimelineFieldsBrowser();

View file

@ -19,12 +19,12 @@ import {
openTimelineSettings,
} from '../tasks/timeline';
import { HOSTS_PAGE, NETWORK_PAGE } from '../urls/navigation';
import { HOSTS_URL, NETWORK_URL } from '../urls/navigation';
describe('Inspect', () => {
context('Hosts stats and tables', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
});
afterEach(() => {
closesModal();
@ -40,7 +40,7 @@ describe('Inspect', () => {
context('Network stats and tables', () => {
before(() => {
loginAndWaitForPage(NETWORK_PAGE);
loginAndWaitForPage(NETWORK_URL);
});
afterEach(() => {
closesModal();
@ -57,7 +57,7 @@ describe('Inspect', () => {
context('Timeline', () => {
it('inspects the timeline', () => {
const hostExistsQuery = 'host.name: *';
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openTimeline();
executeTimelineKQL(hostExistsQuery);
openTimelineSettings();

View file

@ -16,45 +16,107 @@ import {
import { loginAndWaitForPage } from '../tasks/login';
import { navigateFromHeaderTo } from '../tasks/security_header';
import { TIMELINES_PAGE } from '../urls/navigation';
import {
ALERTS_URL,
CASES_URL,
HOSTS_URL,
KIBANA_HOME,
MANAGEMENT_URL,
NETWORK_URL,
OVERVIEW_URL,
TIMELINES_URL,
} from '../urls/navigation';
import { openKibanaNavigation, navigateFromKibanaCollapsibleTo } from '../tasks/kibana_navigation';
import {
ALERTS_PAGE,
CASES_PAGE,
HOSTS_PAGE,
MANAGEMENT_PAGE,
NETWORK_PAGE,
OVERVIEW_PAGE,
TIMELINES_PAGE,
} from '../screens/kibana_navigation';
describe('top-level navigation common to all pages in the Security app', () => {
before(() => {
loginAndWaitForPage(TIMELINES_PAGE);
loginAndWaitForPage(TIMELINES_URL);
});
it('navigates to the Overview page', () => {
navigateFromHeaderTo(OVERVIEW);
cy.url().should('include', '/security/overview');
cy.url().should('include', OVERVIEW_URL);
});
it('navigates to the Alerts page', () => {
navigateFromHeaderTo(ALERTS);
cy.url().should('include', '/security/alerts');
cy.url().should('include', ALERTS_URL);
});
it('navigates to the Hosts page', () => {
navigateFromHeaderTo(HOSTS);
cy.url().should('include', '/security/hosts');
cy.url().should('include', HOSTS_URL);
});
it('navigates to the Network page', () => {
navigateFromHeaderTo(NETWORK);
cy.url().should('include', '/security/network');
cy.url().should('include', NETWORK_URL);
});
it('navigates to the Timelines page', () => {
navigateFromHeaderTo(TIMELINES);
cy.url().should('include', '/security/timelines');
cy.url().should('include', TIMELINES_URL);
});
it('navigates to the Cases page', () => {
navigateFromHeaderTo(CASES);
cy.url().should('include', '/security/cases');
cy.url().should('include', CASES_URL);
});
it('navigates to the Management page', () => {
navigateFromHeaderTo(MANAGEMENT);
cy.url().should('include', '/security/management');
cy.url().should('include', MANAGEMENT_URL);
});
});
describe('Kibana navigation to all pages in the Security app ', () => {
before(() => {
loginAndWaitForPage(KIBANA_HOME);
});
beforeEach(() => {
openKibanaNavigation();
});
it('navigates to the Overview page', () => {
navigateFromKibanaCollapsibleTo(OVERVIEW_PAGE);
cy.url().should('include', OVERVIEW_URL);
});
it('navigates to the Alerts page', () => {
navigateFromKibanaCollapsibleTo(ALERTS_PAGE);
cy.url().should('include', ALERTS_URL);
});
it('navigates to the Hosts page', () => {
navigateFromKibanaCollapsibleTo(HOSTS_PAGE);
cy.url().should('include', HOSTS_URL);
});
it('navigates to the Network page', () => {
navigateFromKibanaCollapsibleTo(NETWORK_PAGE);
cy.url().should('include', NETWORK_URL);
});
it('navigates to the Timelines page', () => {
navigateFromKibanaCollapsibleTo(TIMELINES_PAGE);
cy.url().should('include', TIMELINES_URL);
});
it('navigates to the Cases page', () => {
navigateFromKibanaCollapsibleTo(CASES_PAGE);
cy.url().should('include', CASES_URL);
});
it('navigates to the Management page', () => {
navigateFromKibanaCollapsibleTo(MANAGEMENT_PAGE);
cy.url().should('include', MANAGEMENT_URL);
});
});

View file

@ -9,12 +9,12 @@ import { HOST_STATS, NETWORK_STATS } from '../screens/overview';
import { expandHostStats, expandNetworkStats } from '../tasks/overview';
import { loginAndWaitForPage } from '../tasks/login';
import { OVERVIEW_PAGE } from '../urls/navigation';
import { OVERVIEW_URL } from '../urls/navigation';
describe('Overview Page', () => {
before(() => {
cy.stubSecurityApi('overview');
loginAndWaitForPage(OVERVIEW_PAGE);
loginAndWaitForPage(OVERVIEW_URL);
});
it('Host stats render with correct values', () => {

View file

@ -9,13 +9,13 @@ import { openAddFilterPopover, fillAddFilterForm } from '../tasks/search_bar';
import { GLOBAL_SEARCH_BAR_FILTER_ITEM } from '../screens/search_bar';
import { hostIpFilter } from '../objects/filter';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
import { waitForAllHostsToBeLoaded } from '../tasks/hosts/all_hosts';
// FAILING: https://github.com/elastic/kibana/issues/69595
describe.skip('SearchBar', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
waitForAllHostsToBeLoaded();
});

View file

@ -22,11 +22,11 @@ import { loginAndWaitForPage } from '../tasks/login';
import { openTimeline } from '../tasks/security_main';
import { createNewTimeline } from '../tasks/timeline';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
describe('timeline data providers', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
waitForAllHostsToBeLoaded();
});

View file

@ -11,11 +11,11 @@ import { loginAndWaitForPage } from '../tasks/login';
import { openTimeline, openTimelineIfClosed } from '../tasks/security_main';
import { createNewTimeline } from '../tasks/timeline';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
describe('timeline flyout button', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
waitForAllHostsToBeLoaded();
});

View file

@ -6,7 +6,7 @@
import { reload } from '../tasks/common';
import { loginAndWaitForPage } from '../tasks/login';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
import { openEvents } from '../tasks/hosts/main';
import { DRAGGABLE_HEADER } from '../screens/timeline';
import { TABLE_COLUMN_EVENTS_MESSAGE } from '../screens/hosts/external_events';
@ -15,7 +15,7 @@ import { removeColumn, resetFields } from '../tasks/timeline';
describe('persistent timeline', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
waitsForEventsToBeLoaded();
});

View file

@ -10,11 +10,11 @@ import { loginAndWaitForPage } from '../tasks/login';
import { openTimeline } from '../tasks/security_main';
import { executeTimelineKQL } from '../tasks/timeline';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
describe('timeline search or filter KQL bar', () => {
beforeEach(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
});
it('executes a KQL query', () => {

View file

@ -22,11 +22,11 @@ import {
uncheckTimestampToggleField,
} from '../tasks/timeline';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
describe('toggle column in timeline', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
});
beforeEach(() => {

View file

@ -38,7 +38,7 @@ import {
executeTimelineKQL,
} from '../tasks/timeline';
import { HOSTS_PAGE } from '../urls/navigation';
import { HOSTS_URL } from '../urls/navigation';
import { ABSOLUTE_DATE_RANGE } from '../urls/state';
const ABSOLUTE_DATE = {
@ -235,7 +235,7 @@ describe('url state', () => {
});
it.skip('sets and reads the url state for timeline by id', () => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openTimeline();
executeTimelineKQL('host.name: *');

View file

@ -0,0 +1,22 @@
/*
* 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.
*/
export const ALERTS_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Alerts"]';
export const CASES_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Cases"]';
export const HOSTS_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Hosts"]';
export const KIBANA_NAVIGATION_TOGGLE = '[data-test-subj="toggleNavButton"]';
export const MANAGEMENT_PAGE =
'[data-test-subj="collapsibleNavGroup-security"] [title="Management"]';
export const NETWORK_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Network"]';
export const OVERVIEW_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Overview"]';
export const TIMELINES_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Timelines"]';

View file

@ -0,0 +1,15 @@
/*
* 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 { KIBANA_NAVIGATION_TOGGLE } from '../screens/kibana_navigation';
export const navigateFromKibanaCollapsibleTo = (page: string) => {
cy.get(page).click();
};
export const openKibanaNavigation = () => {
cy.get(KIBANA_NAVIGATION_TOGGLE).click();
};

View file

@ -5,9 +5,9 @@
*/
export const ALERTS_URL = 'app/security/alerts';
export const CASES = '/app/security/cases';
export const CASES_URL = '/app/security/cases';
export const DETECTIONS = '/app/siem#/detections';
export const HOSTS_PAGE = '/app/security/hosts/allHosts';
export const HOSTS_URL = '/app/security/hosts/allHosts';
export const HOSTS_PAGE_TAB_URLS = {
allHosts: '/app/security/hosts/allHosts',
anomalies: '/app/security/hosts/anomalies',
@ -15,6 +15,8 @@ export const HOSTS_PAGE_TAB_URLS = {
events: '/app/security/hosts/events',
uncommonProcesses: '/app/security/hosts/uncommonProcesses',
};
export const NETWORK_PAGE = '/app/security/network';
export const OVERVIEW_PAGE = '/app/security/overview';
export const TIMELINES_PAGE = '/app/security/timelines';
export const KIBANA_HOME = '/app/home#/';
export const MANAGEMENT_URL = '/app/security/management';
export const NETWORK_URL = '/app/security/network';
export const OVERVIEW_URL = '/app/security/overview';
export const TIMELINES_URL = '/app/security/timelines';