Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
185
rated 0 times [  186] [ 1]  / answers: 1 / hits: 19169  / 6 Years ago, wed, august 29, 2018, 12:00:00

Unable to test the background color using Cypress.io, it throws following error while running the cypress test; CypressError: Timed out retrying: actual.equals is not a function. Installed chai-colors via npm install chai-colors and added following under /support/ index.js



import chaiColors from 'chai-colors'
chai.use(chaiColors)


cypress test given below:



describe(Background Color test, () => {
//before(() => {
// cy.visit('https://sometesturl.com')
// })
it.only('Verify the backgroud color, this should work', () => {
cy.visit('https://sometesturl.com')
cy.get('#footer')
.should('colored', '#f2e47d')
.and('be.colored', '#f2e47d')
})
})

More From » cypress

 Answers
1

I have tried with 'eq' and 'rgb' values corresponding to colour #f2e47d. In the following link 'brian-mann' from cypress.io affirms that says 'match' is always for regex.
https://github.com/cypress-io/cypress/issues/58
Now the test got successfully asserting the background-color value in the footer area.



describe(Background Color test, () => {
it.only('Verify the backgroud color, this should work', () => {
cy.visit('https://sometesturl.com')
cy.get('#footer')
.should('have.css', 'background-color')
.and('eq', 'rgb(242, 228, 125)')
})
})

[#53609] Monday, August 27, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tobyl

Total Points: 598
Total Questions: 110
Total Answers: 114

Location: Vietnam
Member since Sat, Feb 12, 2022
2 Years ago
tobyl questions
Tue, Aug 10, 21, 00:00, 3 Years ago
Wed, Jan 13, 21, 00:00, 3 Years ago
Tue, Dec 1, 20, 00:00, 4 Years ago
;