Commit Graph

92 Commits

Author SHA1 Message Date
Andrey Lushnikov
6ea65a0b77 Update libssn3 via .travis.yml
References #33.
2017-06-20 21:14:59 -07:00
Andrey Lushnikov
3a5cad83d2 Fix Travis-Ci tests
It turned out that the tip-of-tree chromium fails to start on Travis
because of two reasons:
- inability to run LinuxSUIDSandbox
- libnss3 library version being too small

Both problems happen because of the outdated "trusty" distribution
which is used on travis.

This patch:
- reverts the previous patch 9e6f779. Instead of introducing such
  a weird "api", both phantom_shim/runner.js and test/test.js no
  explicitly pass '--no-sandbox' flag to the browser
- updates the libnss3 lib on travis

Fixes #33
2017-06-20 21:10:50 -07:00
Joel Einbinder
c4b435fb9d Switch example screenshot to PNG 2017-06-20 20:45:51 -07:00
Andrey Lushnikov
9e6f779322 Fix running on Travis-Ci 2017-06-20 19:47:12 -07:00
Andrey Lushnikov
422e09c8ef Improve error reporting when chrome fails to start
This patch starts throwing exception and dumping chromium stderr when
the browser fails to start.

References #33
2017-06-20 19:27:48 -07:00
Andrey Lushnikov
6274b9f93b Split out utils for golden tests into a separate file 2017-06-20 18:19:59 -07:00
Andrey Lushnikov
b3b0c1a035 Implement FrameManager
This patch implements FrameManager which is responsible for maintaining
the frame tree. FrameManager is quite basic: it sends FrameAttached,
FrameDetached and FrameNavigated events, and can report mainFrame and
all frames.

The next step would be moving certain Page API's to the Frame. For
example, such method as Page.evaluate, Page.navigate and others should
be available on Frame object as well.

