https://cypress.io logo
Query related to Dynamic Value Assertion
# i-need-help
c
Hello All, I need to validate the dynamic value in Assertion, any idea how we can do that? Example: 1. Creating 1 Random Number using Math.Random() 2. Storing that value in 1 Variable 3. After processing the data need to validate that Random Number in Assertion. Currently using cy.contains() but its failing for me.
g
What is the test you are trying to code? Right now it is not enough information to help
c
Hello @gray-kilobyte-89541 , Its E2E flow which I am testing need to assign the roleNumber in between 1-20 so using Math.Random creating that & same need to validate in assertion from table so using cy.contains ('td', "The Role Number is ...") Using same variable which is created to store that RoleNumber
g
good one, let me code an example
c
Thanks @gray-kilobyte-89541 I will check this solution & if I have any question then I will get back to you
2 Views