首页 > 解决方案 > TestCafe --retry-test-pages 空页面的行为

问题描述

我正在尝试了解 TC 的重试测试页面功能。让我们考虑一下我尝试运行测试但忘记运行前端应用程序(通常托管在 http://localhost:6666)的情况。测试运行器创建新的浏览器实例,重定向到 localhost:6666 但无法获得响应。

当前行为:

预期行为:

执行参数:

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);
    });

标签: testingautomationautomated-testse2e-testingtestcafe

解决方案


这是预期的行为。该--quarantine-mode选项重新启动整个测试。同时,--retry-test-pages在 Web 浏览器端重试发送请求。因此,浏览器应该知道该页面存在并且可以重试发送请求。从技术上讲,这意味着该fetch事件应该触发。


推荐阅读