CodeceptJS
CodeceptJS copied to clipboard
`.config({ manualStart: true })` logs error, and unable to start browsers manually (Playwright)
Operation
- Updating our project to codeceptjs 3.3.3 (from 3.0.7)
- Using Playwright
- Running any Feature/Scenario with
.config({ manualStart: true })
Outcome
An error is logged to the console:
TypeError: Cannot read properties of undefined (reading 'newContext')
And we're unable to start browsers manually with:
await this.helpers.Playwright._startBrowser();
What are you trying to achieve?
Using the config({ manualStart: true }) option without error, and (maybe separately) start browsers manually with this.helpers.Playwright._startBrowser()
What do you get instead?
Provide console output if related. Use
--verbosemode for more details.
➜ npx codeceptjs run --verbose
context
CodeceptJS v3.3.3 #StandWithUkraine
Using test root "/Users/djyarberjr/Desktop/base_codeceptjs"
Helpers: Playwright, REST, AssertWrapper
Plugins: screenshotOnFail
Feature name --
[1] Starting recording promises
context
› [Suite Config] Playwright {"manualStart":true}
Timeouts:
Scenario name
[1] Error | TypeError: Cannot read properties of undefined (reading 'newContext')
TypeError: Cannot read properties of undefined (reading 'newContext')
✔ OK in 5ms
context
› [Suite Config] Reverted for Playwright
OK | 1 passed // 20ms
Provide test source code if related
tests/test.ts
Feature("Feature name").config({ manualStart: true });
Scenario("Scenario name", ({ I }) => {
I.assert(1, 1);
});
Details
- CodeceptJS version: 3.3.3
- NodeJS Version: v16.14.2
- Operating System: macOS, Big Sur, Version 11.6.5 (20G527)
- Playwright 1.22.2
- Configuration file:
require("ts-node/register");
exports.config = {
tests: "./tests/**/*.ts",
output: "./output",
helpers: {
Playwright: {
url: "https://example.com",
show: true,
browser: "chromium",
},
REST: {},
AssertWrapper: {
require: "codeceptjs-assert",
},
},
include: {
I: "./steps_file.js",
},
bootstrap: null,
mocha: {},
name: "base_codeceptjs",
};
I'm starting browser this way: https://github.com/codeceptjs/CodeceptJS/issues/3248#issuecomment-1036619609 . Maybe it helps you.
Thanks! That does allow me to work around the issue! Can I ask how you are persisting the change (eg, forking the repo)?
Also totally fine if this was just an example to prove it works - which is a success! 😄
Can I ask how you are persisting the change (eg, forking the repo) @ImperfectDJ
- Make a change in a CodeceptJS helper in your project (I suppose you cloned it from Git)
- Run
npx patch-package codeceptjsin root of your project - it creates a patch file with your changes (it's a diff between orig file and changed file) - Then anytime you run
npm ciin your project, CodeceptJS is installed and the patch is applied
This issue is stale because it has been open for 90 days with no activity.