我在给定的Jasmine规范中对我的所有个人量角器测试都已通过,但该规范仍然失败了:
Failed: Error while waiting for Protractor to sync with the page: "hooks is undefined"
我无法找到任何关于“钩子未定义”含义的信息。
使用[email protected] firefox 57.0.3
没有堆栈跟踪;错误的全文如下:
An error was thrown in an afterAll
AfterAll Failed: Error while waiting for Protractor to sync with the page: "hooks is undefined"
当角度加载到该页面之前,量角器在beforeAll,beforeEach,afterAll或afterEach挂钩期间尝试与页面交互时,可能会抛出该错误。它可能由于“无法读取未定义的属性'$$ testability'的原因基本相同”。
一个可能的解决方案是将它放在钩子中任何量角器活动的上方:
browser.sleep(2000);
和/或增加前/后挂钩中现有睡眠的长度,以便在调用量角器之前,页面有时间首先加载角度。