Skip to content

Commit

Permalink
[Discover] toggle for legacy mode
Browse files Browse the repository at this point in the history
Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
Kawika Avilla committed Mar 16, 2024
1 parent 736a788 commit cac7031
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cypress/utils/dashboards/data_explorer/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,18 @@ Cypress.Commands.add('deleteSaveQuery', (name) => {
});

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

if (name === 'new' && buttonText.includes('Try new Discover')) {
cy.wrap($button).click();
const switchButton = await cy.getElementByTestId('discoverOptionsLegacySwitch');
const isLegacyChecked = (await cy.wrap(switchButton).getAttribute('aria-checked')) === 'true';

if (name === 'new' && isLegacyChecked) {
cy.wrap(switchButton).click();
}
if (name === 'legacy' && buttonText.includes('Use legacy Discover')) {
cy.wrap($button).click();
if (name === 'legacy' && !isLegacyChecked) {
cy.wrap(switchButton).click();
}
cy.waitForLoader();
})
Expand Down

0 comments on commit cac7031

Please sign in to comment.