One of strings in array to match an expression

后端 未结 5 1595
花落未央
花落未央 2021-02-12 22:29

The Problem:

I have an array of promises which is resolved to an array of strings. Now the test should pass if at least one of the strings matc

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-12 23:14

    If this works,

    protractor.promise.all([text1, text2, text3]).then(function (values) {
        expect(values[0] + values[1] + values[2]).toMatch(/expression/);
    });
    

    I think you can write this as follows;

    protractor.promise.all([text1, text2, text3]).then(function (values) {
        expect(values.join('')).toMatch(/expression/);
    });
    

    And it's scalable. :)

提交回复
热议问题