You want to verify that a button with class .submit-btn has a border radius of 5 pixels and a background color that is not transparent. Which Cypress code correctly asserts both styles?
hard📝 framework Q15 of 15
Cypress - Assertions
You want to verify that a button with class .submit-btn has a border radius of 5 pixels and a background color that is not transparent. Which Cypress code correctly asserts both styles?
Step 1: Assert border-radius with correct value and type
Use should('have.css', 'border-radius', '5px') to check border radius as a string with units.
Step 2: Assert background-color is not transparent
Since 'transparent' can be represented as 'rgba(0, 0, 0, 0)', use a callback assertion to check the value is not equal to that.
Step 3: Review options for correctness
cy.get('.submit-btn').should('have.css', 'border-radius', '5px').and('have.css', 'background-color').should(value => expect(value).not.to.equal('rgba(0, 0, 0, 0)')) uses a callback with should and expect to verify background-color is not transparent, which is correct.