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] Add ServerlessQA tags for explore area tests #183087

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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 @@ -36,7 +36,7 @@ export const StatItemsComponent = React.memo<StatItemsProps>(({ statItems, from,
const { isToggleExpanded, onToggle } = useToggleStatus({ id });

return (
<FlexItem grow={1} data-test-subj={key}>
<FlexItem grow={1} data-test-subj={`stat-${key}`}>
<EuiPanel hasBorder>
<StatItemHeader
onToggle={onToggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const isServerless = Cypress.env(IS_SERVERLESS);
const username = isServerless ? 'platform_engineer' : Cypress.env(ELASTICSEARCH_USERNAME);

// Tracked by https://github.com/elastic/security-team/issues/7696
describe('Cases', { tags: ['@ess', '@serverless'] }, () => {
describe('Cases', { tags: ['@ess', '@serverless', '@serverlessQA'] }, () => {
beforeEach(() => {
deleteTimelines();
deleteCases();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const defaultHeadersInDefaultEcsCategory = [
{ id: 'destination.ip' },
];

describe('Events Viewer', { tags: ['@ess', '@serverless'] }, () => {
describe('Events Viewer', { tags: ['@ess', '@serverless', '@serverlessQA'] }, () => {
before(() => {
cy.task('esArchiverLoad', { archiveName: 'auditbeat_multiple' });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,69 +24,64 @@ import { postDataView } from '../../../tasks/api_calls/common';

const DATA_VIEW = 'auditbeat-*';

// FLAKY: https://github.com/elastic/kibana/issues/178367
describe.skip(
'Inspect Explore pages',
{ tags: ['@ess', '@serverless', '@skipInServerlessMKI'] },
() => {
before(() => {
// illegal_argument_exception: unknown setting [index.lifecycle.name]
cy.task('esArchiverLoad', { archiveName: 'risk_users' });
cy.task('esArchiverLoad', { archiveName: 'risk_hosts' });
describe('Inspect Explore pages', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
// illegal_argument_exception: unknown setting [index.lifecycle.name]
cy.task('esArchiverLoad', { archiveName: 'risk_users' });
cy.task('esArchiverLoad', { archiveName: 'risk_hosts' });

login();
// Create and select data view
postDataView(DATA_VIEW);
});
login();
// Create and select data view
postDataView(DATA_VIEW);
});

after(() => {
cy.task('esArchiverUnload', { archiveName: 'risk_users' });
cy.task('esArchiverUnload', { archiveName: 'risk_hosts' });
});
after(() => {
cy.task('esArchiverUnload', { archiveName: 'risk_users' });
cy.task('esArchiverUnload', { archiveName: 'risk_hosts' });
});

INSPECT_BUTTONS_IN_SECURITY.forEach(({ pageName, url, lensVisualizations, tables }) => {
/**
* Group all tests of a page into one "it" call to improve speed
*/
it(`inspect ${pageName} page`, () => {
login();
INSPECT_BUTTONS_IN_SECURITY.forEach(({ pageName, url, lensVisualizations, tables }) => {
/**
* Group all tests of a page into one "it" call to improve speed
*/
it(`inspect ${pageName} page`, () => {
login();

visitWithTimeRange(url, {
visitOptions: {
onLoad: () => {
waitForWelcomePanelToBeLoaded();
selectDataView(DATA_VIEW);
},
visitWithTimeRange(url, {
visitOptions: {
onLoad: () => {
waitForWelcomePanelToBeLoaded();
selectDataView(DATA_VIEW);
},
});

lensVisualizations.forEach((lens) => {
cy.log(`inspects the ${lens.title} visualization`);
openTab(lens.tab);

openLensVisualizationsInspectModal(lens, () => {
cy.get(INSPECT_MODAL).should('be.visible');
cy.get(INSPECT_MODAL_INDEX_PATTERN).should(
'contain.text',
lens.customIndexPattern ? lens.customIndexPattern : DATA_VIEW
);
});
});
},
});

tables.forEach((table) => {
cy.log(`inspects the ${table.title}`);
openTab(table.tab);
lensVisualizations.forEach((lens) => {
cy.log(`inspects the ${lens.title} visualization`);
openTab(lens.tab);

openTableInspectModal(table);
openLensVisualizationsInspectModal(lens, () => {
cy.get(INSPECT_MODAL).should('be.visible');
cy.get(INSPECT_MODAL_INDEX_PATTERN).should(
'contain.text',
table.customIndexPattern ? table.customIndexPattern : DATA_VIEW
lens.customIndexPattern ? lens.customIndexPattern : DATA_VIEW
);

closesModal();
});
});

tables.forEach((table) => {
cy.log(`inspects the ${table.title}`);
openTab(table.tab);

openTableInspectModal(table);
cy.get(INSPECT_MODAL).should('be.visible');
cy.get(INSPECT_MODAL_INDEX_PATTERN).should(
'contain.text',
table.customIndexPattern ? table.customIndexPattern : DATA_VIEW
);

closesModal();
});
});
}
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe('Kibana navigation to all pages in the Security app ', { tags: '@ess' }
});
});

describe('Serverless side navigation links', { tags: '@serverless' }, () => {
describe('Serverless side navigation links', { tags: ['@serverless', '@serverlessQA'] }, () => {
beforeEach(() => {
login();
visitGetStartedPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
fillAddFilterForm,
openKqlQueryBar,
fillKqlQueryBar,
waitForSavedQueryLoaded,
} from '../../../tasks/search_bar';
import {
AUTO_SUGGEST_AGENT_NAME,
Expand All @@ -22,13 +23,15 @@ import { getHostIpFilter } from '../../../objects/filter';

import { hostsUrl } from '../../../urls/navigation';
import { waitForAllHostsToBeLoaded } from '../../../tasks/hosts/all_hosts';
import { waitForPageToBeLoaded } from '../../../tasks/common';

// Failing: See https://github.com/elastic/kibana/issues/182932
describe.skip('SearchBar', { tags: ['@ess', '@serverless'] }, () => {
describe('SearchBar', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
login();
visitWithTimeRange(hostsUrl('allHosts'));
waitForAllHostsToBeLoaded();
waitForPageToBeLoaded();
waitForSavedQueryLoaded();
});

it('adds correctly a filter to the global search bar', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { openTimelineUsingToggle } from '../../../tasks/security_main';

const testDomain = 'myTest';

describe('Hover actions', { tags: ['@ess', '@serverless'] }, () => {
describe('Hover actions', { tags: ['@ess', '@serverless', '@serverlessQA'] }, () => {
const onBeforeLoadCallback = (win: Cypress.AUTWindow) => {
// avoid cypress being held by windows prompt and timeout
cy.stub(win, 'prompt').returns(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getTimeline } from '../../../objects/timeline';

const mockTimeline = getTimeline();

describe('Overview Page', { tags: ['@ess', '@serverless'] }, () => {
describe('Overview Page', { tags: ['@ess', '@serverless', '@serverlessQA'] }, () => {
before(() => {
cy.task('esArchiverLoad', { archiveName: 'overview' });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import { ALL_HOSTS_TABLE } from '../../../screens/hosts/all_hosts';
import { ALL_USERS_TABLE } from '../../../screens/users/all_users';
import { goToTablePage, sortFirstTableColumn } from '../../../tasks/table_pagination';

// FLAKY: https://github.com/elastic/kibana/issues/165968
describe('Pagination', { tags: ['@ess', '@serverless'] }, () => {
describe('Pagination', { tags: ['@ess', '@serverless', '@serverlessQA'] }, () => {
describe('Host uncommon processes table)', () => {
before(() => {
cy.task('esArchiverLoad', { archiveName: 'host_uncommon_processes' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { visitUserDetailsPage, visitWithTimeRange } from '../../../tasks/navigat
import { usersUrl } from '../../../urls/navigation';
import { waitForTabToBeLoaded } from '../../../tasks/common';

describe('Users stats and tables', { tags: ['@ess', '@serverless'] }, () => {
describe('Users stats and tables', { tags: ['@ess', '@serverless', '@serverlessQA'] }, () => {
before(() => {
cy.task('esArchiverLoad', { archiveName: 'users' });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,25 +238,25 @@ export const INSPECT_BUTTONS_IN_SECURITY: InspectButtonMetadata[] = [
{
title: 'User authentications',
panelSelector: AUTHENTICATION_VISUALIZATION,
embeddableId: 'usersKpiAuthenticationsQuery-authenticationsSuccess-metric-embeddable',
embeddableId: 'usersKpiAuthentications-authenticationsSuccess-metric-embeddable',
tab: ALL_USERS_TAB,
},
{
title: 'User authentications',
panelSelector: AUTHENTICATION_VISUALIZATION,
embeddableId: 'usersKpiAuthenticationsQuery-authenticationsFailure-metric-embeddable',
embeddableId: 'usersKpiAuthentications-authenticationsFailure-metric-embeddable',
tab: ALL_USERS_TAB,
},
{
title: 'User authentications',
panelSelector: AUTHENTICATION_VISUALIZATION,
embeddableId: 'usersKpiAuthenticationsQuery-bar-embeddable',
embeddableId: 'usersKpiAuthentications-bar-embeddable',
tab: ALL_USERS_TAB,
},
{
title: 'User authentications',
panelSelector: AUTHENTICATION_VISUALIZATION,
embeddableId: 'usersKpiAuthenticationsQuery-area-embeddable',
embeddableId: 'usersKpiAuthentications-area-embeddable',
tab: ALL_USERS_TAB,
},
{
Expand Down
6 changes: 6 additions & 0 deletions x-pack/test/security_solution_cypress/cypress/tasks/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { recurse } from 'cypress-recurse';
import { KIBANA_LOADING_ICON } from '../screens/security_header';
import { EUI_BASIC_TABLE_LOADING } from '../screens/common/controls';
import { PAGE_CONTENT_SPINNER } from '../screens/common/page';

const primaryButton = 0;

Expand Down Expand Up @@ -92,3 +93,8 @@ export const waitForTabToBeLoaded = (tabId: string) => {
}
);
};

export const waitForPageToBeLoaded = () => {
cy.get(PAGE_CONTENT_SPINNER).should('be.visible');
cy.get(PAGE_CONTENT_SPINNER).should('not.exist');
};
23 changes: 11 additions & 12 deletions x-pack/test/security_solution_cypress/cypress/tasks/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,20 @@ export const openLensVisualizationsInspectModal = (
{ panelSelector, embeddableId, tab }: InspectLensVisualizationsMetadata,
onOpen: () => void
) => {
cy.get(panelSelector)
.get(`[data-test-embeddable-id="${embeddableId}"]`)
.each(($el) => {
// wait for visualization to load
if ($el.find(LOADER_ARIA).length > 0) {
cy.get(LOADER_ARIA).should('not.exist');
}
cy.get(`${panelSelector} [data-test-embeddable-id="${embeddableId}"]`).within(($el) => {
// wait for visualization to load
if ($el.find(LOADER_ARIA).length > 0) {
cy.get(LOADER_ARIA).should('not.exist');
}

cy.wrap($el).get(EMBEDDABLE_PANEL_TOGGLE_ICON).click();
});

cy.wrap($el).find(EMBEDDABLE_PANEL_TOGGLE_ICON).click();
cy.get(EMBEDDABLE_PANEL_INSPECT).click();
cy.get(EMBEDDABLE_PANEL_INSPECT).click();

onOpen();
onOpen();

closesModal();
});
closesModal();
};

export const openTab = (tab: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
EDIT_AS_QUERY_DSL,
KIBANA_CODE_EDITOR,
} from '../screens/search_bar';
import { LOADING_INDICATOR } from '../screens/security_header';

export const openAddFilterPopover = () => {
cy.get(GLOBAL_SEARCH_BAR_SUBMIT_BUTTON).should('be.enabled');
Expand Down Expand Up @@ -86,3 +87,7 @@ export const fillAddFilterFormAsQueryDSL = (query: string) => {
cy.get(ADD_FILTER_FORM_SAVE_BUTTON).click();
cy.get(ADD_FILTER_FORM_SAVE_BUTTON).should('not.exist');
};

export const waitForSavedQueryLoaded = () => {
cy.get(LOADING_INDICATOR).should('not.exist');
};