able-magazine-89300
07/17/2022, 8:20 PMwonderful-match-15836
07/17/2022, 8:42 PMcy.contains('.welcome-message > h1', 'Welcome') work for you? Do you actually need a custom command for this?
If you do still need a custom command, this might help understand what is happening: https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Subject-Management
When you call cy.get(element) in your shouldContain command, it looks like element is return value of loginPageHeaderText, which is itself cy.get(LOGIN_PAGE_HEADER_TEXT, {timeout: 140000}). Which leads to a cy.get(cy.get(...)), when maybe what you want is to just chain off of the element parameter itself like element.should('contain.text', text).
I don't write a lot of code like this so my instincts might be a bit off.able-magazine-89300
07/17/2022, 8:50 PM