From cb6abe343b2d26d0973f7b06177a4d6118cbd9ea Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 10 Sep 2019 22:16:26 -0700 Subject: [PATCH] fix: attempt to fix the flaky SQL Lab test (#8212) * fix: attempt to fix the flaky SQL Lab test https://docs.cypress.io/api/commands/clear.html#Syntax doubling our chances to selectall and clear the text box * Add {force: true} * fix typo * more clears --- .../assets/cypress/integration/dashboard/controls.js | 2 +- superset/assets/cypress/integration/sqllab/query.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/superset/assets/cypress/integration/dashboard/controls.js b/superset/assets/cypress/integration/dashboard/controls.js index c569aad85..306edb647 100644 --- a/superset/assets/cypress/integration/dashboard/controls.js +++ b/superset/assets/cypress/integration/dashboard/controls.js @@ -60,7 +60,7 @@ export default () => describe('top-level controls', () => { .find('.refresh-tooltip').trigger('click', { force: true }); // not allow dashboard level force refresh when any chart is loading - cy.get('#save-dash-split-button').trigger('click', { forece: true }); + cy.get('#save-dash-split-button').trigger('click', { force: true }); cy.contains('Force refresh dashboard').parent().should('have.class', 'disabled'); // not allow chart level force refresh when it is loading cy.get(`#slice_${mapId}-controls`).next() diff --git a/superset/assets/cypress/integration/sqllab/query.js b/superset/assets/cypress/integration/sqllab/query.js index 0dc5fe8d0..1f373f49a 100644 --- a/superset/assets/cypress/integration/sqllab/query.js +++ b/superset/assets/cypress/integration/sqllab/query.js @@ -34,7 +34,9 @@ export default () => { // are fetched below (because React _Virtualized_ does not render all rows) const rowLimit = 3; - cy.get('#brace-editor textarea').type( + cy.get('#brace-editor textarea') + .clear({ force: true }) + .type( `{selectall}{backspace}SELECT ds, gender, name, num FROM main.birth_names LIMIT ${rowLimit}`, { force: true }, ); @@ -68,6 +70,7 @@ export default () => { let savedQueryResultsTable = null; cy.get('#brace-editor textarea') + .clear({ force: true }) .type(`{selectall}{backspace}${query}`, { force: true }) .focus() // focus => blur is required for updating the query that is to be saved .blur(); @@ -87,7 +90,9 @@ export default () => { .click(); // Enter name + save into modal - cy.get('.modal-sm input').type(`{selectall}{backspace}${savedQueryTitle}`, { + cy.get('.modal-sm input') + .clear({ force: true }) + .type(`{selectall}{backspace}${savedQueryTitle}`, { force: true, });