CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Custom helper functions are not calling after upgrading from 2 to3

Open midhunsanku opened this issue 1 year ago • 3 comments

created custom helper and added async function as below:

async fillField(selector, value) { await this.puppeteer.fillField(element, value) await this.puppeteer.page.keyboard.press("Tab") // function to wait for ajax Load }

Calling fillField in test files

I.fillField(selector, value) --> Its calling await this.puppeteer.fillField(element, value) instead of custom helper function

midhunsanku avatar Jan 23 '25 22:01 midhunsanku

I think it depends on order of helpers declared in config. There is no pre-defined list of helpers in the code so CodeceptJS has no differentiation is it standard one

Could you show your current config?

Try to add your own helper latest in the list If not helps add it as first

DavertMik avatar Jan 23 '25 22:01 DavertMik

We are currently upgrading from CodeceptJS 2.6.11 and Puppeteer 9.1.1 to CodeceptJS 3.6.0 and Puppeteer 24.1.0. However, we have observed that all our scripts are failing because our custom helper functions are not being called.

Below is codecept.conf.js strutcture:

const config= {

tests: "./features/*-test.js", output: "./output", helpers: {

Puppeteer: {

}, Helper1: { require: "./helpers/helper1.js" } . . . . . // all customer helpers

} include:{ I: "./src/support/navigation.js", } bootstart, teardown, plugins:{ }

}

midhunsanku avatar Jan 24 '25 00:01 midhunsanku

Any update on this.

Its working with updating the custom function names to clickOn, fillFieldOn and selectOptionOn instead of codecept(click, fillField and selectOption) default function names.

Is it bug in codeceptJS?

midhunsanku avatar Feb 10 '25 14:02 midhunsanku