在 IpadAir 中使用 appium 进行测试时量角器脚本无法启动
Protractor script cannot be launched while testing with appium in IpadAir
我有一个 Angular 网站,我想使用 appium 和量角器对其进行测试。我制作了以下配置文件:
exports.config = {
allScriptsTimeout: 600000,
seleniumAddress: 'http://0.0.0.0:4723/wd/hub',
specs: [
'testsuite/test1.js'
],
capabilities: {
browserName: 'safari',
'appium-version': '1.4.13',
platformName: 'iOS',
platformVersion: '9.3',
deviceName: 'iPad Air'
},
chromeOnly: false,
frameworks:[
'mocha',
'chai'
],
mochaOpts: {
defaultTimeoutInterval:1000000
}
};
test1.js 包含我通过 choosig Node.js 选项由 appium 记录器生成的测试脚本:
"use strict";
var wd = require("wd");
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
var expect = chai.expect;
chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
describe('my app', function() {
it('should make the login test',function() {
var browser = wd.promiseChainRemote("0.0.0.0", 4723);
browser.init(desired).then(function() {
return browser
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAButton[2]").sendKeys("0.22.82:4180/jws/fetablet_dev_T1000")
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText[1]").sendKeys("RET02")
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAButton[2]").sendKeys("RET02")
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText[2]").sendKeys("RET02")
.fin(function() {
return browser.quit();
});
}).done();
});
});
ᐧ
在 运行 Appium 服务器并启动 protractor.config.js 文件后我得到了这个错误
$ protractor protractor.conf.js
Using the selenium server at http://0.0.0.0:4723/wd/hub
[launcher] Running 1 instances of WebDriver
[launcher] Error: ReferenceError: ᐧ is not defined
at Object.<anonymous> (/Users/qaquod/Development/qa/qa_fetablet/testsuite/test1.js:32:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at /usr/local/lib/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:71:5
at Array.forEach (native)
at Jasmine.loadSpecs (/usr/local/lib/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:70:18)
[launcher] Process exited with error code 100
Jasmine 无法加载测试,因为规范末尾有额外的 ᐧ
字符,请将其删除。
我有一个 Angular 网站,我想使用 appium 和量角器对其进行测试。我制作了以下配置文件:
exports.config = {
allScriptsTimeout: 600000,
seleniumAddress: 'http://0.0.0.0:4723/wd/hub',
specs: [
'testsuite/test1.js'
],
capabilities: {
browserName: 'safari',
'appium-version': '1.4.13',
platformName: 'iOS',
platformVersion: '9.3',
deviceName: 'iPad Air'
},
chromeOnly: false,
frameworks:[
'mocha',
'chai'
],
mochaOpts: {
defaultTimeoutInterval:1000000
}
};
test1.js 包含我通过 choosig Node.js 选项由 appium 记录器生成的测试脚本:
"use strict";
var wd = require("wd");
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
var expect = chai.expect;
chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
describe('my app', function() {
it('should make the login test',function() {
var browser = wd.promiseChainRemote("0.0.0.0", 4723);
browser.init(desired).then(function() {
return browser
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAButton[2]").sendKeys("0.22.82:4180/jws/fetablet_dev_T1000")
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText[1]").sendKeys("RET02")
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAButton[2]").sendKeys("RET02")
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText[2]").sendKeys("RET02")
.fin(function() {
return browser.quit();
});
}).done();
});
});
ᐧ
在 运行 Appium 服务器并启动 protractor.config.js 文件后我得到了这个错误
$ protractor protractor.conf.js
Using the selenium server at http://0.0.0.0:4723/wd/hub
[launcher] Running 1 instances of WebDriver
[launcher] Error: ReferenceError: ᐧ is not defined
at Object.<anonymous> (/Users/qaquod/Development/qa/qa_fetablet/testsuite/test1.js:32:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at /usr/local/lib/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:71:5
at Array.forEach (native)
at Jasmine.loadSpecs (/usr/local/lib/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:70:18)
[launcher] Process exited with error code 100
Jasmine 无法加载测试,因为规范末尾有额外的 ᐧ
字符,请将其删除。