Commit Graph

1352 Commits

Author SHA1 Message Date
Andrey Lushnikov
5ed71fcb8f Test the 'networkidle' navigation logic
This patch adds a test to verify that navigation properly waits for the
network to become idle.

References #10
2017-06-27 22:02:46 -07:00
JoelEinbinder
d5a91650ae Implement Basic input API
This patch implements Basic Input api:
- Page.focus(selector) - focuses element with selector
- Page.click(selector) - clicks element with selector
- Page.type(text) - types text into a focused element

Fixed #43.
2017-06-27 18:27:22 -07:00
Andrey Lushnikov
3d90ea38a9 Implement Frame.evaluate
This patch implements Frame.evaluate method.

References #4.
2017-06-27 14:57:14 -07:00
Andrey Lushnikov
4b0b3b5ff5 add stubs for methods in api.md
References #14
2017-06-27 12:15:26 -07:00
Andrey Lushnikov
9508396e3e Mark phantomjs/test/module/webpage/render.js as unsupported
The test does a binary comparison of output results,
which is not sufficient for puppeteer. Puppeteer has
it's own screenshot tests.
2017-06-23 11:12:50 -07:00
Andrey Lushnikov
819fa355f4 Convert var's to let's
This patch:
- converts all var's to let's throughout the codebase
- enforces the let's over var's via the eslint rule
2017-06-22 14:58:39 -07:00
Andrey Lushnikov
78e879925f Unflake abort-network-request.js on Travis-Ci
The patch increases timeout up to 5 seconds.
2017-06-21 16:31:11 -07:00
Pavel Feldman
cf35524285 Foramt JSDocs for 2 spaces 2017-06-21 14:11:52 -07:00
Pavel Feldman
437a93b26e Reformat code using 2 spaces 2017-06-21 14:11:52 -07:00
Pavel Feldman
bc0655b587 Extract basic in-flight counting navigator 2017-06-21 14:11:52 -07:00
Pavel Feldman
4761f13740 Inline helper eval functions 2017-06-21 14:11:52 -07:00
Pavel Feldman
84bc09bce1 Revert "Reformat codebase into 2-spaces"
This reverts commit d0d1ee303e41fe4ba762a031b78c3894edac52df.
2017-06-21 14:11:52 -07:00
Andrey Lushnikov
8e0db60c03 Update api.md
This patch improves on api.md so that the raw md is human-readable
and the rendering is still good.

The next step would be linting markdown so that it's up-to-date and neat.

References #14.
2017-06-21 14:11:52 -07:00
Andrey Lushnikov
448ac4ce64 Reformat codebase into 2-spaces
This patch:
- reformats codebase to use 2-spaces instead of 4. This will
  align the project with other codebases (e.g. DevTools and Lighthouse)
- enables eslint indentation checking

References #19
2017-06-21 14:11:52 -07:00
Andrey Lushnikov
bbaf2f091c Add travis-Ci build status to README.md 2017-06-21 14:11:52 -07:00
Andrey Lushnikov
5e94d66c38 Update libssn3 via .travis.yml
References #33.
2017-06-21 14:11:52 -07:00
Andrey Lushnikov
aaefec7868 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-21 14:11:52 -07:00
Joel Einbinder
3f6c413a24 Switch example screenshot to PNG 2017-06-21 14:11:52 -07:00
Andrey Lushnikov
7874108fda Fix running on Travis-Ci 2017-06-21 14:11:52 -07:00
Andrey Lushnikov
eb02af93b6 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-21 14:11:52 -07:00
Andrey Lushnikov
229edb6b9b Split out utils for golden tests into a separate file 2017-06-21 14:11:52 -07:00
Andrey Lushnikov
175963182e 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-21 14:11:52 -07:00
Paul Irish
a66480a416 Fix ESLint failures (#34)
References #33
2017-06-21 14:11:52 -07:00
Paul Irish
a033b1b7ac Add travis config (#29)
This patch: 
- adds travis
- adds eslint as required in devdeps
- cleans up travis yml
2017-06-21 14:11:52 -07:00
Pavel Feldman
8e0a3ac6d9 Make InPageCallback async (#24)
Fixes #20
2017-06-21 14:11:52 -07:00
Eric Bidelman
ef426b5721 feedback 2017-06-21 14:11:52 -07:00
Eric Bidelman
92eefea511 Tweaks to readme. API doc link 2017-06-21 14:11:52 -07:00
Pavel Feldman
9ad4938fcb Inline helper evaluate functions 2017-06-21 14:11:52 -07:00
Andrey Lushnikov
1ebf3aa5aa update CONTRIBUTING.md 2017-06-21 14:11:52 -07:00
Andrey Lushnikov
86c235cb4f Update README.md
This patch updates README.md with some relevant information about puppeteer
2017-06-21 14:11:52 -07:00
Andrey Lushnikov
fce6b71d8e 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-21 14:11:52 -07:00
Eric Bidelman
e73d22a564 use npm 2017-06-21 14:11:52 -07:00
Eric Bidelman
96e5736528 Add lint script and editorconfig file 2017-06-21 14:11:52 -07:00
Eric Bidelman
f185ab749f Fix readme example 2017-06-21 14:11:52 -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