What are you trying to achieve?
In my application, there are several ReactJS fields for which we utilize the executeScript command to assign values. While this process functions correctly in a non-parallel execution environment, it encounters issues when executed in parallel.
**Note: this works fine with codeceptjs versions lesser than 3.5.8 (Example, with 3.5.6 this error does not occur).
Command to run the test
npx codeceptjs run-workers 2 profile1 --verbose
**
What do you get instead?
Provide console output if related. Use --verbose mode for more details.
Error processing test.after event:
DataCloneError: function(name, func, attachToElement = false, proto, instances) {
const customCommand = typeof com...<omitted>... } could not be cloned.
at new DOMException (node:internal/per_context/domexception:53:5)
at sendToParentThread (E:\Codeceptjs_pipeline\parenttrigger\node_modules\codeceptjs\lib\command\workers\runTests.js:282:14)
at EventEmitter.<anonymous> (E:\Codeceptjs_pipeline\parenttrigger\node_modules\codeceptjs\lib\command\workers\runTests.js:227:49)
at EventEmitter.emit (node:events:530:35)
at EventEmitter.emit (node:domain:488:12)
at Object.emit (E:\Codeceptjs_pipeline\parenttrigger\node_modules\codeceptjs\lib\event.js:149:28)
at E:\Codeceptjs_pipeline\parenttrigger\node_modules\codeceptjs\lib\scenario.js:182:11
at injectHook (E:\Codeceptjs_pipeline\parenttrigger\node_modules\codeceptjs\lib\scenario.js:10:5)
at module.exports.teardown (E:\Codeceptjs_pipeline\parenttrigger\node_modules\codeceptjs\lib\scenario.js:180:10)
at Context.<anonymous> (E:\Codeceptjs_pipeline\parenttrigger\node_modules\codeceptjs\lib\ui.js:114:66)Provide test source code if related
Feature('CodeceptJS test');const{I}=inject();Scenario('test something',async()=>{awaitI.amOnPage('/react/demos/?_gl=1*1lz342q*_ga*MTY3MTc2MDgxLjE3MDY2ODgzOTg.*_ga_41J4HFMX1J*MTcwNjY4ODM5Ny4xLjAuMTcwNjY4ODM5Ny4wLjAuMA..#/bootstrap5/textboxes/default');awaitI.wait(10);// temp adding a wait// for versions < 3.5.8 use helper to locate the elementconstelement=awaitI.grabWebElements({id: 'textbox_2'})// set the value in react text fieldawaitI.executeScript((element,value)=>{constvalueSetter=Object.getOwnPropertyDescriptor(element,'value').set;constprototype=Object.getPrototypeOf(element);constprototypeValueSetter=Object.getOwnPropertyDescriptor(prototype,'value').set;if(valueSetter&&valueSetter!==prototypeValueSetter){prototypeValueSetter.call(element,value);}else{valueSetter.call(element,value);}element.dispatchEvent(newEvent('input',{bubbles: true}));},element[0],'test');})Details
- CodeceptJS version: v3.5.12
- NodeJS Version: 20.11.0
- Operating System: Windows 11 10.0.22631 and MacOS
- puppeteer || webdriverio || testcafe version (if related) : "webdriverio": "^8.29.1"
- Configuration file:
const{ setHeadlessWhen, setCommonPlugins }=require('@codeceptjs/configure');// turn on headless mode when running with HEADLESS=true environment variable// export HEADLESS=true && npx codeceptjs runsetHeadlessWhen(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: {WebDriver: {host: 'localhost',port: 4444,url: 'https://ej2.syncfusion.com/',browser: 'MicrosoftEdge',windowSize: 'maximize',restart: true,}},multiple: {profile1: {browsers: [{browser: "MicrosoftEdge",},{browser: "chrome",}]}},include: {I: './steps_file.js'},fullPromiseBased: true,name: 'parenttrigger'}
What are you trying to achieve?
In my application, there are several ReactJS fields for which we utilize the
executeScriptcommand to assign values. While this process functions correctly in a non-parallel execution environment, it encounters issues when executed in parallel.**Note: this works fine with codeceptjs versions lesser than 3.5.8 (Example, with 3.5.6 this error does not occur).
Command to run the test
npx codeceptjs run-workers 2 profile1 --verbose**
What do you get instead?
Details