Reputation: 512
I have the following html structure:
<path d="M16,1 C7.7146,1 1,7.65636364 1,15.8648485 C1,24.0760606 16,51 16,51 C16,51 31,24.0760606 31,15.8648485 C31,7.65636364 24.2815,1 16,1 L16,1 Z" fill="#0fb500"></path>
I should state that the color inside fill is # 0fb500. i tried like this but it doesn't work:
cy.get('path').should('have.css', 'fill', '#0fb500')
he just says he can't find it
if instead I put:
cy.get('path').eq(0).invoke('attr', 'fill').should('contain', '#0fb500')
if i put
cy.log(cy.get('path'))
obtain: Object(5)
Upvotes: 2
Views: 6223
Reputation: 18650
Can you try instead of css, using the invoke attribute feature in cypress to find fill and check its value, something like this:
cy.get('path').eq(4).should('have.attr', 'fill', '#0fb500')
Upvotes: 4