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
Customized assersion message not shown when using 'Cypress run' #14484
Customized assersion message not shown when using 'Cypress run' #14484
Comments
Can you try the latest Cypress v6 version?
…Sent from my iPhone
On Jan 11, 2021, at 11:16, iyangdidi ***@***.***> wrote:
Current behavior
I use following code to customize the assersion message
dossierPage.filerPanel.getCapsuleItems(filerName1).should(($lis) => { expect($lis, 'Filter "'+filerName1+'"should have 4 items').to.have.length(5) })
The customized message can be shown when using 'cypress open'
But
can't shown when using 'cypress run'
the line number throw the error is not right
Desired behavior
customized message should also be shown when using 'cypress run'
the line number throw the error should be the right line number
Here is an example of protractor as an reference
Test code to reproduce
any test scripts, add customized message to 'expect',
fail the assersion
run with 'cypress open'
run with 'cypress run'
check the failure information
Versions
"cypress": "^5.5.0",
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
In this case, the actual error thrown does not contain the custom assertion error message and is instead overwritten by the Cypress error thrown. This is true in both Cypress does show the custom error message in the Command Log in it('test', () => {
cy.visit('index.html')
cy.get('div').should(($divs) => {
expect($divs, 'Filter should have 1 items').to.have.length(1)
})
}) <html>
<body>
<div></div>
<div></div>
</body>
</html> The second issue about the stack trace line is a duplicate of this issue: #7715 |
@jennifer-shehane |
The code for this is done in cypress-io/cypress#14982, 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
I use following code to customize the assersion message

dossierPage.filerPanel.getCapsuleItems(filerName1).should(($lis) => { expect($lis, 'Filter "'+filerName1+'"should have 4 items').to.have.length(5) })
The customized message can be shown when using 'cypress open'
But
Desired behavior
Here is an example of protractor as an reference
Test code to reproduce
Versions
"cypress": "^5.5.0",
The text was updated successfully, but these errors were encountered: