Skip to content

Bug: UnhandledPromiseRejectionWarning: video.delete: #2986

@ansonliao

Description

@ansonliao

What are you trying to achieve?

When the test of Playwright is passed and CodeceptJS tries to delete the recorded video of testing (set to keep the video only for the failed test), will meet the error: UnhandledPromiseRejectionWarning: video.delete:

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

# /codeceptjs run -c ./ 
creating output directory: /repo/codecept-playwright-sample/output
CodeceptJS v3.1.1
Using test root "/repo/codecept-playwright-sample/"

Login --
📋 Writing results to ReportPortal: selenide-reportportal > http://localhost:53880/api/v1
  ✔ Login with the valid staff account should be passed | {"role":"staff"} @smoke @regression in 4141ms
(node:10342) UnhandledPromiseRejectionWarning: video.delete: 

(node:10342) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:10342) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
# paste output here

Provide test source code if related

Details

  • CodeceptJS version: 3.1.1
  • Codecept-UI version: 0.4.6
  • NodeJS Version: v12.20.1
  • Operating System: macOS
  • Playwright: 1.13.1
  • Configuration file:
const {setHeadlessWhen} = require('@codeceptjs/configure');

// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

exports.config = {
  tests: './tests/e2e/*.spec.*',
  output: './output',
  helpers: {
    Playwright: {
      url: 'http://localhost:8080/#',
      show: true,
      browser: 'chromium',
      video: true,
      restart: true,
      fullPageScreenshots: true,
      trace: true,
      waitForTimeout: 10_000,
      getPageTimeout: 10_000,
      waitForNavigation: 'networkidle0',
    },
    ChaiWrapper: {
      require: 'codeceptjs-chai',
    },
    MyHelper: {
      require: './tests/e2e/helper/my_helper.js',
    },
  },
  include: {
    I: './steps_file.js',
    loginPage: './tests/e2e/pages/LoginPage.js',
  },
  bootstrap: null,
  mocha: {},
  name: 'xxxx',
  plugins: {
    pauseOnFail: {},
    stepByStepReport: {
      enabled: false,
    },
    retryFailedStep: {
      enabled: false,
    },
    tryTo: {
      enabled: true,
    },
    screenshotOnFail: {
      enabled: true,
    },
    reportportal: {
      enabled: true,
      require: 'xxxx',
      token: 'xxxx',
      endpoint: 'xxxx,
      launchName: 'xxxx',
      projectName: 'xxxx',
      return: false,
      debug: false,
    },
    allure: {
      enabled: true,
    },
  },
};

Could you help to advise how can I solve this problem? thanks.

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