79724593

Date: 2025-08-04 07:32:01
Score: 0.5
Natty:
Report link

Can you try to use cy.get() and .each() for the entire test logic ?

describe('I am testing the Modals on ' + modalUrls.length + ' pages.', () => {
  modalUrls.forEach(function(page) {
    it(`should open and close all modals on ${page}`, () => {

      cy.visit(page);

      cy.get('[data-modal-trigger]').each(($triggerLink) => {
        const modalId = $triggerLink.attr('data-modal-trigger');
        if (modalId) {
          cy.log(`Processing modal with ID: ${modalId}`);
          cy.wrap($triggerLink).click();
          cy.get(`#${modalId}`).should('be.visible');
          cy.get(`#${modalId} [data-modal-close]`).click();
          cy.get(`#${modalId}`).should('not.be.visible');
        }
      });
    });
  });
});
Reasons:
  • Whitelisted phrase (-2): Can you try
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): Can you
  • Low reputation (1):
Posted by: shailesh patil