This is an automated email from the ASF dual-hosted git repository. ccwilliams pushed a commit to branch chris--sqllab-cypress in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit 88e99c5b39f63f673070036de9a790cb82436d9c Author: Chris Williams <[email protected]> AuthorDate: Fri Sep 21 15:59:51 2018 -0700 [cypress] add sqllab/sourcePanel integration tests --- .../cypress/integration/sqllab/sourcePanel.js | 53 ++++++++++++++++++++++ .../assets/src/SqlLab/components/TableElement.jsx | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/superset/assets/cypress/integration/sqllab/sourcePanel.js b/superset/assets/cypress/integration/sqllab/sourcePanel.js new file mode 100644 index 0000000..5bfa3ba --- /dev/null +++ b/superset/assets/cypress/integration/sqllab/sourcePanel.js @@ -0,0 +1,53 @@ +describe('SqlLab datasource panel', () => { + beforeEach(() => { + cy.login(); + cy.server(); + cy.visit('/superset/sqllab'); + }); + + it('renders dropdowns to select database, schema, and table', () => { + cy.get('.sql-toolbar .Select').then((nodes) => { + expect(nodes).to.have.length(3); + }); + }); + + it('creates a table schema and preview when a database, schema, and table are selected', () => { + cy.get('.sql-toolbar .table-schema').should('not.exist'); + cy.get('.SouthPane .tab-content .filterable-table-container').should('not.exist'); + + cy.get('.sql-toolbar .Select') + .eq(0) + .within(() => { + cy.get('input').type('main{enter}', { force: true }); + }) + .then(() => { + cy.get('.sql-toolbar .Select') + .eq(1) + .within(() => { + cy.get('input').type('main{enter}', { force: true }); + }); + }) + .then(() => { + cy.get('.sql-toolbar .Select') + .eq(2) + .within(() => { + cy.get('input').type('birth_names{enter}', { force: true }); + }); + }) + .then(() => { + cy.get('.sql-toolbar .table-schema').should('have.length', 1); + cy.get('.SouthPane .tab-content .filterable-table-container').should('have.length', 1); + }) + .then(() => { + cy.get('.sql-toolbar .Select') + .eq(2) + .within(() => { + cy.get('input').type('logs{enter}', { force: true }); + }); + }) + .then(() => { + cy.get('.sql-toolbar .table-schema').should('have.length', 2); + cy.get('.SouthPane .tab-content .filterable-table-container').should('have.length', 2); + }); + }); +}); diff --git a/superset/assets/src/SqlLab/components/TableElement.jsx b/superset/assets/src/SqlLab/components/TableElement.jsx index b1e53a9..ce6bf68 100644 --- a/superset/assets/src/SqlLab/components/TableElement.jsx +++ b/superset/assets/src/SqlLab/components/TableElement.jsx @@ -216,7 +216,7 @@ class TableElement extends React.PureComponent { transitionAppear onExited={this.removeFromStore.bind(this)} > - <div className="TableElement m-b-10"> + <div className="TableElement table-schema m-b-10"> {this.renderHeader()} <div> {this.renderBody()}
