diff --git a/e2e/various-suite/keybinds.spec.ts b/e2e/various-suite/keybinds.spec.ts index 3592bad526a..2a01c4ded58 100644 --- a/e2e/various-suite/keybinds.spec.ts +++ b/e2e/various-suite/keybinds.spec.ts @@ -26,7 +26,31 @@ describe('Keyboard shortcuts', options, () => { e2e.components.Panels.Panel.title('Latest from the blog').should('be.visible'); }); - it.only('time range shortcuts should work', options, async () => { + it.only('a single time range shortcut should work', () => { + cy.get('body').type('ge'); + e2e.pages.Explore.General.container().should('be.visible'); + + // Time range is 1 minute, so each shortcut press should jump back or forward by 1 minute + e2e.flows.setTimeRange({ + from: '2024-06-05 10:05:00', + to: '2024-06-05 10:06:00', + zone: 'Browser', + }); + + e2e.components.TimePicker.fromField() + .should('not.exist') + .then(() => { + console.log('asserted closed'); + }); + + cy.log('Trying one shift-left'); + cy.get('body').type('t{leftarrow}'); + cy.wait(500); + let 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); + }); + + it.skip('multiple time range shortcuts should work', options, async () => { cy.get('body').type('ge'); e2e.pages.Explore.General.container().should('be.visible'); @@ -42,13 +66,13 @@ describe('Keyboard shortcuts', options, () => { console.log('asserted closed'); }); - cy.log('One shortcut'); + cy.log('Trying one shift-left'); cy.get('body').type('t{leftarrow}'); cy.wait(500); let 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('Two shortcuts'); + cy.log('Trying two shift-lefts'); cy.get('body').type('t{leftarrow}'); cy.wait(500); cy.get('body').type('t{leftarrow}'); @@ -56,7 +80,7 @@ describe('Keyboard shortcuts', options, () => { 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('Three shortcuts'); + cy.log('Trying three shift-lefts'); cy.get('body').type('t{leftarrow}'); cy.wait(500); cy.get('body').type('t{leftarrow}');