References #4
2017-06-20 17:56:56 -07:00
Paul Irish
5a27edc635 Fix ESLint failures (#34)
References #33
2017-06-20 17:32:08 -07:00
Paul Irish
d4041473ad Add travis config (#29)
This patch: 
- adds travis
- adds eslint as required in devdeps
- cleans up travis yml
2017-06-20 17:04:24 -07:00
Pavel Feldman
e49eebb55a Make InPageCallback async (#24)
Fixes #20
2017-06-20 14:54:53 -07:00
Andrey Lushnikov
de3f7295e6 Merge pull request #25 from GoogleChrome/readme
Tweaks to readme. API doc link
2017-06-20 11:32:20 -07:00
Eric Bidelman
2d8d24cadd feedback 2017-06-20 10:33:21 -07:00
Eric Bidelman
a0d084754f Tweaks to readme. API doc link 2017-06-19 19:17:11 -07:00
Andrey Lushnikov
690d2e5810 Merge pull request #22 from pavelfeldman/async_callback
Inline helper evaluate functions
2017-06-19 16:59:42 -07:00
Andrey Lushnikov
31942728da update CONTRIBUTING.md 2017-06-19 16:56:29 -07:00
Pavel Feldman
c75514ba9d Inline helper evaluate functions 2017-06-19 16:42:55 -07:00
Andrey Lushnikov
10e28a9b27 Update README.md
This patch updates README.md with some relevant information about puppeteer
2017-06-19 16:37:55 -07:00
Andrey Lushnikov
f8ac25d85d Cleanup usages of Page.saveScreenshot of 3b0bc080
The `Page.saveScreenshot` method was removed in favor of a `path`
option in the `Page.screenshot` method.
2017-06-19 16:26:23 -07:00
Andrey Lushnikov
be8ce8f79f Merge pull request #17 from GoogleChrome/lint
Add lint package.json lint script, .editorconfig file, fix linting errors
2017-06-19 15:58:30 -07:00
Eric Bidelman
5cf2083f1c use npm 2017-06-19 15:44:54 -07:00
Andrey Lushnikov
bcbd0787f7 Merge pull request #18 from GoogleChrome/examplefix
Fix: working readme example and api docs for Page.screenshot
2017-06-19 15:32:08 -07:00
Andrey Lushnikov
744c88967c Merge pull request #16 from GoogleChrome/yarn
Add yarn.lock
2017-06-19 15:25:42 -07:00
Eric Bidelman
9a4d8f9ab3 Fix readme example 2017-06-19 15:01:14 -07:00
Eric Bidelman
178d5aff41 Add lint script and editorconfig file 2017-06-19 14:44:09 -07:00
Eric Bidelman
9a40396382 Add yarn.lock 2017-06-19 14:35:53 -07:00
Andrey Lushnikov
868814ac7f Implement fullPage screenshots
This patch adds a 'fullPage' option to the Page.screenshot
method.

Fixes #6.
2017-06-16 22:34:29 -07:00
Andrey Lushnikov
af52f13e22 Add screenshot test to verify clipping of offscreen areas. 2017-06-16 22:02:03 -07:00
Andrey Lushnikov
9de48fb51e Merge goldentest.js into test.js
This patch introduces a custom jasmine matcher which compares
images to golden results. As a result, it becomes possible
to incorporate the goldentest.js into test.js.

This allows to write tests in a unified way.
2017-06-16 21:42:47 -07:00
Andrey Lushnikov
792456302c Add test expectation missing in dbb374d
References #15.
2017-06-16 20:31:07 -07:00
Andrey Lushnikov
dbb374d4af Fix racy condition in case of multiple parallel screenshots
Page.screenshot operates the global state of the page. In case of
multiple Page.screenshot() commands running in parallel with different
clipping rects, they interfere with each other.

This patch makes Page.screenshot() commands run sequencially
even though they were called in parallel.

Fixes #15.
2017-06-16 20:20:36 -07:00
Andrey Lushnikov
3b0bc0802d Refactor Page.screenshot() api
This patch refactors Page.screenshot api, accoring to the discussion
in #5:
- Page.screenshot accepts single optional options object
- Page.saveScreenshot is removed
- Page.screenshot assumes 'png' screenshot if no type is set and no
  'path' property is given

Fixes #5.
2017-06-16 17:15:24 -07:00
Andrey Lushnikov
7d04d112da Use digit images in test/assets/grid.html
The font rendering differs from platform to platform. This is an
attempt to make screenshot tests platform-agnostic.
2017-06-16 16:00:36 -07:00
Andrey Lushnikov
6bed8c62b3 Pass integers to the Emulation.setVisibleSize
Integers are required in the Emulation.setVisibleSize. This patch
fixes the screenshot clipRect so that it never tries to pass
float values.
2017-06-16 15:43:09 -07:00
Andrey Lushnikov
25e0bac461 add missing pngjs module 2017-06-16 15:02:14 -07:00
Andrey Lushnikov
242a6a6e73 Introduce screenshot tests
This patch introduces a goldentest.js. The tests inside
the file should rely on "golden" results rather then asserts.

For now, goldentest.js allows only image expectations. If the
actual result doesn't match the expected result, the two files
are created under `test/output` folder:
- The '-actual.png' contains the actual test result
- The '-diff.png' contains the diff between images
2017-06-16 14:33:34 -07:00
Andrey Lushnikov
28a3343d2c Add the missing 'ws' dependency. 2017-06-16 13:55:23 -07:00
Andrey Lushnikov
3d183dd996 add forgotten error.html test asset 2017-06-16 11:35:03 -07:00
Andrey Lushnikov
163e14345d Remove Page.handleDialog method
This is a left-over after refactoring in f62cfc3b.

References #2.
2017-06-16 11:24:47 -07:00
Andrey Lushnikov
632b90efae Page.Events.Error should throw an proper error
This patch:
- renames Page.Events.Exception in Page.Events.Error
- dispatches an error which has a page stack as its message
2017-06-16 11:21:44 -07:00
Andrey Lushnikov
2066da9ec7 Page.evaluate should reject in case of evaluation error
This patch makes Page.evaluate to throw an error if there
was an error in evaluated code.
2017-06-16 10:34:13 -07:00
Andrey Lushnikov
ff2c3bbca9 Cleanup Page class
This patch removes unneeded dependency from Page
to Browser.
2017-06-15 21:35:31 -07:00
Andrey Lushnikov
f62cfc3b34 Refactor JavaScript dialog API
This patch introduces a Dialog class and a new 'dialog'
event instead of the 'alert', 'beforeunload', 'confirm' and
'prompt' events and 'Page.handleDialog' method.

Fixes #2.
2017-06-15 21:22:41 -07:00
Andrey Lushnikov
14a75a83ea Merge Page.evaluate and Page.evaluateAsync together
This patch makes Page.evaluate await promise if one is
returned by the evaluated code.

This makes the Page.evaluateAsync unneeded, so the patch
removes it.

Fixes #11.
2017-06-15 14:56:40 -07:00
Andrey Lushnikov
50976c7f29 Implement Request.setHeader() method
This patch implements Request.setHeader() method to override
request headers.

References #8.
2017-06-15 08:37:06 -07:00
Andrey Lushnikov
5ba6621cde Remove the Page.setBlockedURLs method
This patch removes the Page.setBlockedURLs method. The
functionality is trivially implementable with the request
interception (see examples/loadurlwithoutcss.js).

Fixes #1.
2017-06-15 08:26:55 -07:00
Andrey Lushnikov
85ecce31f9 Add Request.abort() test
This patch:
- introduces StaticServer for the testing purposes
- switches tests from navigating to file:// to http://
- adds a test to cover Request.abort() functionality

References #1
2017-06-15 08:26:55 -07:00
Andrey Lushnikov
e274c26e8b Implement Page.setRequestInterceptor
This patch:
- introduces Request class.
- implements Page.setRequestInterceptor method. The method
  allows to install a callback which will be called for every request
  with a |Request| object as a single parameter. The callback is free
  to override certain request's properties and then either continue or
  abort it.
- implements request interception api for phantom-shim and unskips the
  module/webpage/abort-network-request.js phantomjs test

References #1
2017-06-15 08:26:50 -07:00
Andrey Lushnikov
9bdf9ed5de Fix jsdoc after 67932b8
This patch gets rid of "CDP" type in jsdoc annotations.
2017-06-14 18:37:42 -07:00
Andrey Lushnikov
67932b87c1 Drop the chrome-remote-interface dependency
This patch drops the chrome-remote-interface dependency and
introduces Connection class which handles all the communication
with remote target.

Closes #3
2017-06-14 15:45:59 -07:00
Andrey Lushnikov
dbffc3c35c Await promises returned from the inPageCallback
This patch teaches puppeteer to await promises returned
from the inPageCallback.
2017-06-14 08:21:56 -07:00