Remove Element

Watch this recipe in the video Remove The Found Elementopen in new window.

<div id="make">
  Honda Civic
  <span class="picked">(3 out of 4)</span>
.picked {
  font-size: smaller;
  font-weight: lighter;

To remove the span.picked from the page, we can use the jQuery removeopen in new window method. Cypress querying commands yield jQuery objects, thus we can use cy.invokeopen in new window to call the remove method immediately.

// confirm the element was removed
// by checking the parent's element text
// Note: cannot use "have.text" assertion
// since the HTML element has newlines and other
// whitespace characters
  .should('equal', 'Honda Civic')