How to verify that number (that is string) is greater than 0? #22293
Unanswered
art-qa
asked this question in
Questions and Help
Replies: 1 comment 3 replies
-
You'll have to extract the string number and then parse it into an int to make the number assertion. Here is a working example cy.get("h3")
.invoke("text")
.then((text) => {
const matcher = /\((?<number>\d+)\)/;
return text.match(matcher)?.groups?.number;
})
.then(parseInt)
.should("be.greaterThan", 0); |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
HTML code
I need to take the number " (100)" and verify that it is greater than 0?
Beta Was this translation helpful? Give feedback.
All reactions