mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
feat(goto): assume http:// for localhost navigations (#825)
This commit is contained in:
parent
8f1df5e1e8
commit
bdf8e39786
@ -381,7 +381,7 @@ export class Frame {
|
||||
referer = options.referer;
|
||||
}
|
||||
const watcher = new LifecycleWatcher(this, options, false /* supportUrlMatch */);
|
||||
|
||||
url = helper.completeUserURL(url);
|
||||
let navigateResult: GotoResult;
|
||||
const navigate = async () => {
|
||||
try {
|
||||
|
@ -211,6 +211,12 @@ class Helper {
|
||||
tokens.push('$');
|
||||
return new RegExp(tokens.join(''));
|
||||
}
|
||||
|
||||
static completeUserURL(urlString: string): string {
|
||||
if (urlString.startsWith('localhost') || urlString.startsWith('127.0.0.1'))
|
||||
urlString = 'http://' + urlString;
|
||||
return urlString;
|
||||
}
|
||||
}
|
||||
|
||||
export function assert(value: any, message?: string) {
|
||||
|
@ -28,6 +28,10 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMI
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||
});
|
||||
it('should use http for no protocol', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE.substring('http://'.length));
|
||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||
});
|
||||
it('should work cross-process', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||
|
Loading…
Reference in New Issue
Block a user