In a Cypress test, I'd like to assert that a given attribute exists on the page with a given value.
The following works, but I'm wondering if there is a better way.
cy.get('[data-page-id]').invoke('attr', 'data-page-id').should('eq', 'signupPage')
You can directly assert the attribute and value in one go like this example
cy.get('[data-page-id]').should('have.attr', 'data-page-id', 'signupPage')