parent
7a7575461c
commit
22c28b6615
|
|
@ -642,15 +642,3 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
function pathToFileURL(path) {
|
|
||||||
let pathName = path.replace(/\\/g, '/');
|
|
||||||
// Windows drive letter must be prefixed with a slash.
|
|
||||||
if (!pathName.startsWith('/'))
|
|
||||||
pathName = '/' + pathName;
|
|
||||||
return 'file://' + pathName;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
const path = require('path');
|
||||||
|
const url = require('url');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {PageTestSuite}
|
* @type {PageTestSuite}
|
||||||
|
|
@ -30,6 +32,12 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||||
});
|
});
|
||||||
|
it('should work with file URL', async({page, server}) => {
|
||||||
|
const fileurl = url.pathToFileURL(path.join(__dirname, 'assets', 'frames', 'two-frames.html')).href;
|
||||||
|
await page.goto(fileurl);
|
||||||
|
expect(page.url().toLowerCase()).toBe(fileurl.toLowerCase());
|
||||||
|
expect(page.frames().length).toBe(3);
|
||||||
|
});
|
||||||
it('should use http for no protocol', async({page, server}) => {
|
it('should use http for no protocol', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE.substring('http://'.length));
|
await page.goto(server.EMPTY_PAGE.substring('http://'.length));
|
||||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||||
|
|
@ -978,3 +986,4 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue