Skip to content

Commit 6ec9632

Browse files
author
Kawika Avilla
committed
remove async
Signed-off-by: Kawika Avilla <avillk@amazon.com>
1 parent cac7031 commit 6ec9632

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos_mixed.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ describe('date_nanos_mixed', () => {
3131
});
3232
miscUtils.visitPage('app/data-explorer/discover#/');
3333
cy.waitForLoader();
34-
cy.switchDiscoverTable('new');
3534

3635
const fromTime = 'Jan 1, 2019 @ 00:00:00.000';
3736
const toTime = 'Jan 1, 2019 @ 23:59:59.999';
3837
cy.setTopNavDate(fromTime, toTime);
3938
cy.waitForSearch();
39+
cy.switchDiscoverTable('new');
4040
});
4141

4242
after(() => {

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_with_encoded_id.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ describe('index pattern with encoded id', () => {
3636

3737
// Go to the Discover page
3838
miscUtils.visitPage('app/data-explorer/discover#/');
39-
cy.switchDiscoverTable('new');
4039
cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
40+
cy.switchDiscoverTable('new');
4141
cy.waitForLoader();
4242
});
4343

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_without_field.spec.js

-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ describe('index pattern without field spec', () => {
3333
// Go to the Discover page
3434
miscUtils.visitPage('app/data-explorer/discover#/');
3535
cy.waitForLoader();
36-
cy.switchDiscoverTable('new');
3736
});
3837

3938
after(() => {
@@ -50,7 +49,6 @@ describe('index pattern without field spec', () => {
5049

5150
it('should display a timepicker after switching to an index pattern with timefield', () => {
5251
const indexName = 'with-timefield';
53-
cy.switchDiscoverTable('new');
5452
cy.getElementByTestId('comboBoxToggleListButton')
5553
.should('be.visible')
5654
.click();

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/saved_queries.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ describe.skip('saved queries saved objects', () => {
5151
// Go to the Discover page
5252
miscUtils.visitPage('app/data-explorer/discover#/');
5353
cy.waitForLoader();
54-
cy.switchDiscoverTable('new');
5554

5655
// Set time filter
5756
cy.setTopNavDate(fromTime, toTime);
57+
cy.switchDiscoverTable('new');
5858

5959
// Set up query and filter
6060
cy.setTopNavQuery('response:200');

cypress/utils/dashboards/data_explorer/commands.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,21 @@ Cypress.Commands.add('deleteSaveQuery', (name) => {
136136

137137
Cypress.Commands.add('switchDiscoverTable', (name) => {
138138
cy.getElementByTestId('discoverOptionsButton')
139-
.then(async ($button) => {
140-
await cy.wrap($button).click();
141-
142-
const switchButton = await cy.getElementByTestId('discoverOptionsLegacySwitch');
143-
const isLegacyChecked = (await cy.wrap(switchButton).getAttribute('aria-checked')) === 'true';
144-
145-
if (name === 'new' && isLegacyChecked) {
146-
cy.wrap(switchButton).click();
147-
}
148-
if (name === 'legacy' && !isLegacyChecked) {
149-
cy.wrap(switchButton).click();
150-
}
151-
cy.waitForLoader();
139+
.then(($button) => {
140+
cy.wrap($button).click();
141+
142+
cy.getElementByTestId('discoverOptionsLegacySwitch').then(
143+
($switchButton) => {
144+
const isLegacyChecked = $switchButton.checked;
145+
if (name === 'new' && isLegacyChecked) {
146+
cy.wrap($switchButton).click();
147+
}
148+
if (name === 'legacy' && !isLegacyChecked) {
149+
cy.wrap($switchButton).click();
150+
}
151+
cy.waitForLoader();
152+
}
153+
);
152154
})
153155
.then(() => {
154156
checkForElementVisibility();

0 commit comments

Comments
 (0)