Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.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
Protractor 黄瓜量角器多重期望与通知_Protractor_Cucumber_Chai As Promised - Fatal编程技术网

Protractor 黄瓜量角器多重期望与通知

Protractor 黄瓜量角器多重期望与通知,protractor,cucumber,chai-as-promised,Protractor,Cucumber,Chai As Promised,我的场景中有一个步骤,填充多个文本字段并从下拉列表中选择选项。我想声明,输入的文本和选择的选项对每一项都是正确的 expect(action1).to.eventually.have.string('some text').and.notify(callback); expect(action2).to.eventually.have.string('some text').and.notify(callback); expect(action3).to.eventually.have.stri

我的场景中有一个步骤,填充多个文本字段并从下拉列表中选择选项。我想声明,输入的文本和选择的选项对每一项都是正确的

expect(action1).to.eventually.have.string('some text').and.notify(callback);
expect(action2).to.eventually.have.string('some text').and.notify(callback);
expect(action3).to.eventually.have.string('some text').and.notify(callback);
我遇到的问题是,如果第一个或第二个expect操作通过,那么任何后续操作都不会执行,从而导致误报


理想情况下,我正在寻找一种方法,在最后一次预期之前不进行回调就通知。有人知道如何做到这一点吗?

我实际上在另一个StackOverflow问题中找到了一个我最初没有注意到的答案

使用Q,它看起来像这样:

var Q = require('q');
var chai = require('chai');
var expect = chai.expect;
var should = chai.should();

Q.all([
  expect(action1).to.eventually.have.string('some text'),
  expect(action2).to.eventually.have.string('some text'),
  expect(action3).to.eventually.have.string('some text'),
]).should.notify(callback);