Commit Graph

3577 Commits

Author SHA1 Message Date
Pavel Feldman
7fdf800a39 Simplify frame manager, do not fetch resources upfront (#159)
This patch:
- gets rid of Page.getResourceTree() protocol method
- rolls chromium to 490379

Fixes #127
2017-07-28 16:52:38 -07:00
Andrey Lushnikov
bd767002bb Fix navigation to about:blank
This patch fixes navigation to about:blank url.
2017-07-28 16:44:51 -07:00
JoelEinbinder
26d97bbe3e Fix injectfile test on Windows (#162) 2017-07-28 11:48:41 -07:00
JoelEinbinder
8780fcb662 Event coverage and debugging (#160)
This patch introduces event coverage for DEBUG module and 
API coverage.

Closes #50.
2017-07-28 11:45:05 -07:00
JoelEinbinder
3c75767288 Fix media keys to use new key strings and codes (#164)
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
1998104489 run phantom tests on windows (#163)
Allow running phantom tests on Windows. These were relying on #!/usr/bin/env node at the top of runner.js, which doesn't work outside of a unix environment.
2017-07-28 11:08:13 -07:00
Andrey Lushnikov
02d4c8819d Fix phantom tests after version bump
It turned out that PhantomShim used puppeteer's version to report
in tests. This caused one of phantomJS tests to fail when the puppeteer
version got bumped.

This patch grants PhantomShim its own version, independent from
puppeteer's. This would make it easier to roll puppeteer.
2017-07-28 01:51:32 -07:00
Andrey Lushnikov
245391cb54 [doc] add missing quote in api.md example 2017-07-28 01:25:33 -07:00
Andrey Lushnikov
91785d97f3 Add missing LICENSE headers to the source files
This patch:
- adds missing LICENSE headers to the source files
- set's puppeteer version to 0.1.0
- set's repository field in package.json
2017-07-28 01:09:26 -07:00
Andrey Lushnikov
d26e2399f2 Resolve paths against CWD in page.uploadFile() method
This patch:
- teaches page.uploadFile() to resolve given file paths against
  current working directory. This aligns paths handling with all the
  other methods
- moves page.uploadFile() under Frame
- changes test to use relative path for file upload
2017-07-28 00:06:57 -07:00
Andrey Lushnikov
0452644b83 [doc] Clarify that path is resolved against current working directory
Fixes #150.
2017-07-27 23:34:32 -07:00
Andrey Lushnikov
ba37a4f82d Get rid of Body class
The Body class was inlined in the Request and Response classes.
This patch:
- removes the Body class
- adds Request.postData public property
- adds Response.buffer(), Response.text() and Response.json() methods

Fixes #106.
2017-07-27 23:11:24 -07:00
Andrey Lushnikov
8d7d15fdb1 Update README.md
Make README.md examples consistent.
2017-07-27 19:23:21 -07:00
Andrey Lushnikov
7bfd56605b Update README.md
Make top links less ugly
2017-07-27 19:21:24 -07:00
Andrey Lushnikov
97c3e40ca2 Update README.md
Leave only essential information in the README.md

References #7
2017-07-27 19:15:30 -07:00
Andrey Lushnikov
b9e3cce5fd Fail navigation when main resource fails to load
This patch fails navigation when the main resource fails to load.

Fixes #148.
2017-07-27 17:54:39 -07:00
Andrey Lushnikov
f1a4598cc1 Clarify coverage report 2017-07-27 17:32:02 -07:00
Andrey Lushnikov
d1f2c01db5 Attempt to fix tests to not throw targetClosed exception
The exception happens due to some of the tests initiating
operation and not waiting for the operation to finish.
2017-07-27 17:20:02 -07:00
Andrey Lushnikov
bd898b7f56 Implement function as a part of a page.waitFor shortcut
This patch adds a function as a possible argument to
page.waitFor shortcut.

Fixes #91.
2017-07-27 17:09:28 -07:00
Andrey Lushnikov
ff5ed1c738 Implement page.waitForFunction method
The page.waitForFunction method allows to wait for a general predicate.
The predicate will be continiously polled for in page, until
it either returns true or the timeout happens.

The polling parameter could be one of the following:
- 'raf' - to poll on every animation frame
- 'mutation' - to poll on every dom mutation
- <number> - to poll every X milliseconds

References #91
2017-07-27 16:45:14 -07:00
Andrey Lushnikov
47a0366b16 Fix typo in coverage
This patch:
- fixes typo in coverage
- enables coverage on Travis CI

References #50.
2017-07-27 16:35:17 -07:00
JoelEinbinder
a2e0d27fb6 Implement public API coverage
This patch:
- implements a basic public API coverage based on 'helper.tracePublicAPI' methods
- adds `npm run coverage` command which reports coverage after running all of the unit tests

References #50.
2017-07-27 16:16:37 -07:00
Andrey Lushnikov
c26d2c8271 Remove redundant methods from Body class
This patch:
- removes Body.arrayBuffer. This method is redundant since there's
  already a Body.buffer() method
- removes Body.bodyUsed getter.

References #106
2017-07-27 14:43:14 -07:00
JoelEinbinder
847504c53e [doc] link to mdn selector documentation (#155)
closes #149
2017-07-27 13:11:59 -07:00
Andrey Lushnikov
e39d8602b0 Rename page.setHTTPHeaders into page.setExtraHTTPHeaders
This patch:
- renames page.setHTTPHeaders into page.setExtraHTTPHeaders
- starts using Map instead of Object to align with other headers
  arguments

Fixes #112.
2017-07-27 12:51:18 -07:00
JoelEinbinder
bbde8fd1c2 page.evaluate takes a string in addition to function (#135)
This patch improves on page.evaluate to accept a string.
The string can have a trailing '//# sourceURL=' comment which would
name the evaluation to make stacks beautiful.

In order to make sourceURL comments possible, this patch:
- removes wrapping of the client function into `Promise.resolve()`
- stops passing `awaitPromise` parameter to `Runtime.evaluate`
- starts to await promise via the `Runtime.awaitPromise` if the return type of the evaluation
  is promise

closes #118
2017-07-27 12:23:41 -07:00
JoelEinbinder
8870aaee17 Disable and enable some tests based on whether chrome is headless (#154)
This patch:
- Runs dialog test in headful mode only
- Runs pdf test in headless mode only
- Improves on documentation to outline these shortcomings
2017-07-27 11:44:18 -07:00
JoelEinbinder
70f77c1981 add tests for Frame class
This patch:
- improves documentation of frame.name()
- adds a test for frame.name()
- adds a test for frame.parent()

References #50.
2017-07-27 11:36:03 -07:00
JoelEinbinder
dd1459b733 Browser version test (#152)
This patch adds a test for Browser.version()

References #50.
2017-07-27 11:32:58 -07:00
Andrey Lushnikov
cfc6a6ab38 Update CONTRIBUTING.md
Fixes #146.
2017-07-27 11:28:35 -07:00
Andrey Lushnikov
480547955c Drop Headers class in favor of a Map object
This patch removes Header class and substitutes it with a simple
Map object.

The map is chosen over the vanilla object since it has explicit
order of headers which we'd like to preserve.

References #106.
2017-07-27 09:35:44 -07:00
Pavel Feldman
585f815548 Don't use Emulation.resetPageScaleFactor (#147)
Instead of using Emulation.resetPageScaleFactor, this patch starts using clip's scale for
fullPage screenshots.
2017-07-26 15:28:44 -07:00
Pavel Feldman
5068185d03 Don't ever enable DOM domain. (#145)
This patchs makes sure DOM domain is never enabled. The reasoning behind this is that
DOM domain is heavy-weight: it generates a lot of traffic over the protocol.

Drive-by: use Page.addScriptToEvaluateOnNewDocument instead of Page.addScriptToEvaluateOnLoad
2017-07-26 15:19:43 -07:00
Will Chen
7a482c5697 docs: fix broken links in API (#144)
This patch fixes links in api.md.
2017-07-26 15:06:23 -07:00
JoelEinbinder
2e6751d6f5 Trace only string method names (#141) 2017-07-26 11:48:40 -07:00
JoelEinbinder
9363a15cce Small fixes to jsdoc (#140)
References #65.
2017-07-26 09:58:03 -07:00
JoelEinbinder
81d4b8f4f8 Document all options objects wherever they are used (#139)
This patch adds missing documentation for all the shortcut methods, such as
`page.evaluate` or `page.waitForSelector`.

closes #114
2017-07-25 21:01:05 -07:00
Alexei Filippov
83f4e43564 Clean up Browser annotations. (#138) 2017-07-25 20:39:50 -07:00
JoelEinbinder
aa28eb80f0 Wait for double raf after all mouse events. (#123)
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 #122
2017-07-25 17:03:13 -07:00
JoelEinbinder
1a50403090 fix linter (#136)
This patch fixes broken travis, caused by impatient merge of f455e3a1e
2017-07-25 16:47:49 -07:00
Pavel Feldman
f455e3a1e4 Remove NetworkManager usage from NavigatorWatcher (#134) 2017-07-25 16:06:53 -07:00
JoelEinbinder
64968862db Implement mouse.click(x,y) (#131)
Closes #107
2017-07-25 16:05:23 -07:00
JoelEinbinder
2081c12317 update package-lock.json (#132) 2017-07-25 15:58:32 -07:00
Pavel Feldman
49e363c121 Mess with lusha's waitFor for fun. (#133) 2017-07-25 15:57:31 -07:00
Pavel Feldman
4adf11427a Unconditionally update frame payload on navigation only. (#130) 2017-07-25 14:58:10 -07:00
Pavel Feldman
eca0d7fe53 Simplify keyboard modifiers handling (#129) 2017-07-25 14:35:03 -07:00
Pavel Feldman
0007809305 Move inner evaluate helpers into frame class. (#128) 2017-07-25 14:30:04 -07:00
JoelEinbinder
4f5f1f6d77 Move missing methods from page onto frame. (#125)
Closes #113
2017-07-25 11:37:46 -07:00
Andrey Lushnikov
b564029589 Improve documentation for the page.waitFor method.
Fixes #109.
2017-07-25 08:46:11 -07:00
JoelEinbinder
877f06aacb Remove userAgent getter (#126)
If needed, the user agent could be fetched via querying
`navigator.userAgent` in page.

Closes #110
2017-07-25 02:01:10 -07:00