forked from mozilla/pdf.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use realistic typing delays for the scripting integration tests
In the scripting integration tests we use a few different typing delays, mostly 100 or 200 milliseconds. According to for example https://www.typingpal.com/en/documentation/school-edition/pedagogical-resources/typing-speed, a fast typing speed is around 300 characters per minute, which is 5 characters per second and therefore a delay of 200 milliseconds between each keystroke. Note that this is already above average, so in practice the delay will be even larger. Therefore the 100 milliseconds variant is unrealistically fast and therefore not suitable for the integration tests which aim to simulate the average user behavior. On top of that, the quick typing speeds are problematic for the tests that involve validation alert dialogs appearing during typing. In those tests a handler is registered to close the dialog once it pops up, but it takes time for Puppeteer to notice the dialog, trigger the handler and close it. If the typing delay, which is the delay between the key down and key up events according to the Puppeteer source code at https://github.com/puppeteer/puppeteer/blob/master/packages/puppeteer-core/src/cdp/Input.ts#L209-L215, is too short, the key up event will be fired before the dialog is closed. In that time the text box we're typing in is not focused, so when the dialog is closed the `page.type()` call on the text box will never resolve because the key up event never reached the text box. This commit aims to fix the issues by converting all 100 millisecond delays to 200 milliseconds. For instance the "must check input for US zip format" failed pretty consistently locally before and hasn't failed anymore with a 200 millisecond delay.
- Loading branch information
1 parent
9b46404
commit 6e584ad
Showing
1 changed file
with
17 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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