diff --git a/pkg/spec/src/index.ts b/pkg/spec/src/index.ts index f046b41..66ee05a 100644 --- a/pkg/spec/src/index.ts +++ b/pkg/spec/src/index.ts @@ -13,6 +13,7 @@ export type { Point, PressKeyAction, Sampler, + SelectorPath, Snapshots, State, SwipeAction, diff --git a/pkg/spec/src/types.ts b/pkg/spec/src/types.ts index c1c1ef7..a3c53ea 100644 --- a/pkg/spec/src/types.ts +++ b/pkg/spec/src/types.ts @@ -1,6 +1,8 @@ export type Snapshots = Record; export type AttrSelector = Record; +export type SelectorPath = readonly AttrSelector[]; + export interface AccessibilityElement { id?: string; text?: string; @@ -15,13 +17,13 @@ export interface AccessibilityElement { x?: number; y?: number; attrs?: Record; - find(selector: string | AttrSelector): AccessibilityElement | undefined; - findAll(selector: string | AttrSelector): AccessibilityElement[]; + find(selector: string | AttrSelector | SelectorPath): AccessibilityElement | undefined; + findAll(selector: string | AttrSelector | SelectorPath): AccessibilityElement[]; } export interface AccessibilityTree { - find(selector: string | AttrSelector): AccessibilityElement | undefined; - findAll(selector: string | AttrSelector): AccessibilityElement[]; + find(selector: string | AttrSelector | SelectorPath): AccessibilityElement | undefined; + findAll(selector: string | AttrSelector | SelectorPath): AccessibilityElement[]; } export interface LogEntry {