我试图在单击注册按钮时测试我的注册模式是否存在,我的问题是看起来像量角器在角度打开模态之前完成测试并且测试失败,我的其他解决方案< / strong>是使用预期条件,但由于某种原因这也不起作用,等待函数不会等待我设置的时间,测试正常运行并失败。
var SignUpPage = require('./signup.page');
describe('signup page', function() {
var SignupPage;
beforeEach(function() {
browser.get('http://localhost:9000');
browser.waitForAngular();
SignupPage = new SignUpPage();
});
it('should open the modal when clicking signup in the main nav', function() {
var EC = protractor.ExpectedConditions;
SignupPage.clickModalBtn();
browser.wait(EC.presenceOf(SignupPage.getModalEle()), 10000);
expect(SignupPage.getModalEle().isPresent()).toBe(true);
});
});
Signuppage:
function SignUpPage() {
this.openModalBtn = element(by.css('.nav-sign-in-btn'));
this.modal = element(by.css('.reSkill-auth'));
this.email = element(by.css('input[type="email"'));
this.password = element(by.css('input[type="password"'));
this.signInBtn = element(by.css('button[type="submit"]'));
}
SignUpPage.prototype.clickModalBtn = function() {
this.openModalBtn.click();
}
SignUpPage.prototype.getModalEle = function() {
return this.modal;
}
SignUpPage.prototype.setEmailAndPassword = function() {
this.email.sendkeys('mail@gmail.com');
this.password.sendkeys('123456789');
}
SignUpPage.prototype.clickSignIn = function() {
this.signInBtn.click();
}
module.exports = SignUpPage;
我该如何测试?
答案 0 :(得分:0)
可能有帮助的一件事是增加默认茉莉花超时间隔:
jasmineNodeOpts: {
showColors: true,
isVerbose: true,
includeStackTrace: true,
defaultTimeoutInterval: 60000 // 60 seconds
}