【发布时间】:2019-10-31 09:35:00
【问题描述】:
我来了
Jasmine 规范超时。重置
WebDriver控制流。
我之前也使用过fakesyn,但收到与上述相同的错误消息。
请帮帮我
这是我的规格:
describe('CW Login Page', function() {
var username;
var password;
var login;
beforeEach(() => {
browser.waitForAngularEnabled(false);
browser.get('http://www.testing.com/');
console.log('after link await');
});
it('should find the element and send the parameters', fakeAsync(() => {
setTimeout(function() {
value=0;
console.log('Inside it function');
username = element(by.id('userIDInput'));
password= element(by.id('passwordInput'));
login= element(by.id('login'));
console.log('After await');
username.sendKeys('abc');
password.sendKeys('abc');
login.click();
console.log("After it function");
},5000);
tick(5000);
}));
`beforeEach`(() => {
console.log('\r\n ---=== TESTS FINISHED!!! ===--- \r\n');
});
});
这是我的配置:
exports.config = {
allScriptsTimeout: 50000,
getPageTimeout:40000,
framework:'jasmine2',
/*seleniumAddress: 'http://localhost:4723/wd/hub', // Ignored if directConnect is true
specs: ['loginpage.js'],*/
seleniumAddress: 'https://hub.testingbot.com/wd/hub',
specs: ['./src/loginpage_fakeasync.e2e-specs.js'],
seleniumArgs: ['--dev-server-target'], // '--dev-server-target' ],
directConnect: false, //Change this to true for your local testing
multiCapabilities: [{ // in 1 chrome run the 10 specs sequentially
browserName: 'chrome',
platform: 'Android',
version: '7.1',
platformName: 'Android',
deviceName: 'Pixel 2',
client_key: "abc",
client_secret: "xyz"
}],
jasmineNodeOpts: {
onComplete: null, //jasmine framework details
isVerbose: false,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 40000,
print: function() {}
我希望使用自动化脚本打开网页并登录。如果有人能找出错误,那将是一个很大的帮助
我来了
Jasmine 规范超时。重置
WebDriver控制流。
我之前也使用过fakesyn,但收到与上述相同的错误消息。
请帮帮我
【问题讨论】:
-
我有一些问题,你在测试非 Angular 应用吗?你为什么要使用
fakeAsync?设置超时的目的仅仅是为了稍微延迟规范的执行吗? -
是的,我正在测试非 Angular Web 应用程序。我正在使用 fakeAsync 以便命令等待上一个命令完成。当我运行该应用程序时,它没有打开网页,它会尝试 2 分钟,然后给出超时错误。因此我提到了设置超时。但我仍然收到相同的错误消息。请帮忙,因为我认为我缺少一些语法。
-
您感兴趣的测试套件有多大?可能值得转向 async/await 承诺处理,因为它更容易调试异步问题。
标签: javascript angularjs typescript protractor