test: unskip aria tests (#10953)

This commit is contained in:
Alex Rudenko 2023-09-20 14:11:21 +02:00 committed by GitHub
parent 4bdb113df7
commit 3f79beb71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 6 deletions

View File

@ -97,6 +97,8 @@ export abstract class Realm implements Disposable {
return await waitTask.result; return await waitTask.result;
} }
abstract adoptBackendNode(backendNodeId?: number): Promise<JSHandle<Node>>;
get disposed(): boolean { get disposed(): boolean {
return this.#disposed; return this.#disposed;
} }

View File

@ -21,6 +21,7 @@ import {type EvaluateFunc, type HandleFor} from '../common/types.js';
import {withSourcePuppeteerURLIfNone} from '../common/util.js'; import {withSourcePuppeteerURLIfNone} from '../common/util.js';
import {type BrowsingContext} from './BrowsingContext.js'; import {type BrowsingContext} from './BrowsingContext.js';
import {BidiElementHandle} from './ElementHandle.js';
import {type BidiFrame} from './Frame.js'; import {type BidiFrame} from './Frame.js';
import {type BidiRealm as BidiRealm} from './Realm.js'; import {type BidiRealm as BidiRealm} from './Realm.js';
/** /**
@ -117,4 +118,16 @@ export class Sandbox extends Realm {
await handle.dispose(); await handle.dispose();
return transferredHandle as unknown as T; return transferredHandle as unknown as T;
} }
override async adoptBackendNode(
backendNodeId?: number
): Promise<JSHandle<Node>> {
const {object} = await this.environment.client.send('DOM.resolveNode', {
backendNodeId: backendNodeId,
});
return new BidiElementHandle(this, {
handle: object.objectId,
type: 'node',
});
}
} }

View File

@ -23,8 +23,6 @@ import {type AwaitableIterable} from '../common/types.js';
import {assert} from '../util/assert.js'; import {assert} from '../util/assert.js';
import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js'; import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js';
import {type IsolatedWorld} from './IsolatedWorld.js';
const queryAXTree = async ( const queryAXTree = async (
client: CDPSession, client: CDPSession,
element: ElementHandle<Node>, element: ElementHandle<Node>,
@ -114,9 +112,9 @@ export class ARIAQueryHandler extends QueryHandler {
role role
); );
yield* AsyncIterableUtil.map(results, node => { yield* AsyncIterableUtil.map(results, node => {
return (element.realm as IsolatedWorld).adoptBackendNode( return element.realm.adoptBackendNode(node.backendDOMNodeId) as Promise<
node.backendDOMNodeId ElementHandle<Node>
) as Promise<ElementHandle<Node>>; >;
}); });
} }

View File

@ -236,7 +236,7 @@ export class IsolatedWorld extends Realm {
} }
}; };
async adoptBackendNode( override async adoptBackendNode(
backendNodeId?: Protocol.DOM.BackendNodeId backendNodeId?: Protocol.DOM.BackendNodeId
): Promise<JSHandle<Node>> { ): Promise<JSHandle<Node>> {
const executionContext = await this.#executionContext(); const executionContext = await this.#executionContext();

View File

@ -1379,6 +1379,48 @@
"parameters": ["chrome", "webDriverBiDi"], "parameters": ["chrome", "webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"] "expectations": ["FAIL", "TIMEOUT"]
}, },
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler parseAriaSelector should find button",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryAll should find menu by name",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryAllArray $$eval should handle many elements",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryOne should find button by name and role",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryOne should find button by role",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryOne should find by name",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryOne should find first matching element",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{ {
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector (aria) should throw when frame is detached", "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector (aria) should throw when frame is detached",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],