-
Notifications
You must be signed in to change notification settings - Fork 8k
/
inspect_button.cy.ts
80 lines (69 loc) · 2.27 KB
/
inspect_button.cy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import {
INSPECT_BUTTONS_IN_SECURITY,
INSPECT_MODAL,
INSPECT_MODAL_INDEX_PATTERN,
} from '../../screens/inspect';
import {
closesModal,
openLensVisualizationsInspectModal,
openTab,
openTableInspectModal,
} from '../../tasks/inspect';
import { login, visit } from '../../tasks/login';
import { HOSTS_URL } from '../../urls/navigation';
import { postDataView, waitForPageToBeLoaded } from '../../tasks/common';
import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver';
import { selectDataView } from '../../tasks/sourcerer';
const DATA_VIEW = 'auditbeat-*';
describe('Inspect Explore pages', () => {
before(() => {
esArchiverLoad('risk_users');
esArchiverLoad('risk_hosts');
login();
// Create and select data view
postDataView(DATA_VIEW);
visit(HOSTS_URL);
selectDataView(DATA_VIEW);
});
after(() => {
esArchiverUnload('risk_users');
esArchiverUnload('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`, () => {
visit(url);
waitForPageToBeLoaded();
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);
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();
});
});
});
});