From d8aa7688376e107440471bd15e3c2c0f4d5bbb2d Mon Sep 17 00:00:00 2001 From: PJ Date: Sat, 25 Apr 2026 21:22:03 +0700 Subject: [PATCH] feat(spec): extend AccessibilityElement and AccessibilityTree types - AccessibilityElement gains attrs, find(), findAll() - find/findAll on both Tree and Element accept string | AttrSelector - AttrSelector = Record for object-form AND matching --- pkg/spec/src/types.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/spec/src/types.ts b/pkg/spec/src/types.ts index 5019187..c1c1ef7 100644 --- a/pkg/spec/src/types.ts +++ b/pkg/spec/src/types.ts @@ -1,4 +1,5 @@ export type Snapshots = Record; +export type AttrSelector = Record; export interface AccessibilityElement { id?: string; @@ -13,11 +14,14 @@ export interface AccessibilityElement { bounds?: { left: number; top: number; right: number; bottom: number }; x?: number; y?: number; + attrs?: Record; + find(selector: string | AttrSelector): AccessibilityElement | undefined; + findAll(selector: string | AttrSelector): AccessibilityElement[]; } export interface AccessibilityTree { - find(selector: string): AccessibilityElement | undefined; - findAll(selector: string): AccessibilityElement[]; + find(selector: string | AttrSelector): AccessibilityElement | undefined; + findAll(selector: string | AttrSelector): AccessibilityElement[]; } export interface LogEntry {