-
-
Notifications
You must be signed in to change notification settings - Fork 753
Closed
Labels
Description
What are you trying to achieve?
to inject the same "I" instance as being used in step runtime context in custom helper
What do you get instead?
undefined or different "I" instance
Provide test source code if related
I tried it to achieve the I injection in many ways
1.
class MyHelper extends Helper {
constructor(prop) {
super();
const {I} = inject(); → "I" is undefined
}
....
2.
class MyHelper extends Helper {
myMethod = message => {
const {I} = inject(); → "I" it is not the same instance being used in the context of step execution
};
.....
3.
class MyHelper extends Helper
{
async _before() {
const {I} = inject(); → "I" it is not the same instance being used in the context of step execution
};Details
- CodeceptJS version: 3.6.7
- NodeJS Version: v20.11.0
- Operating System: macOS 15.0.01
- puppeteer || webdriverio || testcafe version (if related)
- Configuration file:
codecept.conf.js:
...
module.exports = {
name: 'project',
tests: '../src/tests/**/*_test.js',
output: '../output',
bootstrap: null,
helpers: {
MyHelper: {
require: '../src/lib/helpers/MyHelper.js',
}
},
......The question:
Is there a way to get a hold of the same "I" instance being used during step exec and inject it into custom helper classes?
Thanks for your help and answer
Best Regards
Attila