|
5 | 5 | scrollFrameFromAndroidWebDriverSource, |
6 | 6 | scrollFrameFromIosWebDriverSource, |
7 | 7 | } from './webdriver-scroll-frame.ts'; |
8 | | -import { withoutSettleChrome } from '@agent-device/capture-kit/snapshot-chrome'; |
9 | 8 | import { parseWebDriverSourceFacts } from './webdriver-source.ts'; |
10 | 9 |
|
11 | 10 | test('Android WebDriver facts keep platform defaults and derive hittability from geometry', () => { |
@@ -329,96 +328,3 @@ test('iOS WebDriver facts keep the tag as the type whatever a class attribute sa |
329 | 328 |
|
330 | 329 | assert.equal(node!.type, 'XCUIElementTypeButton'); |
331 | 330 | }); |
332 | | - |
333 | | -test('Android WebDriver carries package identity and system-bar membership per same-package subtree', () => { |
334 | | - const source = `<hierarchy> |
335 | | - <android.widget.FrameLayout package="com.android.systemui" resource-id="com.android.systemui:id/status_bar"> |
336 | | - <android.widget.TextView package="com.android.systemui" text="Clock" /> |
337 | | - <android.widget.Button package="com.example" text="Foreign" /> |
338 | | - <android.widget.TextView text="Unknown owner" /> |
339 | | - </android.widget.FrameLayout> |
340 | | - <android.widget.FrameLayout package="com.android.systemui" resource-id="com.android.systemui:id/navigation_bar_frame"> |
341 | | - <android.widget.Button package="com.android.systemui" text="Back" /> |
342 | | - </android.widget.FrameLayout> |
343 | | - <android.widget.FrameLayout package="com.android.systemui" resource-id="com.android.systemui:id/split_shade_status_bar"> |
344 | | - <android.widget.TextView package="com.android.systemui" text="Shade clock" /> |
345 | | - </android.widget.FrameLayout> |
346 | | - <android.widget.Button package="com.android.systemui" resource-id="com.android.systemui:id/status_bar_notification_row" text="Popup" /> |
347 | | - <android.widget.Button package="android" text="Dialog" /> |
348 | | - </hierarchy>`; |
349 | | - const nodes = parseWebDriverSourceFacts(source, 'android').nodes; |
350 | | - assert.deepEqual( |
351 | | - nodes.map((node) => node.systemBar), |
352 | | - [ |
353 | | - 'status', |
354 | | - 'status', |
355 | | - undefined, |
356 | | - undefined, |
357 | | - 'navigation', |
358 | | - 'navigation', |
359 | | - undefined, |
360 | | - undefined, |
361 | | - undefined, |
362 | | - undefined, |
363 | | - ], |
364 | | - ); |
365 | | - assert.equal(nodes.find((node) => node.label === 'Clock')?.bundleId, 'com.android.systemui'); |
366 | | - assert.equal(nodes.find((node) => node.label === 'Foreign')?.bundleId, 'com.example'); |
367 | | - assert.equal(nodes.find((node) => node.label === 'Dialog')?.bundleId, 'android'); |
368 | | - assert.equal(nodes.find((node) => node.label === 'Unknown owner')?.bundleId, undefined); |
369 | | - assert.ok( |
370 | | - parseWebDriverSourceFacts(source, 'ios').nodes.every( |
371 | | - (node) => !('systemBar' in node) && !('bundleId' in node), |
372 | | - ), |
373 | | - ); |
374 | | -}); |
375 | | - |
376 | | -test('Android Appium popup ids containing status_bar stay actionable through chrome classification', () => { |
377 | | - const source = `<hierarchy><android.widget.Button package="com.android.systemui" resource-id="com.android.systemui:id/status_bar_notification_row" text="Open notification" bounds="[0,0][100,40]" /></hierarchy>`; |
378 | | - const nodes = attachRefs(parseWebDriverSourceFacts(source, 'android').nodes); |
379 | | - assert.deepEqual( |
380 | | - withoutSettleChrome(nodes, 'com.example').map((node) => node.label), |
381 | | - ['Open notification'], |
382 | | - ); |
383 | | -}); |
384 | | - |
385 | | -test('Android native wrappers retain unknown ownership barriers for membership and settle', () => { |
386 | | - const nodes = parseWebDriverSourceFacts( |
387 | | - `<hierarchy> |
388 | | - <android.widget.FrameLayout package="com.android.systemui" resource-id="com.android.systemui:id/status_bar"> |
389 | | - <android.widget.FrameLayout> |
390 | | - <android.widget.Button package="com.android.systemui" text="Unknown subtree action" bounds="[0,0][100,40]" /> |
391 | | - </android.widget.FrameLayout> |
392 | | - </android.widget.FrameLayout> |
393 | | - </hierarchy>`, |
394 | | - 'android', |
395 | | - ).nodes; |
396 | | - assert.equal(nodes[0]?.systemBar, 'status'); |
397 | | - assert.equal(nodes.find((node) => node.label === 'Unknown subtree action')?.systemBar, undefined); |
398 | | - assert.deepEqual( |
399 | | - withoutSettleChrome(attachRefs(nodes), 'com.example').map((node) => node.label), |
400 | | - [undefined, 'Unknown subtree action'], |
401 | | - ); |
402 | | -}); |
403 | | - |
404 | | -test('Appium launcher navbuttons are navigation chrome while the surrounding taskbar stays content', () => { |
405 | | - const nodes = attachRefs( |
406 | | - parseWebDriverSourceFacts( |
407 | | - `<hierarchy> |
408 | | - <android.widget.FrameLayout package="com.google.android.apps.nexuslauncher" resource-id="com.google.android.apps.nexuslauncher:id/taskbar_container"> |
409 | | - <android.widget.FrameLayout package="com.google.android.apps.nexuslauncher" resource-id="com.google.android.apps.nexuslauncher:id/navbuttons_view"> |
410 | | - <android.widget.Button package="com.google.android.apps.nexuslauncher" text="Back" /> |
411 | | - </android.widget.FrameLayout> |
412 | | - <android.widget.Button package="com.google.android.apps.nexuslauncher" text="Dock app" /> |
413 | | - </android.widget.FrameLayout> |
414 | | - </hierarchy>`, |
415 | | - 'android', |
416 | | - ).nodes, |
417 | | - ); |
418 | | - assert.equal(nodes.find((node) => node.label === 'Back')?.systemBar, 'navigation'); |
419 | | - assert.equal(nodes.find((node) => node.label === 'Dock app')?.systemBar, undefined); |
420 | | - assert.deepEqual( |
421 | | - withoutSettleChrome(nodes, 'com.example').map((node) => node.label), |
422 | | - [undefined, 'Dock app'], |
423 | | - ); |
424 | | -}); |
0 commit comments