Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testcafe Page reload

How I can reload the current page with testcafe? I found

.eval(() => location.reload(true))

But it looks like an old code, current TestCafe do not understand this. (No function error)

like image 483
ingo Avatar asked Sep 09 '26 00:09

ingo


1 Answers

It's the correct way to reload the tested page. See a full test example:

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('');
});
like image 180
mlosev Avatar answered Sep 12 '26 16:09

mlosev