Доброго времени суток. Я новичок в области автотестов. Хочу запустить тест с помощью Protractor 5.5.1 и Appium 1.6.4
Столкнулся с проблемой. Protractor не может загрузить conf_android.js file и в консоли выдаёт ошибку. Файл example_spec.js с тестами находиться в одной папке с conf_android.js.
Логи ошибки.
*-ThinkPad-T410:~*/.nvm/versions/node/v7.4.0/lib/node_modules/protractor/example$ protractor conf_android.js
[17:37:26] E/configParser - Error code: 105
[17:37:26] E/configParser - Error message: failed loading configuration file conf_android.js
[17:37:26] E/configParser - */.nvm/versions/node/v7.4.0/lib/node_modules/protractor/example/conf_android.js:8
Appium: 'http://0.0.0.0:4723/wd/hub',
^^^^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:78:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at ConfigParser.addFileConfig (*/.nvm/versions/node/v7.4.0/lib/node_modules/protractor/built/configParser.js:123:26)
at Object.initFn [as init] (/.nvm/versions/node/v7.4.0/lib/node_modules/protractor/built/launcher.js:92:22)
-ThinkPad-T410:~/.nvm/versions/node/v7.4.0/lib/node_modules/protractor/example$ ^C
-ThinkPad-T410:~/.nvm/versions/node/v7.4.0/lib/node_modules/protractor/example$
Вот содержимое conf_android.js
exports.config = {
/*
* normally protractor runs tests on localhost:4444, but we want protractor to connect to appium
* which runs on localhost:4723
*/
framework: 'jasmine'
// Возможно неверно указал параметр Appium
Appium: 'http://0.0.0.0:4723/wd/hub',
specs: ['*/.nvm/versions/node/v7.4.0/lib/node_modules/protractor/example/example_spec.js'],
/*
* Some capabilities must be set to make sure appium can connect to your device.
* platformVersion: this is the version of android
* deviceName: your actual device name
* browserName: leave this empty, we want protractor to use the embedded webview
* autoWebView: set this to true for hybrid applications
* app: the location of the apk (must be absolute)
*/
capabilities: {
browserName: '',
app: '*/Загрузки/SOME_ANDROID_APP_.apk'
bundleId: '[com..],
deviceName: 'SOME DEVICE',
platformName: 'Android',
platformVersion: 6.0,
//udid: '[ONLY_FOR_iOS=THE_UDID_OF_DEVICE]'
autoWebview : true,
autoWebviewTimeout: 10000,
autoAcceptAlerts: 'true'
},
baseUrl: 'http://10.0.2.2:8000',
/* configuring wd in onPrepare
* wdBridge helps to bridge wd driver with other selenium clients
* See https://github.com/sebv/wd-bridge/blob/master/README.md
*/
onPrepare: function () {
var wd = require('wd'),
protractor = require('protractor'),
wdBridge = require('wd-bridge')(protractor, wd);
wdBridge.initFromProtractor(exports.config);
}
};