polish e2e tests, remove console.log

This commit is contained in:
joshhunt
2024-06-06 11:10:40 +01:00
parent fce1527a5e
commit b47b3da86b
2 changed files with 5 additions and 39 deletions
+5 -38
View File
@@ -26,7 +26,7 @@ describe('Keyboard shortcuts', options, () => {
e2e.components.Panels.Panel.title('Latest from the blog').should('be.visible');
});
it.only('a single time range shortcut should work', () => {
it('multiple time range shortcuts should work', options, () => {
cy.get('body').type('ge');
e2e.pages.Explore.General.container().should('be.visible');
@@ -36,58 +36,25 @@ describe('Keyboard shortcuts', options, () => {
to: '2024-06-05 10:06:00',
zone: 'Browser',
});
e2e.components.TimePicker.fromField()
.should('not.exist')
.then(() => {
console.log('asserted closed');
});
e2e.components.TimePicker.fromField().should('not.exist');
cy.wait(500); // waiting is anti-pattern, but it's inconsistent for me locally without this
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');
// 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);
cy.log('Trying two shift-lefts');
cy.get('body').type('t{leftarrow}');
cy.wait(500);
cy.get('body').type('t{leftarrow}');
cy.wait(500);
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 three shift-lefts');
cy.log('Trying two shift-lefts and a shift-right');
cy.get('body').type('t{leftarrow}');
cy.wait(500);
cy.get('body').type('t{leftarrow}');
cy.wait(500);
cy.get('body').type('t{rightarrow}');
cy.wait(500);
expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 1 min back in total
expectedRange = `Time range selected: 2024-06-05 10:01:00 to 2024-06-05 10:02:00`; // 2 mins back, 1 min forward (1 min back total)
e2e.components.TimePicker.openButton().should('have.attr', 'aria-label', expectedRange);
});
});
@@ -588,7 +588,6 @@ export class Mousetrap {
* handles a character key event
*/
private _handleKey = (character: string, modifiers: string[], e: KeyboardEvent) => {
console.log('_handleKey', e.type, character);
let callbacks = this._getMatches(character, modifiers, e);
let i;
let doNotReset: Record<string, number> = {};