How to add a conditional wait on an element while performing Jest automation testing?

How to add a conditional wait on an element while performing Jest automation testing ?

Hi Rhian!

While performing Jest automation, you can use the below code snippet in your test script to add a conditional wait on an element.

const EC = protractor.ExpectedConditions;

waitForElement = async () => {
    const present = await yourElement.isPresent();
    if (present) {
        await browser.wait(EC.elementToBeClickable(yourElement));
        await yourElement.sendKeys('something');
    }
};