Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIEM] Adds Cypress kibana navigation tests #69733

Merged
merged 1 commit into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -25,7 +25,7 @@ describe('Cases connectors', () => {
});

it('Configures a new connector', () => {
loginAndWaitForPageWithoutDateRange(CASES);
loginAndWaitForPageWithoutDateRange(CASES_URL);
goToEditExternalConnection();
openAddNewConnectorOption();
addServiceNowConnector(serviceNowConnector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -49,7 +49,7 @@ const defaultHeadersInDefaultEcsCategory = [
describe('Events Viewer', () => {
context('Fields rendering', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
});

Expand All @@ -75,7 +75,7 @@ describe('Events Viewer', () => {

context('Events viewer query modal', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
});

Expand All @@ -93,7 +93,7 @@ describe('Events Viewer', () => {

context('Events viewer fields behaviour', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
});

Expand Down Expand Up @@ -124,7 +124,7 @@ describe('Events Viewer', () => {

context('Events behaviour', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
waitsForEventsToBeLoaded();
});
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('Events Viewer', () => {

context.skip('Events columns', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
waitsForEventsToBeLoaded();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand All @@ -47,7 +47,7 @@ const defaultHeaders = [
describe('Fields Browser', () => {
context('Fields Browser rendering', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openTimeline();
populateTimeline();
openTimelineFieldsBrowser();
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('Fields Browser', () => {

context('Editing the timeline', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openTimeline();
populateTimeline();
openTimelineFieldsBrowser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -40,7 +40,7 @@ describe('Inspect', () => {

context('Network stats and tables', () => {
before(() => {
loginAndWaitForPage(NETWORK_PAGE);
loginAndWaitForPage(NETWORK_URL);
});
afterEach(() => {
closesModal();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -15,7 +15,7 @@ import { removeColumn, resetFields } from '../tasks/timeline';

describe('persistent timeline', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
loginAndWaitForPage(HOSTS_URL);
openEvents();
waitsForEventsToBeLoaded();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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: *');

Expand Down
Loading