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

[Security Solution] Cypress template creation #80180

Merged
merged 24 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8a638a5
init tests
angorayc Sep 8, 2020
897eda1
Merge branch 'master' of github.com:elastic/kibana
angorayc Sep 9, 2020
6508784
Merge branch 'master' of github.com:elastic/kibana
angorayc Sep 9, 2020
79d5acb
Merge branch 'master' of github.com:elastic/kibana
angorayc Sep 10, 2020
564ae4b
Merge branch 'master' of github.com:elastic/kibana
angorayc Sep 15, 2020
e038b0b
Merge branch 'master' of github.com:elastic/kibana
angorayc Sep 24, 2020
b8b26e6
Merge branch 'master' of github.com:elastic/kibana
angorayc Sep 24, 2020
62207c4
Merge branch 'master' of github.com:elastic/kibana
angorayc Sep 28, 2020
85bfbf5
Merge branch 'master' of github.com:elastic/kibana
angorayc Sep 30, 2020
b91fd31
Merge branch 'master' of github.com:elastic/kibana
angorayc Oct 1, 2020
04ff349
Merge branch 'master' of github.com:elastic/kibana
angorayc Oct 3, 2020
e38ddab
Merge branch 'master' of github.com:elastic/kibana
angorayc Oct 5, 2020
bb498df
Merge branch 'master' of github.com:elastic/kibana
angorayc Oct 5, 2020
9b97a3b
Merge branch 'master' of github.com:elastic/kibana
angorayc Oct 6, 2020
974b938
Merge branch 'master' of github.com:elastic/kibana
angorayc Oct 8, 2020
c9adb27
Merge branch 'master' of github.com:elastic/kibana
angorayc Oct 12, 2020
f3d1379
Merge branch 'master' of github.com:elastic/kibana
angorayc Oct 12, 2020
7379237
fix cypress test
angorayc Oct 12, 2020
ccde582
remove console
angorayc Oct 12, 2020
f34eeb3
Merge branch 'master' of github.com:elastic/kibana into cypress-templ…
angorayc Oct 13, 2020
b65119b
fix functional test
angorayc Oct 14, 2020
b380155
Merge branch 'master' into cypress-template-creation
kibanamachine Oct 14, 2020
fbb4634
update functional test
angorayc Oct 15, 2020
f0af58e
Merge branch 'cypress-template-creation' of github.com:angorayc/kiban…
angorayc Oct 15, 2020
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 @@ -45,8 +45,7 @@ import { openTimeline } from '../tasks/timelines';

import { OVERVIEW_URL } from '../urls/navigation';

// FLAKY: https://github.com/elastic/kibana/issues/79389
describe.skip('Timelines', () => {
describe('Timelines', () => {
before(() => {
cy.server();
cy.route('PATCH', '**/api/timeline').as('timeline');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
NOTES_BUTTON,
NOTES_COUNT,
NOTES_TEXT_AREA,
PIN_EVENT,
TIMELINE_DESCRIPTION,
// TIMELINE_FILTER,
TIMELINE_QUERY,
TIMELINE_TITLE,
} from '../screens/timeline';
Expand All @@ -35,16 +35,15 @@ import {
closeTimeline,
createNewTimelineTemplate,
markAsFavorite,
openTimelineFromSettings,
openTimelineTemplateFromSettings,
populateTimeline,
waitForTimelineChanges,
} from '../tasks/timeline';
import { openTimeline } from '../tasks/timelines';

import { OVERVIEW_URL } from '../urls/navigation';

// FLAKY: https://github.com/elastic/kibana/issues/79967
describe.skip('Timeline Templates', () => {
describe('Timeline Templates', () => {
before(() => {
cy.server();
cy.route('PATCH', '**/api/timeline').as('timeline');
Expand All @@ -56,12 +55,11 @@ describe.skip('Timeline Templates', () => {
createNewTimelineTemplate();
populateTimeline();
addFilter(timeline.filter);
// To fix
// cy.get(PIN_EVENT).should(
// 'have.attr',
// 'aria-label',
// 'This event may not be pinned while editing a template timeline'
// );
cy.get(PIN_EVENT).should(
'have.attr',
'aria-label',
'This event may not be pinned while editing a template timeline'
);
cy.get(LOCKED_ICON).should('be.visible');

addNameToTimeline(timeline.title);
Expand All @@ -77,7 +75,7 @@ describe.skip('Timeline Templates', () => {
waitForTimelineChanges();
createNewTimelineTemplate();
angorayc marked this conversation as resolved.
Show resolved Hide resolved
closeTimeline();
openTimelineFromSettings();
openTimelineTemplateFromSettings(timelineId);

cy.contains(timeline.title).should('exist');
cy.get(TIMELINES_DESCRIPTION).first().should('have.text', timeline.description);
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/security_solution/cypress/screens/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export const NOTES_COUNT = '[data-test-subj="timeline-notes-count"]';

export const OPEN_TIMELINE_ICON = '[data-test-subj="open-timeline-button"]';

export const OPEN_TIMELINE_TEMPLATE_ICON =
'[data-test-subj="open-timeline-modal-body-filter-template"]';

export const PIN_EVENT = '[data-test-subj="pin"]';

export const PROVIDER_BADGE = '[data-test-subj="providerBadge"]';
Expand Down Expand Up @@ -98,6 +101,8 @@ export const TIMELINE_FILTER = (filter: TimelineFilter) => {

export const TIMELINE_FILTER_FIELD = '[data-test-subj="filterFieldSuggestionList"]';

export const TIMELINE_TITLE_BY_ID = (id: string) => `[data-test-subj="title-${id}"]`;

export const TIMELINE_FILTER_OPERATOR = '[data-test-subj="filterOperatorList"]';

export const TIMELINE_FILTER_VALUE =
Expand Down
11 changes: 9 additions & 2 deletions x-pack/plugins/security_solution/cypress/tasks/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ import {
TIMELINE_INSPECT_BUTTON,
TIMELINE_SETTINGS_ICON,
TIMELINE_TITLE,
TIMELINE_TITLE_BY_ID,
TIMESTAMP_TOGGLE_FIELD,
TOGGLE_TIMELINE_EXPAND_EVENT,
CREATE_NEW_TIMELINE_TEMPLATE,
OPEN_TIMELINE_TEMPLATE_ICON,
} from '../screens/timeline';
import { TIMELINES_TABLE } from '../screens/timelines';

Expand All @@ -69,8 +71,7 @@ export const addNotesToTimeline = (notes: string) => {

export const addFilter = (filter: TimelineFilter) => {
cy.get(ADD_FILTER).click();
cy.get(TIMELINE_FILTER_FIELD).type(filter.field);
cy.get(COMBO_BOX).contains(filter.field).click();
cy.get(TIMELINE_FILTER_FIELD).type(`${filter.field}{downarrow}{enter}`);
cy.get(TIMELINE_FILTER_OPERATOR).type(filter.operator);
cy.get(COMBO_BOX).contains(filter.operator).click();
if (filter.operator !== 'exists') {
Expand Down Expand Up @@ -146,6 +147,12 @@ export const openTimelineFromSettings = () => {
cy.get(OPEN_TIMELINE_ICON).click({ force: true });
};

export const openTimelineTemplateFromSettings = (id: string) => {
openTimelineFromSettings();
cy.get(OPEN_TIMELINE_TEMPLATE_ICON).click({ force: true });
cy.get(TIMELINE_TITLE_BY_ID(id)).click({ force: true });
};

export const openTimelineSettings = () => {
cy.get(TIMELINE_SETTINGS_ICON).trigger('click', { force: true });
};
Expand Down