kristw commented on a change in pull request #5846: Adding line and big number 
total integration tests
URL: 
https://github.com/apache/incubator-superset/pull/5846#discussion_r216408476
 
 

 ##########
 File path: superset/assets/cypress/support/commands.js
 ##########
 @@ -50,10 +50,40 @@ Cypress.Commands.add('visitChartByParams', (params) => {
   cy.visit(`${BASE_EXPLORE_URL}${params}`);
 });
 
-Cypress.Commands.add('verifySliceSuccess', (waitAlias) => {
+Cypress.Commands.add('verifySliceSuccess', ({ waitAlias, querySubstring, 
getSvg }) => {
   cy.wait([waitAlias]).then((data) => {
     expect(data.status).to.eq(200);
     expect(data.response.body).to.have.property('error', null);
-    cy.get('.slice_container');
+    expect(data.response.query).contains(querySubstring);
+    cy.get('.slice_container').within(() => {
+      if (getSvg !== false) {
+        cy.get('svg').should('have.attr', 'height').then((height) => {
+          expect(height).greaterThan(0);
+        });
+        cy.get('svg').should('have.attr', 'width').then((width) => {
+          expect(width).greaterThan(0);
+        });
+      }
+    });
+  });
+});
+
+Cypress.Commands.add('verifySliceSuccess', ({ waitAlias, querySubstring, 
getSvg = true }) => {
+  cy.wait([waitAlias]).then((data) => {
+    expect(data.status).to.eq(200);
+    expect(data.response.body).to.have.property('error', null);
+    if (querySubstring) {
+      expect(data.response.body.query).contains(querySubstring);
+    }
+    cy.get('.slice_container').within(() => {
+      if (getSvg) {
+        cy.get('svg').should('have.attr', 'height').then((height) => {
 
 Review comment:
   ```
   // change 'svg' to the chartSelector parameter to support 'div', 'table', 
etc.
   cy.get(chartSelector).then(chart => {
     // This should work for getting DOM element dimension in general
     // to support div that has no 'width', 'height' attributes.
     expect(chart.clientWidth).greaterThan(0);
     expect(chart.clientHeight).greaterThan(0);
   });
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to