kgabryje commented on code in PR #21184:
URL: https://github.com/apache/superset/pull/21184#discussion_r954903893
##########
superset-frontend/cypress-base/cypress/integration/sqllab/query.test.ts:
##########
@@ -157,4 +147,52 @@ describe('SqlLab query panel', () => {
assertSQLLabResultsAreEqual(initialResultsTable, savedQueryResultsTable);
});
});
+
+ it('Create a chart from a query', () => {
+ cy.intercept('/superset/sql_json/').as('queryFinished');
+ cy.intercept('**/api/v1/explore/**').as('explore');
+ cy.intercept('**/api/v1/chart/**').as('chart');
+
+ // cypress doesn't handle opening a new tab, override window.open to open
in the same tab
+ cy.window().then(win => {
+ cy.stub(win, 'open', url => {
+ // eslint-disable-next-line no-param-reassign
+ win.location.href = url;
+ });
+ });
+
+ const query = 'SELECT gender, name FROM main.birth_names';
+
+ cy.get('.ace_text-input')
+ .focus()
+ .clear({ force: true })
+ .type(`{selectall}{backspace}${query}`, { force: true });
+ cy.get('.sql-toolbar button').contains('Run').click();
+ cy.wait('@queryFinished');
+
+ cy.get(
+ '.SouthPane .ant-tabs-content > .ant-tabs-tabpane-active > div
button:first',
+ { timeout: 10000 },
Review Comment:
Sometimes there was a small delay in rendering the component with buttons.
Even though we wait for the query to finish, the test was flaky because cypress
couldn't find the button because of that delay. A smaller timeout would
probably work just as well though
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]