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

[SecuritySolution] Fix inspect_button cypress #158543

Merged
merged 28 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
72201b8
fix cypress
angorayc May 26, 2023
5f69373
isolate waiting for welcome panel
angorayc May 26, 2023
e63628f
Merge branch 'main' into issue-153765
angorayc May 30, 2023
47d07a2
Merge branch 'main' of github.com:elastic/kibana into issue-153765
angorayc May 31, 2023
e825c39
Merge branch 'main' into issue-153765
angorayc May 31, 2023
bcfa992
Merge branch 'main' into issue-153765
angorayc May 31, 2023
4709aa7
Merge branch 'main' into issue-153765
angorayc Jun 1, 2023
e3a2a3c
Merge branch 'main' into issue-153765
angorayc Jun 1, 2023
a408a04
Merge branch 'main' into issue-153765
angorayc Jun 2, 2023
14e29fd
Merge branch 'main' into issue-153765
angorayc Jun 5, 2023
d8dadbc
Merge branch 'main' into issue-153765
angorayc Jun 5, 2023
d0a7a46
Merge branch 'main' into issue-153765
angorayc Jun 5, 2023
33449c7
put back select data view
angorayc Jun 7, 2023
892af85
revert
angorayc Jun 7, 2023
dba70b5
revert
angorayc Jun 8, 2023
7bc79c9
Merge branch 'main' into issue-153765
angorayc Jun 8, 2023
36a256d
Merge branch 'main' into issue-153765
angorayc Jun 8, 2023
fcfefa0
Merge branch 'main' into issue-153765
angorayc Jun 12, 2023
356ef27
Merge branch 'main' into issue-153765
angorayc Jun 12, 2023
f8e20e2
Merge branch 'main' into issue-153765
angorayc Jun 13, 2023
0f6db6d
Merge branch 'main' of github.com:elastic/kibana into issue-153765
angorayc Jun 14, 2023
dd20e8d
update task
angorayc Jun 14, 2023
fd5926c
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jun 14, 2023
497835f
update post data view
angorayc Jun 14, 2023
b2c18d8
Merge branch 'issue-153765' of github.com:angorayc/kibana into issue-…
angorayc Jun 14, 2023
66f6a1b
Merge branch 'main' into issue-153765
angorayc Jun 14, 2023
72122fd
Merge branch 'main' into issue-153765
angorayc Jun 14, 2023
4e6eb19
rm auditbeat
angorayc Jun 15, 2023
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 @@ -17,8 +17,11 @@ import {
openTableInspectModal,
} from '../../tasks/inspect';
import { login, visit } from '../../tasks/login';
import { HOSTS_URL } from '../../urls/navigation';
import { postDataView, waitForPageToBeLoaded } from '../../tasks/common';
import {
postDataView,
waitForPageToBeLoaded,
waitForWelcomePanelToBeLoaded,
} from '../../tasks/common';
import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver';
import { selectDataView } from '../../tasks/sourcerer';

Expand All @@ -28,12 +31,10 @@ describe('Inspect Explore pages', () => {
before(() => {
esArchiverLoad('risk_users');
esArchiverLoad('risk_hosts');
login();

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

after(() => {
Expand All @@ -47,8 +48,14 @@ describe('Inspect Explore pages', () => {
*/
it(`inspect ${pageName} page`, () => {
login();
visit(url);
waitForPageToBeLoaded();

visit(url, {
onLoad: () => {
waitForWelcomePanelToBeLoaded();
waitForPageToBeLoaded();
selectDataView(DATA_VIEW);
},
});

lensVisualizations.forEach((lens) => {
cy.log(`inspects the ${lens.title} visualization`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export const REFRESH_BUTTON = '[data-test-subj="querySubmitButton"]';
export const LOADING_INDICATOR = '[data-test-subj="globalLoadingIndicator"]';
export const LOADING_INDICATOR_HIDDEN = '[data-test-subj="globalLoadingIndicator-hidden"]';

export const KIBANA_LOADING_ICON = '[data-test-subj="kbnLoadingMessage"]';

// opens the navigation panel for a given nested link
export const openNavigationPanelFor = (page: string) => {
let panel;
Expand Down
24 changes: 19 additions & 5 deletions x-pack/plugins/security_solution/cypress/tasks/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
* 2.0.
*/

import { LOADING_INDICATOR, LOADING_INDICATOR_HIDDEN } from '../screens/security_header';
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { DATA_VIEW_PATH, INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants';
import {
LOADING_INDICATOR,
LOADING_INDICATOR_HIDDEN,
KIBANA_LOADING_ICON,
} from '../screens/security_header';

const primaryButton = 0;

Expand Down Expand Up @@ -215,17 +221,20 @@ export const deleteConnectors = () => {
export const postDataView = (dataSource: string) => {
rootRequest({
method: 'POST',
url: `/api/index_patterns/index_pattern`,
url: DATA_VIEW_PATH,
body: {
index_pattern: {
data_view: {
id: dataSource,
name: dataSource,
fieldAttrs: '{}',
title: dataSource,
timeFieldName: '@timestamp',
fields: '{}',
},
},
headers: { 'kbn-xsrf': 'cypress-creds-via-config' },
headers: {
'kbn-xsrf': 'cypress-creds-via-config',
[ELASTIC_HTTP_VERSION_HEADER]: [INITIAL_REST_VERSION],
},
failOnStatusCode: false,
});
};
Expand All @@ -245,3 +254,8 @@ export const waitForPageToBeLoaded = () => {
cy.get(LOADING_INDICATOR_HIDDEN).should('exist');
cy.get(LOADING_INDICATOR).should('not.exist');
};

export const waitForWelcomePanelToBeLoaded = () => {
cy.get(KIBANA_LOADING_ICON).should('exist');
cy.get(KIBANA_LOADING_ICON).should('not.exist');
};
3 changes: 3 additions & 0 deletions x-pack/plugins/security_solution/cypress/tasks/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ export const visit = (url: string, options: Partial<Cypress.VisitOptions> = {},

disableNewFeaturesTours(win);
},
onLoad: (win) => {
options.onLoad?.(win);
},
});
waitForPageToBeLoaded();
};
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/security_solution/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@kbn/securitysolution-data-table",
"@kbn/cases-plugin",
"@kbn/data-plugin",
"@kbn/core-http-common"
"@kbn/core-http-common",
"@kbn/data-views-plugin"
]
}