Testcafe 页面重新加载

ing*_*ngo 3 testing automated-tests page-refresh e2e-testing testcafe

如何使用 testcafe 重新加载当前页面?我发现

.eval(() => location.reload(true))
Run Code Online (Sandbox Code Playgroud)

但看起来像旧代码,目前的TestCafe 不理解这一点。(无功能错误)

mlo*_*sev 6

这是重新加载测试页面的正确方法。查看完整的测试示例:

import { Selector } from 'testcafe';

fixture `New Fixture`
    .page ('https://devexpress.github.io/testcafe/example/');

test('New Test', async t => {
    await t.typeText('#developer-name', 'Peter Parker');

    await t.eval(() => location.reload(true));

    await t
        .wait(3000)
        .expect(Selector('#developer-name').value).eql('');
});
Run Code Online (Sandbox Code Playgroud)