Repository navigation
fix(wait): ignore an editable field's typed value in wait text #4489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7ae01f9
fix(wait): ignore an editable field's typed value in wait text
thymikee 1dcee88
fix(wait): resolve wait text editability through the selector owner
thymikee 2e67104
docs(wait): describe the placeholder case of wait text
thymikee f1c0a01
fix(selectors): treat web textbox and searchbox nodes as fillable
thymikee 1112ae7
refactor(selectors): keep the wait text rule in the node predicate mo…
thymikee 1fbe490
docs(wait): say how wait @ref treats a filled field
thymikee b1790c1
fix(selectors): honor hintShowing before the placeholder fallback in …
thymikee aa5c21b
test(selectors): pin the hintShowing true side of the wait text rule
thymikee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| [ | ||
| { | ||
| "name": "static text matches by label, case-insensitively", | ||
| "text": "saved", | ||
| "node": { | ||
| "label": "Name Saved" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "a non-editable value still matches", | ||
| "text": "bench-ad", | ||
| "node": { | ||
| "label": "Device name", | ||
| "value": "bench-ad" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "an editable field's typed value does not match", | ||
| "text": "benchad", | ||
| "node": { | ||
| "editable": true, | ||
| "label": "First name", | ||
| "value": "benchad" | ||
| }, | ||
| "expected": false | ||
| }, | ||
| { | ||
| "name": "part of an editable field's typed value does not match", | ||
| "text": "bench", | ||
| "node": { | ||
| "editable": true, | ||
| "label": "First name", | ||
| "value": "benchad" | ||
| }, | ||
| "expected": false | ||
| }, | ||
| { | ||
| "name": "an editable field still matches by its label", | ||
| "text": "first name", | ||
| "node": { | ||
| "editable": true, | ||
| "label": "First name", | ||
| "value": "benchad" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "an editable field whose label repeats its typed value does not match", | ||
| "text": "bench-ad", | ||
| "node": { | ||
| "editable": true, | ||
| "label": "bench-ad", | ||
| "value": "bench-ad", | ||
| "identifier": "android:id/edit" | ||
| }, | ||
| "expected": false | ||
| }, | ||
| { | ||
| "name": "an editable field still matches by its identifier", | ||
| "text": "id/edit", | ||
| "node": { | ||
| "editable": true, | ||
| "label": "bench-ad", | ||
| "value": "bench-ad", | ||
| "identifier": "android:id/edit" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "an empty editable field matches by its hint label", | ||
| "text": "device name", | ||
| "node": { | ||
| "editable": true, | ||
| "label": "Device name", | ||
| "value": "" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "a hint reported as both label and value still matches as the placeholder", | ||
| "text": "device name", | ||
| "node": { | ||
| "editable": true, | ||
| "label": "Device name", | ||
| "value": "Device name", | ||
| "placeholder": "Device name" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "an empty field whose value is its placeholder matches by that placeholder", | ||
| "text": "last name", | ||
| "node": { | ||
| "editable": true, | ||
| "value": "Last name", | ||
| "placeholder": "Last name" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "typed text equal to the placeholder does not match when the field reports its hint is hidden", | ||
| "platform": "android", | ||
| "text": "device name", | ||
| "node": { | ||
| "type": "android.widget.EditText", | ||
| "editable": true, | ||
| "hintShowing": false, | ||
| "label": "Device name", | ||
| "value": "Device name", | ||
| "placeholder": "Device name" | ||
| }, | ||
| "expected": false | ||
| }, | ||
| { | ||
| "name": "a field that reports its hint showing matches by that hint even without a placeholder", | ||
| "platform": "android", | ||
| "text": "device name", | ||
| "node": { | ||
| "type": "android.widget.EditText", | ||
| "editable": true, | ||
| "hintShowing": true, | ||
| "label": "Device name", | ||
| "value": "Device name" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "a disabled field's value is app text and matches", | ||
| "text": "bench-ad", | ||
| "node": { | ||
| "editable": true, | ||
| "enabled": false, | ||
| "label": "Name", | ||
| "value": "bench-ad" | ||
| }, | ||
| "expected": true | ||
| }, | ||
| { | ||
| "name": "an Android EditText without an editable fact is editable by its class", | ||
| "platform": "android", | ||
| "text": "bench-ad", | ||
| "node": { | ||
| "type": "android.widget.EditText", | ||
| "label": "bench-ad", | ||
| "value": "bench-ad" | ||
| }, | ||
| "expected": false | ||
| }, | ||
| { | ||
| "name": "a web textbox without an editable fact is editable by its role", | ||
| "platform": "web", | ||
| "text": "bench-ad", | ||
| "node": { | ||
| "type": "textbox", | ||
| "label": "Device name", | ||
| "value": "bench-ad" | ||
| }, | ||
| "expected": false | ||
| } | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { test } from 'vitest'; | ||
| import assert from 'node:assert/strict'; | ||
| import fs from 'node:fs'; | ||
| import path from 'node:path'; | ||
| import type { SnapshotNode } from '@agent-device/kernel/snapshot'; | ||
| import { matchesWaitText } from './node.ts'; | ||
|
|
||
| // Golden `wait text` table: the Swift runner's native findText predicate is asserted against the | ||
| // same JSON (UnitTests/RunnerTests+InteractionTests.swift). | ||
| type WaitTextCase = { | ||
| name: string; | ||
| platform?: 'android' | 'web'; | ||
| text: string; | ||
| node: Omit<SnapshotNode, 'index' | 'ref'>; | ||
| expected: boolean; | ||
| }; | ||
|
|
||
| const TABLE_PATH = path.resolve( | ||
| import.meta.dirname, | ||
| '..', | ||
| '..', | ||
| '..', | ||
| '..', | ||
| 'contracts', | ||
| 'fixtures', | ||
| 'wait-text-policy.json', | ||
| ); | ||
|
|
||
| test('wait text matches visible text but not an editable field’s typed content', () => { | ||
| const cases = JSON.parse(fs.readFileSync(TABLE_PATH, 'utf8')) as WaitTextCase[]; | ||
| assert.ok(cases.length > 0, 'wait text policy table must not be empty'); | ||
| for (const fixture of cases) { | ||
| const node = { index: 0, ref: 'e1', type: 'StaticText', ...fixture.node }; | ||
| assert.equal( | ||
| matchesWaitText(node, fixture.text, fixture.platform ?? 'ios'), | ||
| fixture.expected, | ||
| fixture.name, | ||
| ); | ||
| } | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.