Jasmine toThrow proctractor错误的错误

时间:2017-03-20 12:28:10

标签: jasmine

是否有可能发现量角器错误?我尝试过:

let MagicBtn = element(by.css('.submitBtn'));
expect(() => {(MagicBtn.click();}).toThrowError("Failed: No element found using locator: By(css selector, a[id=link33])");

或不同的案例如:

expect(MagicBtn.click()).toThrowError("Failed: No element found using locator: By(css selector, a[id=link33])");

或创建一个新函数并通过throwerror捕获它:

var foo = function() {
                MagicBtn.click();
            };
let exception1 = new TypeError('Failed: No element found using locator: By(css selector, a[id=link33])')

expect(foo).toThrowError(exception1);

但是toThrowError捕获了不是由量角器引起的错误(当然这是可以理解的) - 我只是觉得它是否可以解决

0 个答案:

没有答案