Try waiting for query to finish before eval

This commit is contained in:
Kristina Durivage 2024-06-25 12:50:47 -05:00
parent 07d4157658
commit 6220cabd17

View File

@ -43,6 +43,7 @@ describe('Keyboard shortcuts', () => {
});
it('multiple time range shortcuts should work', () => {
cy.intercept('api/ds/query*').as('runQuery');
cy.get('body').type('ge');
e2e.pages.Explore.General.container().should('be.visible');
@ -58,30 +59,36 @@ describe('Keyboard shortcuts', () => {
cy.log('Trying one shift-left');
cy.get('body').type('t{leftarrow}');
cy.wait('@runQuery');
e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query');
expectedRange = `Time range selected: 2024-06-05 10:04:00 to 2024-06-05 10:05:00`; // 1 min back
e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange);
cy.log('Trying two shift-lefts');
cy.get('body').type('t{leftarrow}');
cy.wait('@runQuery');
e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query');
expectedRange = `Time range selected: 2024-06-05 10:03:00 to 2024-06-05 10:04:00`; // 1 min back
e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange);
cy.get('body').type('t{leftarrow}');
cy.wait('@runQuery');
e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query');
expectedRange = `Time range selected: 2024-06-05 10:02:00 to 2024-06-05 10:03:00`; // 2 mins back
e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange);
cy.log('Trying two shift-lefts and a shift-right');
cy.get('body').type('t{leftarrow}');
cy.wait('@runQuery');
e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query');
expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 1 min back
e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange);
cy.get('body').type('t{leftarrow}');
cy.wait('@runQuery');
e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query');
expectedRange = `Time range selected: 2024-06-05 10:00:00 to 2024-06-05 10:01:00`; // 2 mins back
e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange);
cy.get('body').type('t{rightarrow}');
cy.wait('@runQuery');
e2e.components.RefreshPicker.runButtonV2().should('have.text', 'Run query');
expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 1 min forward (1 min back total)
e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange);