test: add a test for bfcache and history navigations (#17796)

Fixes #17618.
This commit is contained in:
Dmitry Gozman 2022-10-03 19:13:28 -07:00 committed by GitHub
parent 1311767f87
commit 99266e48ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,7 +53,6 @@ it('page.goBack should work with HistoryAPI', async ({ page, server }) => {
});
it('page.goBack should work for file urls', async ({ page, server, asset, browserName, platform, isAndroid }) => {
it.fixme(browserName === 'firefox', 'Firefox pretends, but does not complete goBack to the file url');
it.fail(browserName === 'webkit' && platform === 'darwin', 'WebKit embedder fails to go back/forward to the file url.');
it.skip(isAndroid, 'No files on Android');
@ -92,6 +91,18 @@ it('page.goBack should work for file urls', async ({ page, server, asset, browse
await page.screenshot();
});
it('goBack/goForward should work with bfcache-able pages', async ({ page, server }) => {
await page.goto(server.PREFIX + '/cached/one-style.html');
await page.setContent(`<a href=${JSON.stringify(server.PREFIX + '/cached/one-style.html?foo')}>click me</a>`);
await page.click('a');
let response = await page.goBack();
expect(response.url()).toBe(server.PREFIX + '/cached/one-style.html');
response = await page.goForward();
expect(response.url()).toBe(server.PREFIX + '/cached/one-style.html?foo');
});
it('page.reload should work', async ({ page, server }) => {
await page.goto(server.EMPTY_PAGE);
await page.evaluate(() => window['_foo'] = 10);