We are running some tests for a website in Cypress. In Chrome on Windows, the tests all pass. On a Mac, however, the widths of some elements are 2px wider than when on Windows. I understand that this shouldn't be the case, and we'll investigate that separately, but what I would like to know is how do you tests that a value of a test should fall within a range of values?
This is the test that passes in Windows:
it('checks Headline container, width & horizontal spacing', () => {
cy.get('[data-cy=headline]')
.should('have.css', 'width', '569px')
})
This one passes on a Mac. The only change is the width being 571px instead of 569px.
it('checks Headline container, width & horizontal spacing', () => {
cy.get('[data-cy=headline]')
.should('have.css', 'width', '571px')
})
Given that the actual should() test is against a string, how would you test that the width is either of two strings instead? Or an actual range of values?