【发布时间】:2017-10-03 18:14:51
【问题描述】:
我正在使用量角器和茉莉花进行自动化测试。 我正在注册页面上进行测试,代码如下:
it('Verify Alert message when New user registered itself for the first time',function() {
FuncLib.ButtonClick('Close'); //Close the error message displayed in previous scenario
Registration.Email.clear(); //Clear valid E-mail Id
Registration.Password.clear(); //Clear Password
Registration.ConfirmPassword.clear(); //Clear Confirm Password
Registration.Firstname.clear(); //clear Firstname Password
Registration.Lastname.clear(); //clear Lastname Password
Registration.Phonenumber.clear(); //clear phonenumber
browser.sleep(500);
Registration.Email.sendKeys('Forfirmtestuser+user217@gmail.com'); //Enter valid E-mail Id
Registration.Password.sendKeys('Hello1'); //Enter Password
Registration.ConfirmPassword.sendKeys('Hello1'); //Enter wrong Confirm Password
Registration.Firstname.sendKeys('candy'); //Enter Firstname Password
Registration.Lastname.sendKeys('smith'); //Enter Lastname Password
Registration.Phonenumber.sendKeys('9191919106'); //Enter phone number.
expect(Registration.Checkbox.isPresent()).toBe(true); // Terms and condition checkbox should display
Registration.Checkbox.click(); // select the Terms and condition checkbox
Registration.Checkbox.click(); // select the Terms and condition checkbox
browser.sleep(200);
expect(Registration.RegisterButton.isPresent()).toBe(true);
Registration.RegisterButton.click(); //click Register button
browser.sleep(200);
browser.driver.wait(function() { // Wait for the current URL to change to Home page
return browser.driver.getCurrentUrl().then(function(url) {
return (/home/).test(url);
});
});
expect(browser.getCurrentUrl()).toEqual(Registration.HomeURL);
console.log('When New user registered itself for the first time:');
expect(Registration.AlertMsg.getText()).toEqual(Registration.msg6);
Registration.AlertMsg.getText().then(function(text) {
console.log(' When New user registered itself for the first time:'); //Jasmine expect statement : compare actual and expected value
});
});
在这部分代码之前一切正常:
expect(Registration.RegisterButton.isPresent()).toBe(true);
Registration.RegisterButton.click(); //click Register button
browser.sleep(200);
browser.driver.wait(function() { // Wait for the current URL to change to Home page
return browser.driver.getCurrentUrl().then(function(url) {
return (/home/).test(url);
});
});
expect(browser.getCurrentUrl()).toEqual(Registration.HomeURL);
console.log('When New user registered itself for the first time:');
expect(Registration.AlertMsg.getText()).toEqual(Registration.msg6);
Registration.AlertMsg.getText().then(function(text) {
console.log(' When New user registered itself for the first time:'); //Jasmine expect statement : compare actual and expected value
});
最后我在报告中收到此错误: 错误:超时 - 在 jasmine.DEFAULT_TIMEOUT_INTERVAL 指定的超时内未调用异步回调
我真的不明白为什么。
【问题讨论】:
-
增加 config.js 文件中的 'defaultTimeoutInterval:60000'
标签: angularjs jasmine protractor automated-tests