mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: setContent with disabled javascript (#21399)
Fixes https://github.com/microsoft/playwright/issues/21379
This commit is contained in:
parent
47a71731f4
commit
c30d88a63a
@ -570,7 +570,8 @@ export class WKPage implements PageDelegate {
|
|||||||
const objectId = JSON.parse(p.objectId);
|
const objectId = JSON.parse(p.objectId);
|
||||||
context = this._contextIdToContext.get(objectId.injectedScriptId);
|
context = this._contextIdToContext.get(objectId.injectedScriptId);
|
||||||
} else {
|
} else {
|
||||||
context = this._contextIdToContext.get(this._mainFrameContextId!);
|
// Pick any context if the parameter is a value.
|
||||||
|
context = [...this._contextIdToContext.values()].find(c => c.frame === this._page.mainFrame());
|
||||||
}
|
}
|
||||||
if (!context)
|
if (!context)
|
||||||
return;
|
return;
|
||||||
|
@ -223,6 +223,14 @@ it('should not hang on promises after disabling javascript', async ({ browserNam
|
|||||||
expect(await page.evaluate(async () => 2)).toBe(2);
|
expect(await page.evaluate(async () => 2)).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('setContent should work after disabling javascript', async ({ contextFactory, browserName, isLinux }) => {
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/18235' });
|
||||||
|
const context = await contextFactory({ javaScriptEnabled: false });
|
||||||
|
const page = await context.newPage();
|
||||||
|
await page.setContent('<h1>Hello</h1>');
|
||||||
|
await expect(page.locator('h1')).toHaveText('Hello');
|
||||||
|
});
|
||||||
|
|
||||||
it('should work with offline option', async ({ browser, server }) => {
|
it('should work with offline option', async ({ browser, server }) => {
|
||||||
const context = await browser.newContext({ offline: true });
|
const context = await browser.newContext({ offline: true });
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user