From 72f9411dbda83c0adadc873d056df772d5ee94af Mon Sep 17 00:00:00 2001 From: joshhunt Date: Wed, 5 Jun 2024 11:28:01 +0100 Subject: [PATCH] an extra test --- e2e/various-suite/keybinds.spec.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/e2e/various-suite/keybinds.spec.ts b/e2e/various-suite/keybinds.spec.ts index ebcdbf41bd5..740061d9e7f 100644 --- a/e2e/various-suite/keybinds.spec.ts +++ b/e2e/various-suite/keybinds.spec.ts @@ -26,6 +26,24 @@ describe('Keyboard shortcuts', options, () => { e2e.components.Panels.Panel.title('Latest from the blog').should('be.visible'); }); + it('ctrl+z should zoom out the time range', options, () => { + 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'); + cy.wait(500); // waiting is anti-pattern, but it's inconsistent for me locally without this + + cy.get('body').type('{ctrl}z'); + let expectedRange = `Time range selected: 2024-06-05 10:03:30 to 2024-06-05 10:07:30`; + e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange); + }); + it('multiple time range shortcuts should work', options, () => { cy.get('body').type('ge'); e2e.pages.Explore.General.container().should('be.visible');