How to execute X amount of keypresses in testcafe?

Viewed 184

TestCafe is skipping over await pressKey

I have in my code something like this:

async setInputType(index, type, choiceOptionNumber) {
        const input = Selector(`#myid-input-${index}-selectFieldType`);
        await t
            .click(input)
            .typeText(input, type, { replace: true })

        if (choiceOptionNumber) {
            for (let i = 0; i < choiceOptionNumber; i++) {
                await t.pressKey("down")
            }
            await t.pressKey("enter");  
        } else
        await t.pressKey("down").pressKey("enter");
    }

I expect it to press the down key twice, but it does it once and then hits the next function I'm calling.

0 Answers
Related