test: enable queryObjects for bidi (#10964)
This commit is contained in:
parent
c505c85b31
commit
9cfc195794
@ -10,7 +10,7 @@ This method iterates the JavaScript heap and finds all objects with the given pr
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
queryObjects<Prototype>(
|
abstract queryObjects<Prototype>(
|
||||||
prototypeHandle: JSHandle<Prototype>
|
prototypeHandle: JSHandle<Prototype>
|
||||||
): Promise<JSHandle<Prototype[]>>;
|
): Promise<JSHandle<Prototype[]>>;
|
||||||
}
|
}
|
||||||
|
@ -1073,12 +1073,9 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* @returns Promise which resolves to a handle to an array of objects with
|
* @returns Promise which resolves to a handle to an array of objects with
|
||||||
* this prototype.
|
* this prototype.
|
||||||
*/
|
*/
|
||||||
async queryObjects<Prototype>(
|
abstract queryObjects<Prototype>(
|
||||||
prototypeHandle: JSHandle<Prototype>
|
prototypeHandle: JSHandle<Prototype>
|
||||||
): Promise<JSHandle<Prototype[]>>;
|
): Promise<JSHandle<Prototype[]>>;
|
||||||
async queryObjects<Prototype>(): Promise<JSHandle<Prototype[]>> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method runs `document.querySelector` within the page and passes the
|
* This method runs `document.querySelector` within the page and passes the
|
||||||
|
@ -76,6 +76,7 @@ import {BidiFrame, lifeCycleToReadinessState} from './Frame.js';
|
|||||||
import {type BidiHTTPRequest} from './HTTPRequest.js';
|
import {type BidiHTTPRequest} from './HTTPRequest.js';
|
||||||
import {type BidiHTTPResponse} from './HTTPResponse.js';
|
import {type BidiHTTPResponse} from './HTTPResponse.js';
|
||||||
import {BidiKeyboard, BidiMouse, BidiTouchscreen} from './Input.js';
|
import {BidiKeyboard, BidiMouse, BidiTouchscreen} from './Input.js';
|
||||||
|
import {type BidiJSHandle} from './JSHandle.js';
|
||||||
import {BidiNetworkManager} from './NetworkManager.js';
|
import {BidiNetworkManager} from './NetworkManager.js';
|
||||||
import {createBidiHandle} from './Realm.js';
|
import {createBidiHandle} from './Realm.js';
|
||||||
import {BidiSerializer} from './Serializer.js';
|
import {BidiSerializer} from './Serializer.js';
|
||||||
@ -219,6 +220,26 @@ export class BidiPage extends Page {
|
|||||||
await this._client().send('Page.setBypassCSP', {enabled});
|
await this._client().send('Page.setBypassCSP', {enabled});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override async queryObjects<Prototype>(
|
||||||
|
prototypeHandle: BidiJSHandle<Prototype>
|
||||||
|
): Promise<BidiJSHandle<Prototype[]>> {
|
||||||
|
assert(!prototypeHandle.disposed, 'Prototype JSHandle is disposed!');
|
||||||
|
assert(
|
||||||
|
prototypeHandle.id,
|
||||||
|
'Prototype JSHandle must not be referencing primitive value'
|
||||||
|
);
|
||||||
|
const response = await this.mainFrame().client.send(
|
||||||
|
'Runtime.queryObjects',
|
||||||
|
{
|
||||||
|
prototypeObjectId: prototypeHandle.id,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return createBidiHandle(this.mainFrame().mainRealm(), {
|
||||||
|
type: 'array',
|
||||||
|
handle: response.objects.objectId,
|
||||||
|
}) as BidiJSHandle<Prototype[]>;
|
||||||
|
}
|
||||||
|
|
||||||
_setBrowserContext(browserContext: BidiBrowserContext): void {
|
_setBrowserContext(browserContext: BidiBrowserContext): void {
|
||||||
this.#browserContext = browserContext;
|
this.#browserContext = browserContext;
|
||||||
}
|
}
|
||||||
|
@ -983,6 +983,12 @@
|
|||||||
"parameters": ["webDriverBiDi"],
|
"parameters": ["webDriverBiDi"],
|
||||||
"expectations": ["PASS"]
|
"expectations": ["PASS"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[page.spec] Page ExecutionContext.queryObjects *",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["chrome", "webDriverBiDi"],
|
||||||
|
"expectations": ["PASS"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[page.spec] Page Page.addScriptTag should throw when added with content to the CSP page",
|
"testIdPattern": "[page.spec] Page Page.addScriptTag should throw when added with content to the CSP page",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -3413,6 +3419,12 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[page.spec] Page Page.setCacheEnabled should enable or disable the cache based on the state passed",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["chrome", "webDriverBiDi"],
|
||||||
|
"expectations": ["PASS"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[page.spec] Page Page.setCacheEnabled should stay disabled when toggling request interception on/off",
|
"testIdPattern": "[page.spec] Page Page.setCacheEnabled should stay disabled when toggling request interception on/off",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -4084,11 +4096,5 @@
|
|||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
"parameters": ["cdp", "chrome", "new-headless", "tabTarget"],
|
"parameters": ["cdp", "chrome", "new-headless", "tabTarget"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
|
||||||
{
|
|
||||||
"testIdPattern": "[page.spec] Page Page.setCacheEnabled should enable or disable the cache based on the state passed",
|
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
|
||||||
"parameters": ["chrome", "webDriverBiDi"],
|
|
||||||
"expectations": ["PASS"]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user