CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

How can I create a Custom Helper and use other Helpers inside then?

Open BrunoExterckotter opened this issue 8 years ago • 3 comments

I would like to use and be able to customize more than one helper in custom_helper. It is possible?

When WebDriverIO is the first one in codecept.json, only the chrome render the url, and if the Nightmare is the first one, the url is rendered only in Electron.

I am create a custom helper and I using something like this:

testCustomHelperWithNightmare(var1, var2) { this.helpers['Nightmare'].fillField(var1, var2); } testCustomHelperWithProtractor(var1, var2) { this.helpers['Protractor'].fillField(var1, var2); }

My codecept.json:

{ "output": "./output", "helpers": { "WebDriverIO": { "url": "http://www.google.com.br", "smartWait": 5000, "browser": "chrome", "keepCookies": true, "keepBrowserState": true, "restart": false, "windowSize": "maximize", "desiredCapabilities": { "acceptSslCerts": true, "javascriptEnabled": true, "acceptInsecureCerts": true, "chrome": { "browserName": "chrome", "name": "TEST_CHROME", "platform": "ANY", "version": "55.0" } } }, "Nightmare": { }, "Protractor": { }, "TestCustomHelper": { "require": "./testcustomhelper_helper.js" } .... }

BrunoExterckotter avatar Dec 07 '17 19:12 BrunoExterckotter

You are doing something weird. I guess you are trying to execute one test for Electron and for Web, right? Please tell what you are trying to do so I could give you any advice

DavertMik avatar Dec 10 '17 20:12 DavertMik

I'm trying to execute tests for firefox only, I would like to be able to create custom functions in my custom helper using the base of any helper.

BrunoExterckotter avatar Dec 11 '17 09:12 BrunoExterckotter

@BrunoExterckotter Is this something you are still interested in? If not I'll close the ticket as it is not a common use case.

reubenmiller avatar Feb 26 '18 20:02 reubenmiller