Skip to content

Shell: Command fails: "Cannot read properties of undefined (reading 'goto')" #4844

Open
@mirao

Description

@mirao

It's a regression in 3.7.0. It works well in 3.6.10.

Steps:

  • Initialize a project
npx create-codeceptjs .
npx codeceptjs init # Create a Playwright test, with "Show browser window = yes"
  • Run shell
mirao@jobr:~/workspace/my$ codeceptjs shell
Deprecation Warning: 'tryTo' has been moved to the 'codeceptjs/effects' module. Disable tryTo plugin to remove this warning.
Deprecation Warning: 'retryTo' has been moved to the 'codeceptjs/effects' module. Disable retryTo plugin to remove this warning.
Starting interactive shell for current suite...
Error processing test.before event:
TypeError: Cannot read properties of undefined (reading 'disableRetryFailedStep')
    at EventEmitter.<anonymous> (/home/mirao/workspace/my/node_modules/codeceptjs/lib/plugin/retryFailedStep.js:111:19)
    at EventEmitter.emit (node:events:536:35)
    at EventEmitter.emit (node:domain:489:12)
    at Object.emit (/home/mirao/workspace/my/node_modules/codeceptjs/lib/event.js:153:28)
    at module.exports (/home/mirao/workspace/my/node_modules/codeceptjs/lib/command/interactive.js:32:11)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Command.<anonymous> (/home/mirao/workspace/my/node_modules/codeceptjs/bin/codecept.js:38:7)
Error while loading home page: Cannot read properties of undefined (reading 'goto')}
 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.

BTW the message TypeError: Cannot read properties of undefined (reading 'disableRetryFailedStep') is strange. Not sure if it affects the next behavior (but maybe it's a different issue). Could you look at it?

  • Enter amOnPage("https://codecept.io/")

Expected result:

  • The command is performed

Actual result:

  • It fails
 I.amOnPage("https://codecept.io/")
 ERROR  Cannot read properties of undefined (reading 'goto')
 I.TypeError: Chaining cycle detected for promise #<Promise>
    at processTicksAndRejections (node:internal/process/task_queues:105:5)

Also I would expect that a Chromium in windowed mode should be started in the shell mode, but it doesn't happen 🐛 .


codecept.conf.ts:

import { setHeadlessWhen, setCommonPlugins } from '@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();

export const config: CodeceptJS.MainConfig = {
  tests: './*_test.ts',
  output: './output',
  helpers: {
    Playwright: {
      browser: 'chromium',
      url: 'http://localhost',
      show: true
    }
  },
  include: {
    I: './steps_file'
  },
  name: 'my'
}

Used SW:

  • CodeceptJS 3.7.0 or 3.7.2
  • Playwright 1.50.1
  • NodeJS 22
  • Ubuntu 24.04

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