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
cy.should('have.value', someValue) always fails when applied to <progress> or <meter> elements #7603
Comments
@LisaManresa Thanks for providing a reproducible example! This looks to be a regression introduced in 4.6.0 very likely within #7315 A progress element's <html>
<body>
<progress max="100" value="70">70%</progress>
<meter min="0" max="100" low="33" high="66" optimum="80" value="50">
at 50/100
</meter>
</body>
</html> describe('progress', () => {
it('test', () => {
cy.visit('index.html')
// ❗️fails in 4.6.0 - passes in 4.5.0
cy.get('progress').should('have.value', 70)
})
it('test', () => {
cy.visit('index.html')
// fails in 4.6.0 and 4.5.0
cy.get('progress').should('have.value', '70')
})
it('test', () => {
cy.visit('index.html')
// passes in 4.6.0 and 4.5.0
cy.get('progress').invoke('val').should('eq', 70)
})
it('test', () => {
cy.visit('index.html')
cy.get('progress').should(($el) => {
// passes in 4.6.0 and 4.5.0
expect($el.val()).to.eq(70)
})
})
})
describe('meter', () => {
it('test', () => {
cy.visit('index.html')
// ❗️fails in 4.6.0 - passes in 4.5.0
cy.get('meter').should('have.value', 50)
})
it('test', () => {
cy.visit('index.html')
// fails in 4.6.0 and 4.5.0
cy.get('meter').should('have.value', '50')
})
it('test', () => {
cy.visit('index.html')
// passes in 4.6.0 and 4.5.0
cy.get('meter').invoke('val').should('eq', 50)
})
it('test', () => {
cy.visit('index.html')
cy.get('meter').should(($el) => {
// passes in 4.6.0 and 4.5.0
expect($el.val()).to.eq(50)
})
})
}) WorkaroundDowngrade to 4.5.0 or use one of the other passing methods above to test the value outside of the |
Elements that accept number type
Elements that accept string type
|
The code for this is done in cypress-io/cypress#7621, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
cy.should('have.value', someValue)
always fails when testing<progress>
or<meter>
elements. This is regardless of whether the value passed to the assertion is a String or Number.Assertion results in

expected '<progress#progressEl>' to have value '50', but the value was 50
Desired behavior:
When applied to a
<progress>
or<meter>
element, thecy.should('have.value', someValue)
should behave the same way it does for<input>
elements.Test code to reproduce
HTML
Test
Comparison between
have.value
asserted on<input>
vs<progress>
/<meter>
, as well as a comparison withhave.attr
can be found here: https://github.com/LisaManresa/cypress-test-tinyVersions
Cypress 4.6.0
The text was updated successfully, but these errors were encountered: