chore(test): use pathToFileURL (#3292)
This commit is contained in:
parent
3c2fcb7fe4
commit
9ec026730f
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const url = require('url');
|
||||||
|
|
||||||
const {FFOX, CHROMIUM, WEBKIT, WIN, LINUX, ASSETS_DIR} = testOptions;
|
const {FFOX, CHROMIUM, WEBKIT, WIN, LINUX, ASSETS_DIR} = testOptions;
|
||||||
|
|
||||||
|
|
@ -58,10 +59,7 @@ it.fail(WEBKIT && WIN)('should play video', async({page}) => {
|
||||||
const absolutePath = path.join(ASSETS_DIR, fileName);
|
const absolutePath = path.join(ASSETS_DIR, fileName);
|
||||||
// Our test server doesn't support range requests required to play on Mac,
|
// Our test server doesn't support range requests required to play on Mac,
|
||||||
// so we load the page using a file url.
|
// so we load the page using a file url.
|
||||||
const url = WIN
|
await page.goto(url.pathToFileURL(absolutePath).href);
|
||||||
? 'file:///' + absolutePath.replace(/\\/g, '/')
|
|
||||||
: 'file://' + absolutePath;
|
|
||||||
await page.goto(url);
|
|
||||||
await page.$eval('video', v => v.play());
|
await page.$eval('video', v => v.play());
|
||||||
await page.$eval('video', v => v.pause());
|
await page.$eval('video', v => v.pause());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const utils = require('./utils');
|
|
||||||
const path = require('path');
|
|
||||||
const url = require('url');
|
|
||||||
const {FFOX, CHROMIUM, WEBKIT, ASSETS_DIR, MAC, WIN} = testOptions;
|
|
||||||
|
|
||||||
it('should work with _blank target', async({page, server}) => {
|
it('should work with _blank target', async({page, server}) => {
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.end(`<a href="${server.EMPTY_PAGE}" target="_blank">Click me</a>`);
|
res.end(`<a href="${server.EMPTY_PAGE}" target="_blank">Click me</a>`);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const utils = require('./utils');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
const {FFOX, CHROMIUM, WEBKIT, ASSETS_DIR, MAC, WIN} = testOptions;
|
const {FFOX, CHROMIUM, WEBKIT, ASSETS_DIR, MAC, WIN} = testOptions;
|
||||||
|
|
@ -56,9 +55,7 @@ it('page.goBack should work with HistoryAPI', async({page, server}) => {
|
||||||
|
|
||||||
it.fail(WEBKIT && MAC)('page.goBack should work for file urls', async ({page, server}) => {
|
it.fail(WEBKIT && MAC)('page.goBack should work for file urls', async ({page, server}) => {
|
||||||
// WebKit embedder fails to go back/forward to the file url.
|
// WebKit embedder fails to go back/forward to the file url.
|
||||||
const url1 = WIN
|
const url1 = url.pathToFileURL(path.join(ASSETS_DIR, 'empty.html')).href;
|
||||||
? 'file:///' + path.join(ASSETS_DIR, 'empty.html').replace(/\\/g, '/')
|
|
||||||
: 'file://' + path.join(ASSETS_DIR, 'empty.html');
|
|
||||||
const url2 = server.EMPTY_PAGE;
|
const url2 = server.EMPTY_PAGE;
|
||||||
await page.goto(url1);
|
await page.goto(url1);
|
||||||
await page.setContent(`<a href='${url2}'>url2</a>`);
|
await page.setContent(`<a href='${url2}'>url2</a>`);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue