Skip to content

Commit 918840b

Browse files
opensearch-trigger-bot[bot]sejli
authored andcommitted
[2.13] Switch to Private Tenant for Gantt Charts Tests (opensearch-project#1195) (opensearch-project#1196)
* trying on 2.13 Signed-off-by: Sean Li <lnse@amazon.com> * adding a should when searching for visualization Signed-off-by: Sean Li <lnse@amazon.com> * specifying which row to click Signed-off-by: Sean Li <lnse@amazon.com> * adding wait for request Signed-off-by: Sean Li <lnse@amazon.com> * remove force click Signed-off-by: Sean Li <lnse@amazon.com> * add hardcoded wait Signed-off-by: Sean Li <lnse@amazon.com> * add another wait Signed-off-by: Sean Li <lnse@amazon.com> * add default private tenant Signed-off-by: Sean Li <lnse@amazon.com> * add kibana refresh Signed-off-by: Sean Li <lnse@amazon.com> * uncommenting Signed-off-by: Sean Li <lnse@amazon.com> * remove wait for request Signed-off-by: Sean Li <lnse@amazon.com> --------- Signed-off-by: Sean Li <lnse@amazon.com> (cherry picked from commit e3105d6) Co-authored-by: Sean Li <lnse@amazon.com>
1 parent 4ddb898 commit 918840b

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js

+24-15
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import customParseFormat from 'dayjs/plugin/customParseFormat';
99
import dayjs from 'dayjs';
1010
import { BASE_PATH } from '../../../utils/constants';
1111
import { CURRENT_TENANT } from '../../../utils/commands';
12+
import { devToolsRequest } from '../../../utils/helpers';
1213

1314
dayjs.extend(customParseFormat);
1415

@@ -20,7 +21,15 @@ const DEFAULT_SIZE = 10;
2021

2122
describe('Dump test data', () => {
2223
it('Indexes test data for gantt chart', () => {
23-
CURRENT_TENANT.newTenant = 'global';
24+
if (Cypress.env('SECURITY_ENABLED')) {
25+
// Set default tenant to private to avoid tenant popup
26+
cy.changeDefaultTenant({
27+
multitenancy_enabled: true,
28+
private_tenant_enabled: true,
29+
default_tenant: 'private',
30+
});
31+
}
32+
CURRENT_TENANT.newTenant = 'private';
2433
const dumpDataSet = (ndjson, index) =>
2534
cy.request({
2635
method: 'POST',
@@ -52,13 +61,11 @@ describe('Dump test data', () => {
5261
},
5362
body: JSON.stringify({ attributes: { title: 'jaeger' } }),
5463
});
64+
devToolsRequest('.kibana*/_refresh', 'POST');
5565
});
5666
});
5767

5868
describe('Save a gantt chart', { defaultCommandTimeout: 20000 }, () => {
59-
before(() => {
60-
CURRENT_TENANT.newTenant = 'global';
61-
});
6269
beforeEach(() => {
6370
cy.visit(`${BASE_PATH}/app/visualize#`);
6471
});
@@ -83,13 +90,18 @@ describe(
8390
'Render and configure a gantt chart',
8491
{ defaultCommandTimeout: 20000 },
8592
() => {
86-
before(() => {
87-
CURRENT_TENANT.newTenant = 'global';
88-
});
8993
beforeEach(() => {
94+
CURRENT_TENANT.newTenant = 'private';
9095
cy.visit(`${BASE_PATH}/app/visualize#`);
96+
cy.intercept('**').as('searchRequest');
9197
cy.get('.euiFieldSearch').focus().type(GANTT_VIS_NAME);
92-
cy.contains(GANTT_VIS_NAME).click({ force: true });
98+
cy.wait('@searchRequest');
99+
cy.wait(5000);
100+
cy.get('[data-test-subj="itemsInMemTable"]')
101+
.contains(GANTT_VIS_NAME)
102+
.click({
103+
force: true,
104+
});
93105
});
94106

95107
it('Renders no data message', () => {
@@ -125,13 +137,13 @@ describe(
125137
);
126138

127139
describe('Configure panel settings', { defaultCommandTimeout: 20000 }, () => {
128-
before(() => {
129-
CURRENT_TENANT.newTenant = 'global';
130-
});
131140
beforeEach(() => {
132141
cy.visit(`${BASE_PATH}/app/visualize#`);
142+
cy.intercept('**').as('searchRequest');
133143
cy.get('.euiFieldSearch').focus().type(GANTT_VIS_NAME);
134-
cy.contains(GANTT_VIS_NAME).click({ force: true });
144+
cy.wait('@searchRequest');
145+
cy.wait(5000);
146+
cy.contains(GANTT_VIS_NAME).should('exist').click();
135147
cy.contains('Panel settings').click({ force: true });
136148
});
137149

@@ -251,9 +263,6 @@ describe(
251263
'Add gantt chart to dashboard',
252264
{ defaultCommandTimeout: 20000 },
253265
() => {
254-
before(() => {
255-
CURRENT_TENANT.newTenant = 'global';
256-
});
257266
it('Adds gantt chart to dashboard', () => {
258267
cy.visit(`${BASE_PATH}/app/dashboards#/create`);
259268
cy.contains('Add an existing').click({ force: true });

0 commit comments

Comments
 (0)