You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/04/16 10:22:31 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #9555: [Build] Collect frontend code coverage from Cypress tests

ktmud commented on a change in pull request #9555: [Build] Collect frontend code coverage from Cypress tests
URL: https://github.com/apache/incubator-superset/pull/9555#discussion_r409437427
 
 

 ##########
 File path: superset-frontend/cypress-base/cypress/integration/dashboard/filter.js
 ##########
 @@ -33,41 +36,36 @@ export default () =>
       cy.get('#app').then(data => {
         const bootstrapData = JSON.parse(data[0].dataset.bootstrap);
         const dashboard = bootstrapData.dashboard_data;
-        dashboardId = dashboard.id;
-        sliceIds = dashboard.slices.map(slice => slice.slice_id);
+        const sliceIds = dashboard.slices.map(slice => slice.slice_id);
         filterId = dashboard.slices.find(
           slice => slice.form_data.viz_type === 'filter_box',
         ).slice_id;
+        aliases = sliceIds.map(id => {
+          const alias = getAlias(id);
+          const url = `/superset/explore_json/?*{"slice_id":${id}}*`;
+          cy.route('POST', url).as(alias.slice(1));
+          return alias;
+        });
+
+        // wait the initial page load requests
+        cy.wait(aliases);
       });
     });
 
     it('should apply filter', () => {
-      const aliases = [];
-
-      const formData = `{"slice_id":${filterId}}`;
-      const filterRoute = `/superset/explore_json/?form_data=${formData}&dashboard_id=${dashboardId}`;
-      cy.route('POST', filterRoute).as('fetchFilter');
-      cy.wait('@fetchFilter');
-      sliceIds
-        .filter(id => parseInt(id, 10) !== filterId)
-        .forEach(id => {
-          const alias = `getJson_${id}`;
-          aliases.push(`@${alias}`);
-
-          cy.route(
-            'POST',
-            `/superset/explore_json/?form_data={"slice_id":${id}}&dashboard_id=${dashboardId}`,
-          ).as(alias);
-        });
-
-      // select filter_box and apply
-      cy.get('.Select-control')
-        .first()
+      // make sure select has appeared
+      cy.get('.Select-placeholder').contains('Select [region]');
+      // select again to make sure it still exists in DOM
+      // (because of Cypress's weird bug with fixed headers)
+      cy.get('.Select-placeholder')
+        .contains('Select [region]')
+        .click()
+        .next()
 
 Review comment:
   Somehow Cypress keeps randomly failing at this test (i.e. some runs will be successful, some will not, can never reproduce locally): https://dashboard.cypress.io/projects/ukwxzo/runs/15/specs
   
   Spent 3 hours on this and still couldn't find a workaround. Had to skip it for now.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org