How to add a conditional wait on an element in JS-Nightwatch?

How can I add a conditional wait on an element in JS-Nightwatch?

Hello Macy,

To add a conditional wait on an element in JS-Nightwatch, use the below code:

const EC = protractor.ExpectedConditions;

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