MCPcopy Index your code
hub / github.com/callstack/agent-device / findSelectorChainMatch

Function findSelectorChainMatch

src/daemon/selectors-resolve.ts:57–80  ·  view source on GitHub ↗
(
  nodes: SnapshotState['nodes'],
  chain: SelectorChain,
  options: {
    platform: Platform | PublicPlatform;
    requireRect?: boolean;
  },
)

Source from the content-addressed store, hash-verified

55}
56
57export function findSelectorChainMatch(
58 nodes: SnapshotState['nodes'],
59 chain: SelectorChain,
60 options: {
61 platform: Platform | PublicPlatform;
62 requireRect?: boolean;
63 },
64): {
65 selectorIndex: number;
66 selector: Selector;
67 matches: number;
68 diagnostics: SelectorDiagnostics[];
69} | null {
70 const requireRect = options.requireRect ?? false;
71 const diagnostics: SelectorDiagnostics[] = [];
72 for (const [i, selector] of chain.selectors.entries()) {
73 const matches = countSelectorMatchesOnly(nodes, selector, options.platform, requireRect);
74 diagnostics.push({ selector: selector.raw, matches });
75 if (matches > 0) {
76 return { selectorIndex: i, selector, matches, diagnostics };
77 }
78 }
79 return null;
80}
81
82export function formatSelectorFailure(
83 chain: SelectorChain,

Callers 4

isCommandFunction · 0.90
waitForSelectorFunction · 0.90
selectors.test.tsFile · 0.90

Calls 2

countSelectorMatchesOnlyFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected