How run or skip IT blocks based on element found or not?

Skip to first unread message

Sebastian Felice

Jan 6, 2021, 3:58:57 PM1/6/21
to Mocha
I'm working with Puppeteer and Mocha.
I have an IT block that checks to see if a row exists on a table.
I want to have a Boolean that gets setup to foundIt = true or foundIt = false depending on if it is found on the table or not.
Then that Boolean would be used to let other IT black be run or skipped depending on the outcome.

let foundIt = true

// IT block to check if item is on the table or not, sets value of  foundIt

if(foundIt == false) {
    // run several IT blocks to add item to table

The issue I'm having is that the local Node related code runs before the Browser related code does.
This results in the IF statement always getting the initial value set to  foundIt

There must be a different way to do something like this???
Reply all
Reply to author
0 new messages