CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

retryTo leads to stale process on failure

Open cjhille opened this issue 1 year ago • 2 comments

I'm sorry @kobenguyent, but we must have missed a regression with the last fix here https://github.com/codeceptjs/CodeceptJS/issues/4110

It works fine as long as assertions are a success, but as soon as there is a failure – even outside the retryTo block – the test never terminates.

Simple test code:

Feature('foo');

Scenario('test issue', async ({ I }) => {
    I.amOnPage('http://example.org')
    I.waitForVisible('.nothing', 1); // should fail here but it won't terminate
    await retryTo( (tryNum) => {
        I.see(".doesNotMatter");
    }, 10);
});

EDIT: Adding an irregular await before the failing assertion await I.waitForVisible('.nothing', 1) will let the promise chain resolve.

image

cjhille avatar Feb 13 '24 17:02 cjhille

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar May 14 '24 02:05 github-actions[bot]

The issue still persists (see test case). Unfortunately, retryTo can not be used currently. FYI @DavertMik

cjhille avatar May 14 '24 09:05 cjhille

hey @cjhille I reverted those fixes at https://github.com/codeceptjs/CodeceptJS/pull/4117/files#diff-3799cca2cab187279c2a50bbd0c3a7451b24e20da2bdad08d42eb95444d392baR92 but the issue still persists, so I think it's coming from somewhere else.

Screenshot 2024-05-29 at 07 51 15

kobenguyent avatar May 29 '24 05:05 kobenguyent

per my initial thinking, I guess the issue is from waitForVisible

Screenshot 2024-05-29 at 07 57 23

kobenguyent avatar May 29 '24 05:05 kobenguyent

@kobenguyent after investigation, we have found that the issue is not about retryTo but occurs when a promise reject.

This is enough to stale the process

Scenario('Rejected promise stale the process', async ({ I }) => {
  await new Promise((resolve, reject) => setTimeout(reject, 500));
})

We investigate how to solve this

Horsty80 avatar Jun 05 '24 12:06 Horsty80