chore(bidi): reimplement RawKeyboard.sendText()#41637
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f59dcb9 to
1343e6d
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
yury-s
left a comment
There was a problem hiding this comment.
Looks good except for putting Bidi-specific script into a separate extension.
This implementation tries to emulate CDP's Input.insertText behavior more closely.
Are there any plans to have such method in Bidi protocol?
| return 'needsinput'; // Still need to input the value. | ||
| } | ||
|
|
||
| insertText(text: string): Element | undefined { |
There was a problem hiding this comment.
Since this is only used in Bidi, it should go in its own script/module. You can call browserContext.extendInjectedScript() to add extra logic.
1343e6d to
e25d3f6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@yury-s I tried using to |
| return 'needsinput'; // Still need to input the value. | ||
| } | ||
|
|
||
| bidiInsertText?: (text: string) => Element | undefined; |
There was a problem hiding this comment.
can we avoid adding this to the main script? packages/injected/src/recorder/pollingRecorder.ts adds a rich API and doesn't leak any of it into the main InjectedScript, let's employ the same approach here.
Hmm, doesn't fail for me when I run the test with this change (in chromium). Are you sure there are no other changes? |
I found the root cause (see #41706) and it's a very subtle race condition - the timing needs to be just right to trigger it, so it's not surprising that it's hard to reproduce (it's rather surprising that it reproduces so well on my machine, although I could get the test to pass by adding a delay of 1 millisecond to it). |
e25d3f6 to
d1bfcba
Compare
Test results for "MCP"2 failed 7733 passed, 1248 skipped Merge workflow run. |
Test results for "tests 1"4 flaky49512 passed, 1161 skipped Merge workflow run. |
Bidi doesn't have a protocol method corresponding to CDP's
Input.insertText, so this was emulated using keyboard actions. However, this emitskey*events that are not expected forKeyboard.insertText(), breaking several tests.This implementation tries to emulate CDP's
Input.insertTextbehavior more closely.Fixes the following tests:
page/page-fill.spec.ts:tests/page/page-keyboard.spec.ts: