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

The global retries config option is not applied #3607

Closed
georges96 opened this issue Mar 2, 2023 · 1 comment · Fixed by #3667
Closed

The global retries config option is not applied #3607

georges96 opened this issue Mar 2, 2023 · 1 comment · Fixed by #3667

Comments

@georges96
Copy link

Hi, I have an issue with the newly added global configuration for retries option. I can see in the logs that the number of retries is properly identified however it's not applied in my case. What am I doing wrong? Explicitly setting the .retry(X) when defining the scenario it's still working as expected. For the retry object I tried all the possible ways defined in the Codeceptjs-retry and my last resort was to use all of them as seen in another issue (which was about typescript but I still gave it a try) and it's still not working. I really hope I'm doing something wrong and there is no actual issue. Any suggestions/workarounds are highly appreciated. Thank you!

What are you trying to achieve?

Use the global retry config option.

What do you get instead?

The options are not used.

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

host:[~/test]$ codeceptjs run my_test.js --steps --debug --verbose
CodeceptJS v3.4.1 #StandWithUkraine
Using test root "/root/test"
Helpers: Playwright
Plugins: screenshotOnFail

Check retries --
    [1]  Starting recording promises
    Retries: {"grep":"","Feature":0,"Scenario":3,"Before":3,"BeforeSuite":3,"After":0,"AfterSuite":0}
    Timeouts: 3
 › [Session] Starting singleton browser session
  test I should retry
    Retries: 3
 › Test Timeout: 3s
    I am on page "/"
    I see "Moreee information..."
    [1] Error | Error
    [1] Error | Error
    [1] <teardown> Stopping recording promises
 › <screenshotOnFail> Test failed, try to save a screenshot
 › Screenshot is saving to /root/test/output/test_I_should_retry.failed.png
  ✖ FAILED in 449ms

    [2]  Starting recording promises

-- FAILURES:

  1) Check retries
       test I should retry:

      expected web application to include "Moreee information..."
      + expected - actual

      -Example Domain
      -
      -This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
      -
      -More information...
      +Moreee information...
      
  
  
  Scenario Steps:
  - I.see("Moreee information...") at Test.<anonymous> (./my_test.js:6:6)
  - I.amOnPage("/") at Test.<anonymous> (./my_test.js:5:6)
  
  Artifacts:
  - screenshot: /root/test/output/test_I_should_retry.failed.png

Provide test source code if related

Feature('Check retries');


Scenario('test I should retry', ({ I }) => {
   I.amOnPage("/");
   I.see("Moreee information...");

});

Details

  • CodeceptJS version:3.4.1/3.4.0
  • NodeJS Version: v18.14.2
  • Operating System: Debian 10(buster)
  • Playwright: 1.30.0
  • Configuration file:
/** @type {CodeceptJS.MainConfig} */
const { setCommonPlugins } = require('@codeceptjs/configure');

setCommonPlugins();
exports.config = {
  tests: './*_test.js',
  output: './output',
  helpers: {
    Playwright: {
      ignoreHTTPSErrors: true,
      url: 'http://example.com',
      show: false,
      browser: 'chromium'
    }
  },
  include: {
    I: './steps_file.js'
  },
  name: 'test',
  timeout:3,
  retry: {
    grep: '',
    Feature: 0,
    Scenario: 3,
    Before: 3,
    BeforeSuite: 3,
    After: 0,
    AfterSuite: 0,
  },
}
@dianaDBB
Copy link

Any update on this?

I'm having the exact same issue

I tried configs:

  • option 1
exports.config = {
  retry: 2,
}
  • option 2
exports.config = {
  retry: [
    {
      Scenario: 2
    }
  ],
}
  • option 3
exports.config = {
  retry: {
    Scenario: 2
  },
}

And with all of the above, I never have the retry.

If I add the .retry(2) to a specific Scenario (or to entire Feature), then the retry works as expected.


Also, is there any way to include on the results that a specific test run is a retry?

Right now we have, for example:

✖ Failed scenario example in 9133ms
✖ Failed scenario example in 8954ms
✖ Failed scenario example in 8374ms

It would be amazing to have something like:

✖ Failed scenario example in 9133ms
✖ Failed scenario example (retry 1) in 8954ms
✖ Failed scenario example (retry 2) in 8374ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants