testing - TestCafe --retry-test-pages 空页面的行为
问题描述
我正在尝试了解 TC 的重试测试页面功能。让我们考虑一下我尝试运行测试但忘记运行前端应用程序(通常托管在 http://localhost:6666)的情况。测试运行器创建新的浏览器实例,重定向到 localhost:6666 但无法获得响应。
当前行为:
- 隔离模式 - 尝试重新打开页面 3 次,引发错误。
- Retry-test-pages - 在第一次尝试时抛出错误。根本没有重试。
预期行为:
- 不应该 --retry-test-pages 在失败之前重试请求多达十次吗?
执行参数:
CLI:testcafe chrome ./features_tests/retry_test_pages --retry-test-pages --hostname localhost
代码:
import selectors from '../retryTestPages.po';
fixture("Retry Test Pages")
.beforeEach(async t => {
await t
.navigateTo(http://localhost:6666)
.expect(selectors.header.exists).ok({ timeout: 20000 });
});
test
('Test 1', async t => {
await t
.click(selectors.nonExistingElement);
});
解决方案
这是预期的行为。该--quarantine-mode
选项重新启动整个测试。同时,--retry-test-pages
在 Web 浏览器端重试发送请求。因此,浏览器应该知道该页面存在并且可以重试发送请求。从技术上讲,这意味着该fetch
事件应该触发。
推荐阅读
- node.js - 如何在没有模数检查的情况下确保公钥属于私钥(RSA)?
- azure - 无法在 Azure 机密计算 (ACC) 上创建 VM
- java - 在正则表达式中分离突发部分
- python - 如何垂直打印水平列表?更多信息在下面
- fortran - 逐行读取不同变量的文本文件
- html - 将设计表单输入值设置到 div 的右侧
- java - StringBuffer中“buffer”这个词怎么表示同步
- javascript - 如何通过 post 方法和 nodejs 发送多种编码类型?
- java - Android-Studio:如何将地图附加到 NavigationDrawer 片段
- python - 无法按标签删除熊猫数据框中的列