-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expect(element).to.have.style('height', '323px') #1393
Comments
Can you try cy.get('mainMenu').should('have.attr', 'height', '323'); Or reference the Guides on Assertions here for what you're looking for? https://docs.cypress.io/guides/references/assertions.html#Chai |
Nothing. I tried also:
In that page I don't see I just need to get the height or wodth of an element. How to? |
Have you tried sharing this issue with the community in the Cypress Gitter channel? |
Nope. I think this is at least a doc issue. Please don't close. |
@johnunclesam the assertion you're looking for is documented here: https://docs.cypress.io/guides/references/assertions.html#Chai-jQuery It's The way you most commonly use assertions is with https://docs.cypress.io/guides/references/assertions.html#Common-Assertions // assuming mainMenu is a string selector here
cy.get(mainMenu).should('have.css', 'height', ...) When you have a direct element reference that's when you use cy.get(mainMenu).should(($el) => {
expect($el).to.have.css('height', ...)
}) |
This mostly worked for me, except I get an error back that the expected value is 55, but the returned value is 55px. How to account for this? |
cy.get(mainMenu).should('have.css', 'height', '55px') |
How can I get the element height or width?
Something like:
Is it possible?
Maybe using this: https://github.com/darlanmendonca/chai-style ?
The text was updated successfully, but these errors were encountered: