mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: add more baseURL tests for edge-cases (#7586)
This commit is contained in:
parent
767e22c6b2
commit
053d39cb19
@ -34,6 +34,17 @@ it('should construct a new URL when a baseURL in browser.newPage is passed to pa
|
||||
await page.close();
|
||||
});
|
||||
|
||||
it('should construct a new URL when a baseURL in browserType.launchPersistentContext is passed to page.goto', async function({browserType, server, createUserDataDir, browserOptions}) {
|
||||
const userDataDir = await createUserDataDir();
|
||||
const context = await browserType.launchPersistentContext(userDataDir, {
|
||||
...browserOptions,
|
||||
baseURL: server.PREFIX,
|
||||
});
|
||||
const page = await context.newPage();
|
||||
expect((await page.goto('/empty.html')).url()).toBe(server.EMPTY_PAGE);
|
||||
await context.close();
|
||||
});
|
||||
|
||||
it('should construct the URLs correctly when a baseURL without a trailing slash in browser.newPage is passed to page.goto', async function({browser, server}) {
|
||||
const page = await browser.newPage({
|
||||
baseURL: server.PREFIX + '/url-construction',
|
||||
@ -91,3 +102,12 @@ it('should be able to match a URL relative to its given URL with urlMatcher', as
|
||||
expect((await response.body()).toString()).toBe('base-url-matched-route');
|
||||
await page.close();
|
||||
});
|
||||
|
||||
it('should not construct a new URL with baseURL when a glob was used', async function({browser, server}) {
|
||||
const page = await browser.newPage({
|
||||
baseURL: server.PREFIX + '/foobar/',
|
||||
});
|
||||
await page.goto('./kek/index.html');
|
||||
await page.waitForURL('**/foobar/kek/index.html');
|
||||
await page.close();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user