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/09/30 18:00:08 UTC

[GitHub] [incubator-superset] eschutho commented on a change in pull request #10916: chore: Moved selectors from class to data-test specific in card_view tests

eschutho commented on a change in pull request #10916:
URL: https://github.com/apache/incubator-superset/pull/10916#discussion_r497700312



##########
File path: superset-frontend/cypress-base/cypress/integration/chart_list/card_view.test.ts
##########
@@ -71,37 +73,40 @@ describe('chart card view', () => {
     cy.get('.Select__control').last().should('be.visible');
     cy.get('.Select__control').last().click();
     cy.get('.Select__menu').contains('Alphabetical').click();
-    cy.get('.chart-list-view').should('be.visible');
-    cy.get('.ant-card').first().contains('% Rural');
+    cy.get('[data-test="chart-list-view"]').should('be.visible');
+    cy.get('[data-test="styled-card"]').first().contains('% Rural');
 
     // sort Recently Modified
     cy.get('.Select__control').last().should('be.visible');
     cy.get('.Select__control').last().click();
     cy.get('.Select__menu').contains('Recently Modified').click();
-    cy.get('.chart-list-view').should('be.visible');
-    cy.get('.ant-card').first().contains('Unicode Cloud');
-    cy.get('.ant-card').last().contains('Life Expectancy VS Rural %');
+    cy.get('[data-test="chart-list-view"]').should('be.visible');
+    cy.get('[data-test="styled-card"]').first().contains('Unicode Cloud');
+    cy.get('[data-test="styled-card"]')
+      .last()
+      .contains('Life Expectancy VS Rural %');
   });
 
   it('should delete correctly', () => {
     // show delete modal
-    cy.get('.ant-dropdown-trigger').last().trigger('mouseover');
-    cy.get('.ant-dropdown-menu-item').contains('Delete').should('exist');
-    cy.get('.ant-dropdown-menu-item').contains('Delete').click();
-    cy.get('.modal-dialog').should('be.visible');
-    cy.get('.modal-dialog .btn-danger').should('have.attr', 'disabled');
-    cy.get(".modal-dialog input[id='delete']").type('DELETE');
-    cy.get('.modal-dialog .btn-danger').should('not.have.attr', 'disabled');
-    cy.get('.modal-dialog .btn-default').contains('Cancel').click();
+    cy.get('[data-test="more-horiz"]').last().trigger('mouseover');
+    cy.get('[data-test="delete-option"]').contains('Delete').should('exist');
+    cy.get('[data-test="delete-option"]').contains('Delete').click();
+    cy.get('[data-test="modal-footer"]').should('exist');
+    cy.get('[data-test="delete-button"]').should('have.attr', 'disabled');
+    cy.get('[data-test="modal-body"]').should('exist');
+    cy.get("[data-test='delete-input']").type('DELETE');
+    cy.get('[data-test="delete-button"]').should('not.have.attr', 'disabled');
+    cy.get('[data-test="cancel-button"]').click();
   });
 
   it('should edit correctly', () => {
     // show edit modal
-    cy.get('.ant-dropdown-trigger').last().trigger('mouseover');
-    cy.get('.ant-dropdown-menu-item').contains('Edit').should('exist');
-    cy.get('.ant-dropdown-menu-item').contains('Edit').click();
-    cy.get('.modal-dialog').should('be.visible');
-    cy.get('.modal-dialog input[name="name"]').should('not.have.value');
-    cy.get('.modal-dialog .btn-default').contains('Cancel').click();
+    cy.get('[data-test="more-horiz"]').last().trigger('mouseover');
+    cy.get('[data-test="edit-option"]').contains('Edit').should('exist');
+    cy.get('[data-test="edit-option"]').contains('Edit').click();
+    cy.get('[data-test="edit-modal"]').should('exist');

Review comment:
       what's the benefit of `exist` over `be.visible` out of curiosity? Can you click on something if it just `exists`?




----------------------------------------------------------------
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



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