Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin "retryFailedStep" doesn't work in --debug or --verbose mode, searching for element fails immediately #4384

Open
mirao opened this issue Jun 6, 2024 · 5 comments
Labels

Comments

@mirao
Copy link
Contributor

mirao commented Jun 6, 2024

It's a regression in 3.6.0.
It works well with 3.5.15.

What are you trying to achieve?

You should see the Retrying... Attempt ... retries in the following test.

This is how it works with 3.5.15 ✔️

CodeceptJS v3.5.15 #StandWithUkraine
Using test root "/home/mirao/workspace/codeceptjs/tests/my"
Helpers: Playwright
Plugins: screenshotOnFail, retryFailedStep

My --
    [1]  Starting recording promises
    Timeouts: 
 › [Session] Starting singleton browser session
  test something
    I see element ".blabla"
    [1] Retrying... Attempt #2
    [1] Retrying... Attempt #3
    [1] Retrying... Attempt #4
    [1] Error (Non-Terminated) | Error: Element ".blabla" is not visible on page. | (err) => { step.status = 'failed'; step.endTime = ...
    [1] Error | Error: Element ".blabla" is not visible on page. 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 1148ms

    [2]  Starting recording promises

-- FAILURES:

  1) My
       test something:
     Element ".blabla" is not visible on page.
      at dontSeeElementError (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/codeceptjs/lib/helper/errors/ElementAssertion.js:23:9)
      at Playwright.seeElement (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/codeceptjs/lib/helper/Playwright.js:1460:7)
  
  Scenario Steps:
  - I.seeElement(".blabla") at Test.<anonymous> (./My_test.ts:4:7)
  
  Artifacts:
  - screenshot: /home/mirao/workspace/codeceptjs/tests/my/output/test_something.failed.png


  FAIL  | 0 passed, 1 failed   // 2s

What do you get instead?

Provide console output if related. Use --verbose mode for more details.

This is how it works with 3.6.0 or 3.6.2 🐛

CodeceptJS v3.6.0 #StandWithUkraine
Using test root "/home/mirao/workspace/codeceptjs/tests/my"
Helpers: Playwright
Plugins: screenshotOnFail, retryFailedStep

My --
    [1]  Starting recording promises
    Timeouts: 
 › [Session] Starting singleton browser session
  test something
    I see element ".blabla"
    [1]  Error (Non-Terminated) | Error: Element ".blabla" is not visible on page. | (err) => { step.status = 'failed'; step.endTime = ...
    [1] Error | Error: Element ".blabla" is not visible on page. 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 117ms

    [2]  Starting recording promises

-- FAILURES:

  1) My
       test something:
     Element ".blabla" is not visible on page.
      at dontSeeElementError (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/codeceptjs/lib/helper/errors/ElementAssertion.js:23:9)
      at Playwright.seeElement (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/codeceptjs/lib/helper/Playwright.js:1464:7)
  
  Scenario Steps:
  - I.seeElement(".blabla") at Test.<anonymous> (./My_test.ts:4:7)
  
  Artifacts:
  - screenshot: /home/mirao/workspace/codeceptjs/tests/my/output/test_something.failed.png


  FAIL  | 0 passed, 1 failed   // 574ms

Provide test source code if related

Feature("My");

Scenario("test something", ({ I }) => {
    I.seeElement(".blabla");
});

Details

  • CodeceptJS version: 3.6.0 or 3.6.2
  • NodeJS Version: 18.20
  • Operating System: Ubuntu 22.04
  • Playwright Version 1.43.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,
        },
    },
    name: "my",
};
@mirao
Copy link
Contributor Author

mirao commented Jun 14, 2024

Interestingly it works well in a "shell" mode (tested with 3.6.3):

$ codeceptjs shell --verbose
Interactive shell started
 Use JavaScript syntax to try steps in action
 - Press ENTER to run the next step
 - Press TAB twice to see all available commands
 - Type exit + Enter to exit the interactive shell
 - Prefix => to run js commands 
 I.seeElement(".blabla")
    [1] <pause> Retrying... Attempt #2
    [1] <pause> Retrying... Attempt #3

@mirao
Copy link
Contributor Author

mirao commented Jun 14, 2024

Well, only --debug or --verbose mode is affected.
And if I comment out this line:

if (options.verbose || options.debug) store.debugMode = true;

everything works well even in --verbose mode.

store.debugMode seems to be needed for healers only? #4230

@DavertMik

@mirao mirao changed the title Plugin "retryFailedStep" doesn't work, searching for element fails immediately Plugin "retryFailedStep" doesn't work in --debug or --verbose mode, searching for element fails immediately Jun 14, 2024
@DavertMik
Copy link
Contributor

Thanks, I'm checking

@mirao
Copy link
Contributor Author

mirao commented Jun 20, 2024

I "solved" it a different way to myself.
I patched the retryFailedStep plugin - I removed this line

if (store.debugMode) return false;

It seems to me that the removing doesn't affect functionality of the plugin. I tested the plugin in non-verbose mode, --verbose mode, in shell mode and for pause()

Copy link

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

@github-actions github-actions bot added the stale label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants