Skip to content

Plugin retryFailedStep isn't applied for a code placed after a block tryTo() #4102

Closed
@mirao

Description

@mirao

It's a regression. It works well in 3.5.8.
It seems to be related (broken?) to the issue #4068 .
Note that it works well for a code placed before tryTo().

What are you trying to achieve?

The plugin retryFailedStep is applied to the step I.click("blabla"); (and following steps)

This is how it works in 3.5.8 (correctly) ✔️

$ codeceptjs run --verbose
***************************************
nodeInfo:  18.15.0
osInfo:  Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
cpuInfo:  (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
chromeInfo:  120.0.6099.129
edgeInfo:  "N/A"
firefoxInfo:  120.0.1
safariInfo:  N/A
If you need more detailed info, just run this: npx codeceptjs info
***************************************
CodeceptJS v3.5.8 #StandWithUkraine
Using test root "/home/mirao/workspace/codeceptjs/tests/my"
Helpers: Playwright
Plugins: screenshotOnFail, retryFailedStep, tryTo

My --
    [1]  Starting recording promises
    Timeouts: 
 › [Session] Starting singleton browser session
  test something
    I wait for visible "abcde"
    [1] <tryTo> Error | Error: element (abcde) still not visible after 1 sec
locator.waitFor: Timeout 1000ms exceeded.
Call log:
  - waiting for locator('abcde').first() to be visible

 › Unsuccessful try > Error: element (abcde) still not visible after 1 sec
locator.waitFor: Timeout 1000ms exceeded.
Call log:
  - waiting for locator('abcde').first() to be visible

    I click "blabla"
    [1] Retrying... Attempt #2
    [1] Retrying... Attempt #3
    [1] Retrying... Attempt #4
    [1] Retrying... Attempt #5
    [1] Retrying... Attempt #6
    [1] Retrying... Attempt #7
    [1] Retrying... Attempt #8
    [1] Retrying... Attempt #9
    [1] Retrying... Attempt #10
    [1] Retrying... Attempt #11
    [1] Error | Error: Clickable element "blabla" was not found by text|CSS|XPath
    [1] Error | Error: Clickable element "blabla" was not found by text|CSS|XPath
    [1] <teardown> Stopping recording promises
 › <screenshotOnFail> Test failed, try to save a screenshot
 › Screenshot is saving to /home/mirao/workspace/codeceptjs/tests/my/output/test_something.failed.png
  ✖ FAILED in 50394ms

    [2]  Starting recording promises

-- FAILURES:

  1) My
       test something:
     Clickable element "blabla" was not found by text|CSS|XPath
      at new ElementNotFound (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]_w5ziqaoxad7so7ymdh67thw5y4/node_modules/codeceptjs/lib/helper/errors/ElementNotFound.js:15:11)
      at assertElementExists (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]_w5ziqaoxad7so7ymdh67thw5y4/node_modules/codeceptjs/lib/helper/Playwright.js:3633:11)
      at Playwright.proceedClick (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]_w5ziqaoxad7so7ymdh67thw5y4/node_modules/codeceptjs/lib/helper/Playwright.js:3397:5)
  
  Scenario Steps:
  - I.waitForVisible("abcde") at ./My_test.ts:6:11
  
  Artifacts:
  - screenshot: /home/mirao/workspace/codeceptjs/tests/my/output/test_something.failed.png


  FAIL  | 0 passed, 1 failed   // 51s

What do you get instead?

The plugin retryFailedStep isn't applied to the step I.click("blabla"); (and following steps)

This is how it works in 3.5.11 (incorrectly) 🐛

$ codeceptjs run --verbose
***************************************
nodeInfo:  18.15.0
osInfo:  Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
cpuInfo:  (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
chromeInfo:  120.0.6099.129
edgeInfo:  "N/A"
firefoxInfo:  undefined
safariInfo:  N/A
If you need more detailed info, just run this: npx codeceptjs info
***************************************
CodeceptJS v3.5.11 #StandWithUkraine
Using test root "/home/mirao/workspace/codeceptjs/tests/my"
Helpers: Playwright
Plugins: screenshotOnFail, retryFailedStep, tryTo

My --
    [1]  Starting recording promises
    Timeouts: 
 › [Session] Starting singleton browser session
  test something
    I wait for visible "abcde"
    [1] <tryTo> Error (Non-Terminated) | Error: element (abcde) still not visible after 1 sec
locator.waitFor: Timeout 1000ms exceeded.
Call log:
  - waiting for locator('abcde').first() to be visible
 | (err) => { step.status = 'failed'; step.endTime = ...
 › Unsuccessful try > Error: element (abcde) still not visible after 1 sec
locator.waitFor: Timeout 1000ms exceeded.
Call log:
  - waiting for locator('abcde').first() to be visible

    I click "blabla"
    [1] Error (Non-Terminated) | Error: Clickable element "blabla" was not found by text|CSS|XPath | (err) => { step.status = 'failed'; step.endTime = ...
    [1] Error | Error: Clickable element "blabla" was not found by text|CSS|XPath undefined...
    [1] <teardown> Stopping recording promises
 › <screenshotOnFail> Test failed, try to save a screenshot
 › Screenshot is saving to /home/mirao/workspace/codeceptjs/tests/my/output/test_something.failed.png
  ✖ FAILED in 1146ms

    [2]  Starting recording promises

-- FAILURES:

  1) My
       test something:
     Clickable element "blabla" was not found by text|CSS|XPath
      at new ElementNotFound (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]/node_modules/codeceptjs/lib/helper/errors/ElementNotFound.js:15:11)
      at assertElementExists (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]/node_modules/codeceptjs/lib/helper/Playwright.js:3721:11)
      at Playwright.proceedClick (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]/node_modules/codeceptjs/lib/helper/Playwright.js:3484:5)
  
  Scenario Steps:
  - I.waitForVisible("abcde") at ./My_test.ts:6:11
  
  Artifacts:
  - screenshot: /home/mirao/workspace/codeceptjs/tests/my/output/test_something.failed.png


  FAIL  | 0 passed, 1 failed   // 2s

Provide test source code if related

Feature("My");

Scenario("test something", async ({ I }) => {
    await tryTo(() =>
        I.waitForVisible("abcde")
    );
    I.click("blabla");
});

Details

  • CodeceptJS version: 3.5.11
  • NodeJS Version: v18.15.0
  • Operating System: Ubuntu 22.04
  • Playwright 1.40.1
  • Configuration file:
export const config: CodeceptJS.MainConfig = {
    tests: "./*_test.ts",
    output: "./output",
    helpers: {
        Playwright: {
            browser: "chromium",
            url: "http://localhost",
            show: true,
        },
    },
    plugins: {
        retryFailedStep: {
            enabled: true,
        },
        tryTo: {
            enabled: true,
        },
    },
    name: "my",
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions