Skip to content
Advertisement

Tag: cypress

Getting the numerical value from an element in Cypress

I currently have a parent element ‘[data-testid=”wallet”]’ with a child <div class=”css-3ro84u”>0 kr</div> I want to extract the balance at the beginning of the test, and then compare that value to the end of the test when the user has spent their balance to purchase an item. For example, if the user has 100kr at the beginning of the test

How can I do an if else in cypress?

I’m doing a test and I put a value in a texfield. If I get some data I want it to be found, otherwise I want “no data” to be found. This code doesn’t work… Why? And how can I do it? Answer You are trying to use the contains command from cypress to get a boolean, but it acts

Context eval expression when I write function in Mocha Test as lambda

When I use the below code, I do not get the context eval error for the variable data When write my mocha test function as lambda (Refer code below), I receive context eval error for data variable Code Error at Context.eval (webpack:///cypress/integration/examples/Test8Framework.js:4:13) From previous event: at Context.thenFn (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:155190:24) at Context.then (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:155629:22) at Context. (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:170229:22) at (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:169653:16) From previous event: at

Advertisement