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