0

I have written a code where it will launch the app, click on the login button, enter username and password and click on sign in.

When I run this using node 'filename' it is running fine with no issue.

When I run using mocha node_modules/mocha/bin/mocha 'filename' I am getting the error I am not able to understand as to why?

This is the error that I am getting:

2019-01-02T06:52:42.721Z DEBUG wdio-config: wdio-sync not found, running tests asynchronous

/home/user/newtest/node_modules/webdriverio/src/utils.js:199
    (typeof caps['appium-version'] !== 'undefined') ||
                ^
TypeError: Cannot read property 'appium-version' of undefined
at mobileDetector (/home/user/newtest/node_modules/webdriverio/src/utils.js:199:21)
at Object.remote (/home/user/newtest/node_modules/webdriverio/src/index.js:35:29)
at Object.<anonymous> (/home/user/newtest/test13.js:16:21)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:659:17)
at require (internal/modules/cjs/helpers.js:22:18)
at /home/user/newtest/node_modules/mocha/lib/mocha.js:250:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/home/user/newtest/node_modules/mocha/lib/mocha.js:247:14)
at Mocha.run (/home/user/newtest/node_modules/mocha/lib/mocha.js:576:10)
at Object.<anonymous> (/home/user/newtest/node_modules/mocha/bin/_mocha:637:18)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:776:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
at startExecution (internal/bootstrap/node.js:276:5)
at startup (internal/bootstrap/node.js:227:5)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
  • update WDIO test to v5 – Rao Jan 2 '19 at 7:51
  • i did still i am facing same issue @Rao – manoj Jan 2 '19 at 8:24
0

First of all see Which equals operator (== vs ===) should be used in JavaScript comparisons?

You're using Strict equality operator with undefined. Strict equality check for both the type and value to be equal.

typeof returns string.

Thus,

typeof chartTheme === 'undefined'

returns true.

In other words,

undefined !== 'undefined'

but,

undefined == 'undefined'.
|improve this answer|||||
0

There are bunch of breaking changes in v5 that doesn't allow a seamless upgrade,if you want update WDIO test to v5, you can see docs

you can also use v4 to reslove this problem.

some details you can see issues

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.