One task I am trying to tackle is comparing a component on one page with the same component on another page using Cypress. For example, let's say I have a Pricing Component on the Home page, and I want to verify if the values on the Pricing Page are identical.
I attempted the following approach, but unfortunately it did not produce the desired results:
describe('Comparing the Pricing component on different pages', () => {
it('', () => {
cy.visit('http://localhost:3000')
cy.get('.package-name').contains('Iniciante').invoke('text').as('name')
cy.visit('http://localhost:3000/pricing')
cy.get('.package-name').contains('Iniciante').invoke('text').as('name2')
expect("name").to.be.eq("name2")
})
})