I am new to appium. I setup appium javascript client for iOS testing. I am trying to run my test on iOS emulator and it is not working. I don’t know what is wrong. Here is the error message:
platformName = ‘iOS’,
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid shorthand property initializer
at new Script (vm.js:84:7)
at createScript (vm.js:264:10)
at Object.runInThisContext (vm.js:312:10)
at Module._compile (internal/modules/cjs/loader.js:694:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
at Module.load (internal/modules/cjs/loader.js:626:32)
at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
at Function.Module._load (internal/modules/cjs/loader.js:558:3)
at Module.require (internal/modules/cjs/loader.js:663:17)
at require (internal/modules/cjs/helpers.js:20:18)
Here is my code:
var webdriverio = require('webdriverio');
var expect = require ('chai').expect;
var config = require ('./helpers/desiredCapabilities').options;
var client = webdriverio.remote (config);
describe ('Simple cases', function (){
before (function (){
this.timeout(50000);
return client.init();
});
describe('test-app-addition', function (){
it('add-3-3', function(){
return client.element('~IntegerA')
.setValue ('3')
.elementByAccessibilityId ('~IntegerB')
.setValue('3')
.click('~ComputeSumButton')
.element('~Answer')
.getText()
.then(function (text){
expect(text).to.equal('6');
});
});
});
after(function(){
return client.end();
});
});
(node:3754) UnhandledPromiseRejectionWarning: Error: Required option “capabilities” is missing
at validateConfig (/Users/simon.g/appium/node_modules/@wdio/config/build/utils.js:168:13)
at Object.remote (/Users/simon.g/appium/node_modules/webdriverio/build/index.js:28:45)
at Object. (/Users/simon.g/appium/test.js:6:28)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at /usr/local/lib/node_modules/mocha/lib/mocha.js:250:27
at Array.forEach ()
at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:247:14)
at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:576:10)
at Object. (/usr/local/lib/node_modules/mocha/bin/_mocha:637:18)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
at internal/main/run_main_module.js:21:11
(node:3754) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3754) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Main Describe
1) “before all” hook
2) “after all” hook
0 passing (8ms)
2 failing
Main Describe
“before all” hook:
TypeError: client.init is not a function
at Context. (test.js:17:19)
Main Describe
“after all” hook:
TypeError: client.end is not a function
at Context. (test.js:32:19)