CodedUI 测试 + deferred/promise:Mouse.Click() 执行点击,调用 httpPost,没有 'then' 或 'finally' 被点击
CodedUI Test + deferred/promise: Mouse.Click() does the click, httpPost is called, no 'then' or 'finally' being hit
我正在自动执行用户单击 'calculate' 按钮的测试。
计算出一些值,然后显示在新的网格中。在手动点击时,此计算需要大约 4 秒的时间才能使额外的控件显示在屏幕上。
当我 运行 测试按钮被正确点击时,但之后应用程序冻结。
我试过:
- WaitForControlReady
- WaitForControlEnabled
- WaitForControlVisible
- WaitForControlExist
- TryGetClickablePoint
- Thread.Sleep
- Playback.Wait
- Playback.PlaybackSettings.DelayBetweenActions
- 做 { Thread.Sleep } 而 (!TryGetClickablePoint())
- 重试
都没有成功。
计算按钮将调用 javascript 方法(带有 deferred/promise),后者又会调用 c# 方法进行实际计算。
当点击后没有Playback.Wait(5000)时,c#代码的http.post没有生成
所以我稍等了 5 秒,现在正在拨打电话,我可以看到收到响应。但是,'.then'(或'.finally')没有被击中.
我看过这里CodedUI Test- Mouse.Click() on control dose not give expected outcome
在这里 Coded UI Tests - Clicking button does suddenly not work 但我无法从其中任何一个中推导出解决方案。
我们将不胜感激任何帮助。
一旦浏览器打开,CodedUI 就会注入 javascript,不幸的是,这破坏了 Ajax 调用的处理方式并破坏了站点。
您需要将以下内容添加到您的 app.config
<add key="WebWaitForReadyLevel" value="3"/>
https://fluentbytes.com/how-to-prevent-codedui-tests-from-breaking-angular-ajax-calls/
我正在自动执行用户单击 'calculate' 按钮的测试。
计算出一些值,然后显示在新的网格中。在手动点击时,此计算需要大约 4 秒的时间才能使额外的控件显示在屏幕上。
当我 运行 测试按钮被正确点击时,但之后应用程序冻结。
我试过:
- WaitForControlReady
- WaitForControlEnabled
- WaitForControlVisible
- WaitForControlExist
- TryGetClickablePoint
- Thread.Sleep
- Playback.Wait
- Playback.PlaybackSettings.DelayBetweenActions
- 做 { Thread.Sleep } 而 (!TryGetClickablePoint())
- 重试
都没有成功。
计算按钮将调用 javascript 方法(带有 deferred/promise),后者又会调用 c# 方法进行实际计算。
当点击后没有Playback.Wait(5000)时,c#代码的http.post没有生成
所以我稍等了 5 秒,现在正在拨打电话,我可以看到收到响应。但是,'.then'(或'.finally')没有被击中.
我看过这里CodedUI Test- Mouse.Click() on control dose not give expected outcome 在这里 Coded UI Tests - Clicking button does suddenly not work 但我无法从其中任何一个中推导出解决方案。
我们将不胜感激任何帮助。
一旦浏览器打开,CodedUI 就会注入 javascript,不幸的是,这破坏了 Ajax 调用的处理方式并破坏了站点。
您需要将以下内容添加到您的 app.config
<add key="WebWaitForReadyLevel" value="3"/>
https://fluentbytes.com/how-to-prevent-codedui-tests-from-breaking-angular-ajax-calls/