feat(web-integration): expose keyboard type delay via WebPageOpt#2485
Open
quanru wants to merge 1 commit into
Open
feat(web-integration): expose keyboard type delay via WebPageOpt#2485quanru wants to merge 1 commit into
quanru wants to merge 1 commit into
Conversation
Deploying midscene with
|
| Latest commit: |
2228b2d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d373d8f8.midscene.pages.dev |
| Branch Preview URL: | https://feat-web-keyboard-type-delay.midscene.pages.dev |
Previously the per-character delay for `keyboard.type` was hard-coded to 80ms. Add a `keyboardTypeDelay` option on `WebPageOpt` so callers can tune typing speed (e.g. `0` for instant input, larger values for slower environments). Falls back to the new `DEFAULT_KEYBOARD_TYPE_DELAY` constant (80ms) when not specified.
a2ce68c to
2228b2d
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
keyboard.typeconfigurable instead of being hard-coded to 80ms inpackages/web-integration/src/puppeteer/base-page.ts.keyboardTypeDelay?: numberoption onWebPageOpt, plumbed throughPuppeteerAgent/PlaywrightAgentto the underlyingPageconstructor.DEFAULT_KEYBOARD_TYPE_DELAY = 80constant in@midscene/shared/constantsas the fallback default, preserving current behavior when the option is omitted.Motivation
Some users need to slow down typing (flaky/legacy inputs that lose characters) or speed it up to near-zero (high-throughput automation / CI). Until now this required forking the package. With this change the delay can be tuned per agent instance:
Test plan
pnpm run lintnpx vitest --run tests/unit-test/web-actions-navigation.test.ts tests/unit-test/yaml/input-mode-typeonly.test.ts tests/unit-test/yaml/input-mode-typeonly-e2e.test.ts(all keyboard.type-related unit tests pass)keyboardTypeDelay: 0andkeyboardTypeDelay: 200are observed end-to-end