fix: ensure frame.url() includes the query string (#6398)

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
This commit is contained in:
Bryan Maloyer 2020-09-08 10:49:44 +02:00 committed by GitHub
parent 7b24e5435b
commit b6bbfd0ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -1231,7 +1231,7 @@ export class Frame {
*/
_navigated(framePayload: Protocol.Page.Frame): void {
this._name = framePayload.name;
this._url = framePayload.url;
this._url = `${framePayload.url}${framePayload.urlFragment || ''}`;
}
/**

View File

@ -0,0 +1 @@
<iframe src='./frame.html&test=fragment'></iframe>

View File

@ -256,5 +256,15 @@ describe('Frame specs', function () {
expect(frame1).not.toBe(frame2);
}
);
it('should support url fragment', async () => {
const { page, server } = getTestState();
await page.goto(server.PREFIX + '/frames/one-frame-url-fragment.html');
expect(page.frames().length).toBe(2);
expect(page.frames()[1].url()).toBe(
server.PREFIX + '/frames/frame.html&test=fragment'
);
});
});
});