Closed velgersdyk25 closed 3 years ago
Do you still have this issue when using browser.options
instead of browser.config
? We are planning to remove browser.config
in favor of browser.options
.
When you are extending your config with custom properties you should extend the WebdriverIO config interface and assign that instead in order to get the correct typing. I don't see anything wrong here really.
I agree with @erwinheitzman here that extending the WebdriverIO type should be the way to go. Closing.
Recently upgraded from v6 to v7 and encountered a type error _Error:(10, 31) TS2339: Property 'AUTH0_BASE_URL' does not exist on type 'Testrunner | WebdriverIO'._. This is when its called using browser.config call. Environment (please complete the following information):
Config of WebdriverIO / eslint-disable @typescript-eslint/no-var-requires / const debug = process.env.DEBUG; const defaultMochaTimeout = 600000000000000; const WebdriverIOHelpers = require("../../lib/util/webdriverIOHelpers"); const ElementHelpers = require("../../lib/util/elementHelpers"); const windowHeight = 1080; const windowWidth = 1920;
require("dotenv").config();
exports.baseConfig = { AUTH0_BASE_URL: "google.com" waitforTimeout: 10000, reporters: [ "spec", [ "mochawesome", { outputDir: "./Results", outputFileFormat: function(opts) { return
results-${opts.cid}.${opts.capabilities}.json
; }, }, ], ], mochawesomeOpts: { includeScreenshots: true, },mochaOpts: { ui: "bdd", timeout: debug ? 9000000000 : defaultMochaTimeout, requires: ["tsconfig-paths/register"], }, // onPrepare: function(config, capabilities) { // }, /**
browser
. It is the perfect place to define custom commands.@param {Array.} specs List of spec file paths that are to be run
*/
before: function(capabilities, specs) {
browser.setWindowSize(windowWidth, windowHeight);
// register custom commands to the global
browser
object browser.addCommand( "resetBrowserState", WebdriverIOHelpers.resetBrowserState ); browser.addCommand("randomEmail", WebdriverIOHelpers.randomEmail); browser.addCommand("softSignOut", WebdriverIOHelpers.softSignOut);// register custom commands to the global
element
object browser.addCommand( "scrollIntoViewAndClick", ElementHelpers.scrollIntoViewAndClick, true ); browser.addCommand( "scrollIntoViewAndSetValue", ElementHelpers.scrollIntoViewAndSetValue, true ); browser.addCommand( "uploadFileAndSetValue", ElementHelpers.uploadFileAndSetValue, true ); }, /**Describe the bug After updating to v7, I was getting a type error (Error:(10, 31) TS2339: Property 'AUTH0_BASE_URL' does not exist on type 'Testrunner | WebdriverIO'.) using the browser.config.AUTH0_BASE_URL command in a test. The config interface has been updated and all other custom browser command work fine. Has the use of browser.config changed in v7? I haven't seen any documentation that would state that. We looked through the code of both v6 and v7 and it looks like the type of config has moved in the code between versions.
To Reproduce Steps to reproduce the behavior: Add in a value to the wdio config and call it in a test as browser.config.YOUR_VALUE and upon compiling the Typescript you should get the error.
I can mock out some fake code, but because this is my works private repo, I cannot share it out.
Expected behavior Ability to use the command and state custom variables to call in tests