gpt4 book ai didi

javascript - ptor 在第二个测试步骤中未定义

转载 作者:行者123 更新时间:2023-11-29 10:44:10 25 4
gpt4 key购买 nike

我目前正在尝试使用 Protractor (因为我们的自动化框架在 Angular 方面并不是那么出色;)),现在遇到了一个有趣的问题:我收到消息“类型错误:无法调用方法” waitForAngular' of undefined"在我的第二个描述 block 中对我来说没有真正明显的原因。

可以在此处找到我正在运行的(精简的)代码以及堆栈跟踪:https://gist.github.com/FrankyBoy/8675399e2236e8235e79

感谢任何帮助,因为我非常困惑。

最佳答案

beforeEach 函数仅在it 函数之前运行,而不是在describe 函数之前运行。因此,当您尝试使用 ptor 对象时,对 ptor = protractor.getInstance() 的调用尚未发生。

我怀疑要解决这个问题,您需要将 waitForAngular 调用移动到 it 函数中,如下所示:

describe('Bonus landing page', function () {
it('should wait', function() {
ptor.waitForAngular(); // dies with "Cannot call method 'waitForAngular' of undefined"
// more checks were here, but it also works like this
});
});

关于javascript - ptor 在第二个测试步骤中未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22717600/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com