Playwright: I.waitForText() causes unexpected delay equal to `waitForTimeout` value at the end of test suite

It's a regression in 3.7.0 (also 3.7.3 is affected). It works well in 3.6.10.

Steps:

Run this test using npx codeceptjs run --verbose --colors|ts; date (it logs a current time during the test and after it)

Feature('My');

Scenario('test something',  ({ I }) => {
    I.amOnPage('https://example.com');
    I.waitForText('Example Domain');
});

Expected result:

  • No delay when the test finishes, you get a shell immediately

Actual result:

  • It waits for waitForTimeout when the test finishes, in my case 30 secs.
mirao@jobr-ubuntu:~/tmp$ npx codeceptjs run --verbose --colors|ts; date
May 26 11:43:52 Deprecation Warning: 'tryTo' has been moved to the 'codeceptjs/effects' module. Disable tryTo plugin to remove this warning.
May 26 11:43:52 Deprecation Warning: 'retryTo' has been moved to the 'codeceptjs/effects' module. Disable retryTo plugin to remove this warning.
May 26 11:43:52 ***************************************
May 26 11:43:52 nodeInfo:  20.19.0
May 26 11:43:52 osInfo:  Linux 6.11 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
May 26 11:43:52 cpuInfo:  (16) x64 AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
May 26 11:43:52 chromeInfo:  136.0.7103.113
May 26 11:43:52 edgeInfo:  "N/A"
May 26 11:43:52 firefoxInfo:  undefined
May 26 11:43:52 safariInfo:  N/A
May 26 11:43:52 playwrightBrowsers:  "chromium: 136.0.7103.25, firefox: 137.0, webkit: 18.4"
May 26 11:43:52 If you need more detailed info, just run this: npx codeceptjs info
May 26 11:43:52 ***************************************
May 26 11:43:52 CodeceptJS v3.7.3 #StandWithUkraine
May 26 11:43:52 Using test root "/home/mirao/tmp"
May 26 11:43:52 Helpers: Playwright
May 26 11:43:52 Plugins: screenshotOnFail, tryTo, retryFailedStep, retryTo, eachElement
May 26 11:43:52 
May 26 11:43:52 My --
May 26 11:43:52 /home/mirao/tmp/My_test.js
May 26 11:43:52     [1]  Starting recording promises
May 26 11:43:52     Timeouts: 
May 26 11:43:52  › [Session] Starting singleton browser session
May 26 11:43:52   test something
May 26 11:43:52  › [New Session] {"ignoreHTTPSErrors":false,"acceptDownloads":true}
May 26 11:43:52   Scenario()
May 26 11:43:52     I am on page "https://example.com"
May 26 11:43:53     I wait for text "Example Domain"
May 26 11:43:53   ✔ OK in 671ms
May 26 11:43:53 
May 26 11:43:53 
May 26 11:43:53   OK  | 1 passed   // 1s
Mon 26 May 11:44:23 CEST 2025
mirao@jobr-ubuntu:~/tmp$

config

const { setHeadlessWhen, setCommonPlugins } = require('@codeceptjs/configure');
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

/** @type {CodeceptJS.MainConfig} */
exports.config = {
  tests: './*_test.js',
  output: './output',
  helpers: {
    Playwright: {
      browser: 'chromium',
      url: 'http://localhost',
      show: true,
      waitForTimeout: 30000
    }
  },
  include: {
    I: './steps_file.js'
  },
  name: 'tmp'
}

Used SW:

  • CodeceptJS 3.7.3
  • Playwright 1.52, Chromium