Skip to content

Commit

Permalink
Revert "[Discover] toggle for legacy mode (opensearch-project#1148)" (o…
Browse files Browse the repository at this point in the history
…pensearch-project#1153)

This reverts commit 861f8b2.

Signed-off-by: Kawika Avilla <avillk@amazon.com>
Co-authored-by: Kawika Avilla <avillk@amazon.com>
  • Loading branch information
kavilla and Kawika Avilla authored Mar 18, 2024
1 parent 861f8b2 commit e36352b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ describe('date_nanos', () => {
});
miscUtils.visitPage('app/data-explorer/discover#/');
cy.waitForLoader();
cy.switchDiscoverTable('new');

cy.setTopNavDate(fromTime, toTime);
cy.waitForSearch();
cy.switchDiscoverTable('new');
});

after(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ describe('date_nanos_mixed', () => {
});
miscUtils.visitPage('app/data-explorer/discover#/');
cy.waitForLoader();
cy.switchDiscoverTable('new');

const fromTime = 'Jan 1, 2019 @ 00:00:00.000';
const toTime = 'Jan 1, 2019 @ 23:59:59.999';
cy.setTopNavDate(fromTime, toTime);
cy.waitForSearch();
cy.switchDiscoverTable('new');
});

after(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ describe('discover app', { scrollBehavior: false }, () => {
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForLoader();
cy.waitForSearch();
cy.switchDiscoverTable('new');
cy.waitForSearch();
});

after(() => {});

describe('save search', () => {
const saveSearch1 = 'Save Search # 1';
const saveSearch2 = 'Modified Save Search # 1';
beforeEach(() => {
cy.switchDiscoverTable('new');
});

it('should show correct time range string by timepicker', function () {
cy.verifyTimeConfig(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ describe('discover tab', () => {
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForLoader();
cy.waitForSearch();
cy.switchDiscoverTable('new');
cy.waitForSearch();
});

after(() => {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ describe('index pattern with encoded id', () => {

// Go to the Discover page
miscUtils.visitPage('app/data-explorer/discover#/');
cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
cy.switchDiscoverTable('new');
cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
cy.waitForLoader();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('index pattern without field spec', () => {
// Go to the Discover page
miscUtils.visitPage('app/data-explorer/discover#/');
cy.waitForLoader();
cy.switchDiscoverTable('new');
});

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

it('should display a timepicker after switching to an index pattern with timefield', () => {
const indexName = 'with-timefield';
cy.switchDiscoverTable('new');
cy.getElementByTestId('comboBoxToggleListButton')
.should('be.visible')
.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ describe.skip('saved queries saved objects', () => {
// Go to the Discover page
miscUtils.visitPage('app/data-explorer/discover#/');
cy.waitForLoader();
cy.switchDiscoverTable('new');

// Set time filter
cy.setTopNavDate(fromTime, toTime);
cy.switchDiscoverTable('new');

// Set up query and filter
cy.setTopNavQuery('response:200');
Expand Down
25 changes: 10 additions & 15 deletions cypress/utils/dashboards/data_explorer/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,17 @@ Cypress.Commands.add('deleteSaveQuery', (name) => {
});

Cypress.Commands.add('switchDiscoverTable', (name) => {
cy.getElementByTestId('discoverOptionsButton')
cy.getElementByTestId('datagridTableButton')
.then(($button) => {
cy.wrap($button).click();

cy.getElementByTestId('discoverOptionsLegacySwitch').then(
($switchButton) => {
const isLegacyChecked = $switchButton.checked;
if (name === 'new' && !isLegacyChecked) {
cy.wrap($switchButton).click();
}
if (name === 'legacy' && isLegacyChecked) {
cy.wrap($switchButton).click();
}
cy.waitForLoader();
}
);
const buttonText = $button.text();

if (name === 'new' && buttonText.includes('Try new Discover')) {
cy.wrap($button).click();
}
if (name === 'legacy' && buttonText.includes('Use legacy Discover')) {
cy.wrap($button).click();
}
cy.waitForLoader();
})
.then(() => {
checkForElementVisibility();
Expand Down

0 comments on commit e36352b

Please sign in to comment.