Skip to content

Commit

Permalink
refactor (#56131) (#56274)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadameSheema authored Jan 30, 2020
1 parent 63e6c81 commit e44e30c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,32 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { TIMELINES_PAGE } from '../../lib/urls';
import {
NAVIGATION_HOSTS,
NAVIGATION_NETWORK,
NAVIGATION_OVERVIEW,
NAVIGATION_TIMELINES,
} from '../../lib/navigation/selectors';
import { loginAndWaitForPage } from '../../lib/util/helpers';
import { TIMELINES_PAGE } from '../../../urls/navigation';
import { HOSTS, NETWORK, OVERVIEW, TIMELINES } from '../../../screens/header';
import { loginAndWaitForPage } from '../../../tasks/login';
import { navigateFromHeaderTo } from '../../../tasks/header';

describe('top-level navigation common to all pages in the SIEM app', () => {
before(() => {
loginAndWaitForPage(TIMELINES_PAGE);
});
it('navigates to the Overview page', () => {
cy.get(NAVIGATION_OVERVIEW).click({ force: true });
navigateFromHeaderTo(OVERVIEW);
cy.url().should('include', '/siem#/overview');
});

it('navigates to the Hosts page', () => {
cy.get(NAVIGATION_HOSTS).click({ force: true });

navigateFromHeaderTo(HOSTS);
cy.url().should('include', '/siem#/hosts');
});

it('navigates to the Network page', () => {
cy.get(NAVIGATION_NETWORK).click({ force: true });

navigateFromHeaderTo(NETWORK);
cy.url().should('include', '/siem#/network');
});

it('navigates to the Timelines page', () => {
cy.get(NAVIGATION_TIMELINES).click({ force: true });

navigateFromHeaderTo(TIMELINES);
cy.url().should('include', '/siem#/timelines');
});
});
8 changes: 8 additions & 0 deletions x-pack/legacy/plugins/siem/cypress/screens/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
*/

export const KQL_INPUT = '[data-test-subj="queryInput"]';

export const HOSTS = '[data-test-subj="navigation-hosts"]';

export const NETWORK = '[data-test-subj="navigation-network"]';

export const OVERVIEW = '[data-test-subj="navigation-overview"]';

export const TIMELINES = '[data-test-subj="navigation-timelines"]';
9 changes: 9 additions & 0 deletions x-pack/legacy/plugins/siem/cypress/tasks/header.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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 navigateFromHeaderTo = (page: string) => {
cy.get(page).click({ force: true });
};
7 changes: 7 additions & 0 deletions x-pack/legacy/plugins/siem/cypress/urls/navigation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* 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 TIMELINES_PAGE = '/app/siem#/timelines';

0 comments on commit e44e30c

Please sign in to comment.