MCPcopy
hub / github.com/tinyplex/tinybase / expectedFramedElement

Function expectedFramedElement

test/e2e/common.ts:27–50  ·  view source on GitHub ↗
(
  page: Page,
  selector: string,
  text?: string | RegExp,
  options: number | {timeout?: number; state?: 'visible' | 'attached'} = 5000,
)

Source from the content-addressed store, hash-verified

25};
26
27export const expectedFramedElement = async (
28 page: Page,
29 selector: string,
30 text?: string | RegExp,
31 options: number | {timeout?: number; state?: 'visible' | 'attached'} = 5000,
32): Promise<Locator> => {
33 const timeout =
34 typeof options === 'number' ? options : (options.timeout ?? 5000);
35 const state =
36 typeof options === 'number' ? 'visible' : (options.state ?? 'visible');
37 const frame = page.frameLocator('iframe').first();
38 const locator = frame.locator(selector);
39
40 const element = text
41 ? locator.filter({hasText: text}).first()
42 : locator.first();
43
44 if (state === 'visible') {
45 await expect(element).toBeVisible({timeout});
46 } else {
47 await expect(element).toBeAttached({timeout});
48 }
49 return element;
50};
51
52export const expectedFramedSvgElement = async (
53 page: Page,

Callers 15

waitForDocShotReadyFunction · 0.90
expectDocShotFunction · 0.90
todo-app.test.tsFile · 0.90
exerciseCountriesDemoFunction · 0.90
getCanvasOffsetFunction · 0.90
drawing.test.tsFile · 0.90

Calls

no outgoing calls

Tested by 4

waitForDocShotReadyFunction · 0.72
expectDocShotFunction · 0.72
exerciseCountriesDemoFunction · 0.72
getCanvasOffsetFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…