Commit Graph

21 Commits

Author SHA1 Message Date
JoelEinbinder
655b94db47 fix(touch): requestAnimationFrame before sending tap ()
This patch adds a work-around for the upstream bug, issuing double-raf before emulating touch event.

References 
2017-10-26 14:53:50 -07:00
JoelEinbinder
126ab7b90e feat(keyboard): Accept codes ()
BREAKING CHANGE:

This patch lets key names be code in addition to key. When specifying a code, the proper text is generated assuming a standard US keyboard layout. e.g Digit5 -> "5" or "%" depending on Shift.

* location is now specified. 

* Using unknown key names now throws an error. 

* Typing newlines now correctly presses enter. 
2017-10-23 12:43:45 -07:00
JoelEinbinder
6a8865cd85 feat(keyboard): make keyboard.down generate input event by default ()
This patch starts generating input events for `keyboard.down`, addressing bullet 2 of
. With this patch, there's no longer any difference between `keboard.press('a')` and
`keyboard.press('a', {text: 'a'})`.

BREAKING CHANGE:
`keyboard.down('a')` starts generating input event (wasn't the case before).

References 
2017-10-13 15:22:55 -07:00
JoelEinbinder
c893bf3684 fix(input) Send .code with keyboard events ()
This patch starts sending proper `.code` field with emulated keyboard events.

References .
2017-10-11 18:09:43 -07:00
JoelEinbinder
e59172de83 chore: Use Typescript to lint JSDoc annotations ()
This patch starts using typescript to lint JSDoc annotations.

Note: this uses typescript's bleeding edge. We should migrate to stable once
it has all the necessary bugfixes.

References .
2017-10-09 22:31:40 -07:00
JoelEinbinder
0af0d7dba5 feat(Input): Add keyboard methods to elementHandle ()
This patch:
- adds input methods to ElementHandle, such as ElementHandle.type and ElementHandle.press
- changes `page.type` to accept selector as the first argument
- removes `page.press` method. The `page.press` is rarely used and doesn't operate with selectors; if there's a need to press a button, `page.keyboard.press` should be used.

BREAKING CHANGE: `page.type` is changed, `page.press` is removed.

Fixes .
2017-10-07 00:28:24 -07:00
Andrey Lushnikov
0bea42bd8c Do not leave dangling promises when sending messages over protocol ()
It's very bad to have 'unhandled promise rejection' that can't be
handled in user code. These errors will exit node process in a near
future.

This patch avoids 'unhandled promise rejection' while sending protocol
messages.

This patch:
- introduces `puppeteer:error` debug scope and starts using it for all
  swalloed errors.
- makes sure that every `client.send` method is either awaited or its
  errors are handled.
- starts return promises from Request.continue() and Request.abort().
- starts swallow errors from Request.contine() and Request.abort().

The last is the most important part of the patch. Since
`Request.continue()` might try to continue canceled request, we should
disregard the error.

Fixes .
2017-09-11 16:21:51 -07:00
JoelEinbinder
64124df62f [api] add touchScreen.tap ()
This patch:
- adds `page.touchscreen` namespace, similar to `page.mouse` and `page.keyboard`.
- adds tapping to multiple layers:
  - `page.touchscreen.tap`
  - `page.tap` - convenience method which accepts selector
  - `elementHandle.tap`

Fixes  and .
2017-09-01 19:03:51 -07:00
JoelEinbinder
42fa3af659 Remove promise jsdoc ()
This patch removes unnecessary "promise" return types in jsdoc for async functions.
2017-08-31 17:58:07 -07:00
JoelEinbinder
8f74cc8a90 [api] Add "step" option to mouse.move method ()
This patch adds "step" option to the mouse.move method, that optionally tweens mouse movement over multiple steps.

References .
2017-08-29 14:13:38 -07:00
Eric Bidelman
1f9b4fb4c8 Change let into const ()
This patch:
- changes `let` into `const` throughout codebase
- adds eslint check to prefer const over let
2017-08-21 16:39:04 -07:00
Eric Bidelman
5d6d3e0a81 cleanup: Use ES6 default params () 2017-08-21 16:32:39 -07:00
JoelEinbinder
497baf0198 Roll chromium to r493673 ()
Mouse events are no longer racy. Enabling touch no longer converts all mouse events into touches. Promises in destroyed execution contexts are rejected immediately.
2017-08-11 01:21:02 -07:00
Andrey Lushnikov
fe06c896eb Roll chromium to 492629 ()
This patch
- rolls chromium to 492629
- migrates connection establishing to use browser target. This migration means
  that now we have a single websocket connection to browser (implemented
  in Connection class). A connection to a particular target is
  incapsulated in a new Session class.
2017-08-09 16:14:00 -07:00
JoelEinbinder
fc70ab8f21 Add delay option to input methods ()
Add delay option to input methods for the keyboard and mouse.

Closes 
2017-07-31 18:18:15 -07:00
JoelEinbinder
bfc40b2ee6 Specify repeat property on repeated keypresses ()
This patch implements 'autoRepeat' functionality for `keyboard.down`.
With this patch, the subsequent calls to `keyboard.down` would generate
an event with 'autoRepeat` flag set to true.

Closes 
2017-07-31 12:05:46 -07:00
JoelEinbinder
b474a2d0d9 Mark options objects as optional () 2017-07-30 13:46:56 -07:00
JoelEinbinder
3c75767288 Fix media keys to use new key strings and codes ()
VolumeUp, VolumeDown, and VolumeMute were changed to AudioVolumeUp, AudioVolumeDown, and AudioVolumeMute

The media keys like MediaTrackNext were also missing, so I added them.
2017-07-28 11:38:30 -07:00
JoelEinbinder
aa28eb80f0 Wait for double raf after all mouse events. ()
This patch starts waiting for double raf after every mouse event.
It looks like a good enough workaround to make sure mouse events
are delivered.

The single raf might not be enough because browser might 'return' an already-prepared
frame for us without actually dispatching events.

Closes 
2017-07-25 17:03:13 -07:00
JoelEinbinder
64968862db Implement mouse.click(x,y) ()
Closes 
2017-07-25 16:05:23 -07:00
Pavel Feldman
eca0d7fe53 Simplify keyboard modifiers handling () 2017-07-25 14:35:03 -07:00