Skip to content

retryTo not working with await in block #4110

Closed
@cjhille

Description

@cjhille
Feature('foo');

Scenario('retry something', async ({ I }) => {

    I.amOnPage('http://example.org');
    
    // this works
    await retryTo( (tryNum) => {
        I.say(`${tryNum} try without await`);
        if (tryNum < 2) {
            I.say(`should fail and retry`);
            I.waitForVisible('.shouldFail', 1);
        }
        I.say(`should pass`);
    }, 2); 

    I.say(`---`);

    // this doesn't work
    await retryTo( async (tryNum) => {
        I.say(` ${tryNum} try with await`);
        await I.grabCurrentUrl();
        if (tryNum < 2) {
            I.say(`should fail and retry`);
            I.waitForVisible('.shouldFail', 1);
        }
        I.say(`should pass`);
    }, 2);
});

Details

  • CodeceptJS version: 3.5.7
  • NodeJS Version: 18.18.
  • Operating System: macos
  • playwright

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions