mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: improve target.asPage
tests (#12060)
This commit is contained in:
parent
d89b739b5e
commit
4f422e60a6
@ -2458,7 +2458,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
||||
};
|
||||
if (options.type === undefined && options.path !== undefined) {
|
||||
const filePath = options.path;
|
||||
// Note we cannot use Node.js here due to browser compatability.
|
||||
// Note we cannot use Node.js here due to browser compatibility.
|
||||
const extension = filePath
|
||||
.slice(filePath.lastIndexOf('.') + 1)
|
||||
.toLowerCase();
|
||||
|
@ -363,14 +363,14 @@
|
||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if asPage is used",
|
||||
"testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if custom isPageTarget is provided",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["firefox"],
|
||||
"expectations": ["SKIP"],
|
||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if custom isPageTarget is provided",
|
||||
"testIdPattern": "[devtools.spec] DevTools target.page() should return Page when calling asPage on DevTools target",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["firefox"],
|
||||
"expectations": ["SKIP"],
|
||||
@ -3831,14 +3831,14 @@
|
||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if asPage is used",
|
||||
"testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if custom isPageTarget is provided",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["cdp", "chrome", "chrome-headless-shell"],
|
||||
"expectations": ["SKIP"],
|
||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if custom isPageTarget is provided",
|
||||
"testIdPattern": "[devtools.spec] DevTools target.page() should return Page when calling asPage on DevTools target",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["cdp", "chrome", "chrome-headless-shell"],
|
||||
"expectations": ["SKIP"],
|
||||
|
@ -67,9 +67,9 @@ describe('DevTools', function () {
|
||||
return 2 * 3;
|
||||
})
|
||||
).toBe(6);
|
||||
expect(await browser.pages()).toContainEqual(page);
|
||||
expect(await browser.pages()).toContain(page);
|
||||
});
|
||||
it('target.page() should return a DevTools page if asPage is used', async function () {
|
||||
it('target.page() should return Page when calling asPage on DevTools target', async function () {
|
||||
const {puppeteer} = await getTestState({skipLaunch: true});
|
||||
const originalBrowser = await launchBrowser(launchOptions);
|
||||
|
||||
@ -87,7 +87,8 @@ describe('DevTools', function () {
|
||||
return 2 * 3;
|
||||
})
|
||||
).toBe(6);
|
||||
expect(await browser.pages()).toContainEqual(page);
|
||||
// The page won't be part of browser.pages() if a custom isPageTarget is not provided
|
||||
expect(await browser.pages()).not.toContain(page);
|
||||
});
|
||||
it('should open devtools when "devtools: true" option is given', async () => {
|
||||
const browser = await launchBrowser(
|
||||
|
Loading…
Reference in New Issue
Block a user