mercredi 12 février 2020

Cypress making a duplicate of DOM element

The Cypress for some reason produces a duplicate of an element, which makes it hard to make certain assertions.

We're working in the WordPress environment with our plugin and the flow of the test is:

  1. Creating a page with our plugin
  2. Adding an element (Post Grid in this case)
  3. Changing some attributes
  4. Saving the page
  5. Viewing the page

E.g. A post grid is a usual div element wich contains two items (links to blog posts) in it, but due to its being duplicate, the following assertion fails.

  cy.get('.vce-posts-grid-list')
    .find('.vce-posts-grid-item')
    .its('length')
    .should('be.eq', 2)

Our plugin utilizes an iframe and generates content (HTML) inside it.

Note: This issue occurs only sometimes, NOT 100% of the time.

Is it a Cypress specific issue or a reaction for WordPress and possibly our plugin environment?

Aucun commentaire:

Enregistrer un commentaire