我在我的场景中有一个步骤,即填充多个文本字段并从下拉列表中选择选项。我想声明输入的文本和选择的选项对每个都是正确的。
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);
我遇到的问题是,如果第一个或第二个期望操作通过,那么任何后续操作都不会被执行导致误报。
理想情况下,我正在寻找一种方法,在没有回调的情况下通知,直到最后的预期。任何人都知道如何做到这一点?
答案 0 :(得分:0)
我实际上在另一个我最初没有注意到的StackOverflow问题中找到了答案。
How does one use Q.all with chai-as-promised?
使用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);