量角器抛出超时异常后有没有办法停止它?

Is there a way to stop protractor after it throws a timeout exception?

量角器测试规范经常会抛出超时异常。

为了使调试和故障排除更容易,我想在超时异常后立即停止量角器并阻止它继续运行 测试。

但是尝试在每个 promise 处捕获超时异常看起来很难做到。

当量角器抛出超时异常时,还有其他方法可以停止它吗?

一个选择是让 jasmine 在第一次失败时退出 通过 jasmine-fail-fast:

Allow Jasmine tests to "fail-fast", exiting on the first failure instead of running all tests no matter what. This can save a great deal of time running slow, expensive tests, such as Protractor e2e tests.

另一个选项是 protractor-fail-fast 仅在 jasmine-fail-fast 不适合您的情况下。

This Protractor plugin is essentially a wrapper around jasmine-fail-fast, solving the problem of halting multiple Protractor instances once one of them has failed. Otherwise, a multi-capability Protractor test will take as long as the longest running test instance, potentially as long as if jasmine-fail-fast wasn't applied at all.