Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度量角器测试是否存在模态_Javascript_Angularjs_Protractor - Fatal编程技术网

Javascript 角度量角器测试是否存在模态

Javascript 角度量角器测试是否存在模态,javascript,angularjs,protractor,Javascript,Angularjs,Protractor,我试图在单击注册按钮时测试我的注册模式是否存在,我的问题是,在angular打开模式之前,量角器似乎完成了测试,测试失败,我的另一个解决方案是使用预期条件,但出于某种原因,这不起作用,wait函数不等待我设置的时间,测试正常运行,失败 var SignUpPage = require('./signup.page'); describe('signup page', function() { var SignupPage; beforeEach(function() { bro

我试图在单击注册按钮时测试我的注册模式是否存在,我的问题是,在angular打开模式之前,量角器似乎完成了测试,测试失败,我的另一个解决方案是使用预期条件,但出于某种原因,这不起作用,wait函数不等待我设置的时间,测试正常运行,失败

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);
  });

});
登录页面:

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;

如何测试这一点?

增加默认jasmine超时时间间隔可能会有所帮助:


一件可能有帮助的事情是增加默认jasmine超时时间间隔:


你能发布
SignupPage
的相关代码吗,特别是
getModalEle
?我添加了注册代码你能发布
SignupPage
的相关代码吗,特别是
getModalEle
?我添加了注册代码
jasmineNodeOpts: {
    showColors: true,
    isVerbose: true,
    includeStackTrace: true,
    defaultTimeoutInterval: 60000  // 60 seconds
}