Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Test timeout doesn't work with BDD scenarios

Open
#3,055 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js, playwright
Domain
testing

Research direction

Reproduce the issue with the shown CodeceptJS configuration, Playwright helper, and BDD scenario, then trace how the global timeout and Before hook timeout are applied. Confirm the behavior for both approaches and add a regression test showing that a scenario stops at the configured limit.

Written by the indexing model from the issue text.

Description

bug critical
What are you trying to achieve?

I would like to define a test timeout in order to prevent being stuck during the execution - native applications & websites can be down / blocked during the execution and I want to skip a test when it reaches a limit.

So I tried (without success) to use the 2 following features available in codeceptjs:

  1. Timeout setting in the configuration file: https://codecept.io/configuration/#configuration
exports.config = {
...
  timeout: 10000,
...
}
  1. Dynamic timeout override by using advanced options: https://codecept.io/advanced/#test-options
Before((test) => {
  test.timeout(10000);
});
What do you get instead?
  • Approach 1 - Timeout setting: has no effect at all
  • Approach 2 - Dynamic timeout override: test execution continues until the end and fails with timeout message if execution exceeds the threshold (see screenshot)

Example: timeout set to 10s, execution ran in 36s before displaying the error message

image

Details
  • CodeceptJS version: 3.1.2
  • NodeJS Version: 16.4.2
  • Operating System: Mac OS
  • Configuration file:
exports.config = {
  output: './output',
  timeout: 10000,
  helpers: {
    Playwright: {
      url: 'http://localhost',
      show: true,
      browser: 'chromium',
      waitForNavigation: 'domcontentloaded'
    },
    ChaiWrapper: {
      require: "codeceptjs-chai"
    }
  },
  include: {},
  mocha: {},
  bootstrap: null,
  teardown: null,
  hooks: [],
  gherkin: {
    features: './features/*.feature',
    steps: './step_definitions/*.js'
  },
  plugins: {
    screenshotOnFail: {
      enabled: true
    },
    pauseOnFail: {},
    retryFailedStep: {
      enabled: true
    },
    tryTo: {
      enabled: true
    }
  },
  tests: './*_test.js',
  name: 'cjs-training'
}
Dominant language
JavaScript
Stars
4.2k
Forks
756
Avg merge
2d 9h
Merged PRs (30d)
16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from codeceptjs/CodeceptJS

All issues in codeceptjs/CodeceptJS

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.