|
18 | 18 | const utils = require('./utils'); |
19 | 19 | const path = require('path'); |
20 | 20 | const url = require('url'); |
21 | | -const {FFOX, CHROMIUM, WEBKIT, MAC, WIN, CHANNEL} = utils.testOptions(browserType); |
| 21 | +const {FFOX, CHROMIUM, WEBKIT, ASSETS_DIR, MAC, WIN, CHANNEL} = utils.testOptions(browserType); |
22 | 22 |
|
23 | 23 | describe('Page.goto', function() { |
24 | 24 | it('should work', async({page, server}) => { |
@@ -896,6 +896,32 @@ describe('Page.goBack', function() { |
896 | 896 | await page.goForward(); |
897 | 897 | expect(page.url()).toBe(server.PREFIX + '/first.html'); |
898 | 898 | }); |
| 899 | + it.fail(WEBKIT && MAC)('should work for file urls', async ({page, server}) => { |
| 900 | + // WebKit embedder fails to go back/forward to the file url. |
| 901 | + const url1 = WIN |
| 902 | + ? 'file:///' + path.join(ASSETS_DIR, 'empty.html').replace(/\\/g, '/') |
| 903 | + : 'file://' + path.join(ASSETS_DIR, 'empty.html'); |
| 904 | + const url2 = server.EMPTY_PAGE; |
| 905 | + await page.goto(url1); |
| 906 | + await page.setContent(`<a href='${url2}'>url2</a>`); |
| 907 | + expect(page.url().toLowerCase()).toBe(url1.toLowerCase()); |
| 908 | + |
| 909 | + await page.click('a'); |
| 910 | + expect(page.url()).toBe(url2); |
| 911 | + |
| 912 | + await page.goBack(); |
| 913 | + expect(page.url().toLowerCase()).toBe(url1.toLowerCase()); |
| 914 | + // Should be able to evaluate in the new context, and |
| 915 | + // not reach for the old cross-process one. |
| 916 | + expect(await page.evaluate(() => window.scrollX)).toBe(0); |
| 917 | + // Should be able to screenshot. |
| 918 | + await page.screenshot(); |
| 919 | + |
| 920 | + await page.goForward(); |
| 921 | + expect(page.url()).toBe(url2); |
| 922 | + expect(await page.evaluate(() => window.scrollX)).toBe(0); |
| 923 | + await page.screenshot(); |
| 924 | + }); |
899 | 925 | }); |
900 | 926 |
|
901 | 927 | describe('Frame.goto', function() { |
|
0 commit comments