Commit Graph

138 Commits

Author SHA1 Message Date
Joel Einbinder
5cca7c0cae fix(types): don't report events as class members (#3874) 2019-01-31 17:53:16 -08:00
Joel Einbinder
f2c968fdb8 chore(types): generate our own d.ts file from api.md (#3744)
Generate `//index.d.ts` file with precise typescript definitions for all of the
Puppeteer API.
2019-01-28 15:12:45 -08:00
Andrey Lushnikov
62da2366c6
chore: introduce //lib/api.js (#3835)
Introduce `//lib/api.js` that declares a list of publicly exposed
classes.

The `//lib/api.js` list superceedes dynamic `helper.tracePublicAPI()` calls
and is used in the following places:
- [ASYNC STACKS]: generate "async stacks" for publicy exposed API in `//index.js`
- [COVERAGE]: move coverage support from `//lib/helper` to `//test/utils`
- [DOCLINT]: get rid of 'exluded classes' hardcoded list

This will help us to re-use our coverage and doclint infrastructure
for Puppeteer-Firefox.

Drive-By: it turns out we didn't run coverage for `SecurityDetails`
class, so we lack coverage for a few methods there. These are excluded
for now, sanity tests will be added in a follow-up.
2019-01-25 23:21:14 -05:00
Dylan Bathurst
842610256c docs(troubleshooting): fix bundle directions (#3808) 2019-01-18 17:33:34 -08:00
Andrey Lushnikov
4ac00caf9d
refactor: split out DOMWorld from Frame (#3780)
This patch splits out `IsolatedWorld` class from Frame.
The `IsolatedWorld` abstraction is an execution context
with a designated set of DOM wrappers.

References #2671
2019-01-15 17:21:23 -08:00
Andrey Lushnikov
bea26a7f58
chore(testrunner): sort workers numerically when terminating (#3782) 2019-01-15 16:40:58 -08:00
Andrey Lushnikov
4e9e3bc614
refactor: consolidate all events in Events.js (#3772)
This will allow us to break all dependency cycles that were forcing
us to put many things in a single file (e.g. ExecutionContext and
ElementHandle).
2019-01-14 19:57:05 -08:00
Joel Einbinder
a0cbaf39ab chore(types): lint the api docs with typescript (#3577) 2018-11-21 14:49:08 -08:00
Andrey Lushnikov
927d0f443b
feat(page): support waitUntil option for page.setContent (#3557)
This patch teaches `page.setContent` to await resources in
the new document.

**NOTE**: This patch changes behavior: currently, `page.setContent`
awaits the `"domcontentloaded"` event; with this patch, we can now await
other lifecycle events, and switched default to the `"load"` event.

The change is justified since current behavior made `page.setContent`
unusable for its main designated usecases, pushing our client
to use [dataURL workaround](https://github.com/GoogleChrome/puppeteer/issues/728#issuecomment-334301491).

Fixes #728
2018-11-20 15:32:46 -08:00
Andrey Lushnikov
eb7bd9d7d3
test: setup sandbox on linux (#3530)
Drop all the `--no-sandbox` bits from tests and infrastructure. Instead, configure
Travis to enable user namespace clone.
2018-11-12 23:26:16 -08:00
Andrey Lushnikov
1d671c69a3
chore(bisect): properly output bisect ranges + output styling (#3523)
A bit more colors

![image](https://user-images.githubusercontent.com/746130/48240497-d1845180-e387-11e8-9bac-dcde29ef967e.png)
2018-11-08 19:17:56 -08:00
Andrey Lushnikov
6693537f95
chore: add utils/bisect.js to bisect chromium revisions (#3511)
This patch adds a new utility - `utils/bisect.js` - that accepts
a range of Chromium revisions and a pptr script and bisects the
range to figure when the script breaks.

The Puppeteer Script, given to the tool, should be exiting
with non-zero code to signify malfunctioning.

Example:
```
$ node utils/bisect.js --good 577361 --bad 599821 a.js
```
2018-11-08 18:34:18 -08:00
Andrey Lushnikov
52a103024b
feat(chromium): roll Chromium to r604907 (#3488)
Also, new Chrome now exposes a new type in its protocol - binary.
It becomes a raw C++ array once used through C++ bindings, but for
us it's still a base64 string.
2018-11-02 17:16:17 -07:00
Joel Einbinder
9ba3261571 feat(accessibility): snapshot the accessibility tree (#3470)
This adds `page.accessibility.snapshot()`. It serializes and returns the accessibility tree for the page. By default, uninteresting nodes are filtered out of the snapshot.

fixes #2033
2018-11-01 18:54:51 -07:00
Andrey Lushnikov
4110087a60
docs(puppeteer-web): a note about running inside extension (#3477)
Fixes #3455
2018-11-01 15:45:06 -07:00
Andrey Lushnikov
4abf7d1fba
docs(bundling): add docs about bundling for web (#3348) 2018-10-04 14:23:03 -07:00
Andrey Lushnikov
85aca8e1a5
chore(testserver): prepare test server (#3294) 2018-09-24 12:46:39 -07:00
Andrey Lushnikov
9c89090f73
chore(testrunner): fix readme description (#3293) 2018-09-21 20:44:43 -07:00
Andrey Lushnikov
12e317ce17
chore: add .npmignore for testrunner (#3290) 2018-09-21 17:27:10 -07:00
Andrey Lushnikov
5b3ddf554a
chore(testrunner): bump version to v0.5.0-post (#3291) 2018-09-21 15:25:17 -07:00
Andrey Lushnikov
907d9bed6d
chore: prepare testrunner to be published to npm (#3289)
testrunner will be published as @pptr/testrunner.
2018-09-21 14:51:22 -07:00
Andrey Lushnikov
4e48dfc7a1
feat(launcher): add experimental "transport" option to pptr.connect (#3265)
This patch:
- adds experimental "transport" option to pptr.connect
- uses "transport" option to make sure Puppeteer-Web works with
  Target.exposeDevToolsProtocol

Drive-by: add `browser.target()` to access browser target.
2018-09-20 11:55:23 -07:00
Andrey Lushnikov
a1a211d9e7
chore: nicer stack highlight (#3259)
Highlight part of the stack that points to where the actual
test failure happened.
2018-09-17 23:22:53 +01:00
Andrey Lushnikov
6ec3ce6920
chore: make sure Puppeteer bundling works (#3239)
This patch:
- adds "browser" field to the package.json with default
  bundling options.
- introduces "bundle" and "unit-bundle" commands to
  create bundle and test bundle
- starts running bundle tests on Travis Node 8 bots

Fixes #2374.
2018-09-13 20:08:51 +01:00
Andrey Lushnikov
1b2c8113ba
refactor: move Connection to use ConnectionTransport (#3217)
Currently connection assumes that transport is a websocket
and tries to handle websocket-related errors.

This patch:
- moves ConnectionTransport interface to use callbacks instead
  of events. This way it could be used in browser context as well.
- introduces WebSocketTransport that implements ConnectionTransport
  interface for ws.

This is a preparation step for 2 things:
- exposing `transport` option in the `puppeteer.connect` method
- better support for `browserify`

References #2119
2018-09-07 21:36:16 +01:00
Andrey Lushnikov
42fde9b5e2
chore: another attempt to fix pptr@next (#3210)
It turns out that travis runs commands in sh rather then in bash.

Fixes #2925.
2018-09-06 21:38:17 +01:00
Andrey Lushnikov
b7e922b5f5
chore: fix puppeteer@next race condition (#3209)
When we merge commits to master, Travis kicks job to build a new commit
and to publish new version of puppeteer@next.

If two commits are landed in almost the same time, then travis starts
two parallel jobs to build each commit. This race condition results
in the incorrect puppeteer@next revision.

This patch teaches apply_next_version.js to verify if current HEAD
is matching upstream HEAD. If it doesn't, the predeploy hook fails
which (hopefully) aborts deployment.

Fixes #2925.
2018-09-06 20:57:35 +01:00
Andrey Lushnikov
7db4f0f798
chore: preserve links to master version of API from README.md (#3197)
One of our checks makes sure all links from README.md to API.md
point to the last-released version of the API.

This sometimes doesn't work: when we refer to a section
in api.md that is just added, we should be able to reference
the "master" version of the api.md

This patch:
- teaches the doclint check to keep links to tip-of-tree version
  of api.md in README.md intact.
- starts refering to tip-of-tree version of api.md in `puppeter-core` section
2018-09-05 20:33:04 +01:00
Andrey Lushnikov
204c7ec8c4
feat: introduce puppeteer/Errors (#3056)
This patch adds a new require, `puppeteer/Errors`, that
holds all the Puppeteer-specific error classes.

Currently, the only custom error class we use is `TimeoutError`. We'll
expand in future with `CrashError` and some others.

Fixes #1694.
2018-08-09 16:51:12 -07:00
Andrey Lushnikov
1be7545b70
chore: enhance markdown preprocessor (#3050)
Use preprocessor to make sure all the links in out README.md point
to the last-released version of documentation.

Fixes #3038.
2018-08-08 18:20:20 -07:00
Andrey Lushnikov
81d42c4688
feat: prepare for publishing puppeteer-core (#3047) 2018-08-08 15:14:23 -07:00
Andrey Lushnikov
862ad96bde
test: dump workers state after the test runner is terminated (#2991)
This will help us to debug the flakes on the CI.
2018-07-30 18:57:48 -07:00
Andrey Lushnikov
cd8d750628
fix(devicedescriptors): fix UA in DeviceDescriptors (#2741)
This patch:
- updates `utils/fetch_devices.js` script to format UAs for Chrome UAs
  and to add iPhone 6/7/8 as separate devices.
- re-generates `DeviceDescriptors.js` with the new script

Fixes #2730.
2018-06-14 13:55:09 -07:00
Andrey Lushnikov
9904da262e
chore(doclint): remove old unused table-of-contents generator (#2659)
We no longer use markdown-toc to generate table-of-contents.
2018-06-01 13:59:31 -07:00
Andrey Lushnikov
0b94fa70eb
chore: stop using console.assert everywhere (#2646)
Since Node 10, `console.assert` no longer throws an AssertionError.
(This is generally good since it aligns Node.js with Browsers.)

This patch migrates all usages of `console.assert` in our codebase.
- All the `lib/` and testing code is migrated onto a handmade `assert`
function. This is to make Puppeteer transpilation / bundling easier.
- All the tooling is switched to use Node's `assert` module.

Fixes #2547.
2018-05-31 16:53:51 -07:00
Andrey Lushnikov
754df58d4e
docs(api.md): fix table-of-contents (#2636)
This patch drops the markdown-toc module and instead rolls out
our own simple markdown table-of-contents generator.

As a side effect, it fixes links to `page.$` and `page.$$`.
2018-05-31 14:21:43 -07:00
Andrey Lushnikov
0ad0096e21
chore(utils): change utils/check_availability.js to fetch last revisions (#2635)
This patch changes `utils/check_availability.js` to fetch last revisions
per platform when ran without any arguments.
2018-05-31 14:20:41 -07:00
Joel Einbinder
1bbd094624 feat(test): enable dumpio in tests #2610
This patch allows logging the output of the Chromium process to be enabled in tests by passing in the environment variable `DUMPIO=true`.

Additionally, the `stderr` of the Chromium process will always be logged in the the "Output" section of failing page tests.
2018-05-29 15:45:03 -07:00
Joel Einbinder
8e12d197a2 fix(tests): normalize scrollbars in headful tests (#2622)
Scrollbars look different on different platforms, so must be made invisible in tests. As a drive-by, xdescribe was broken with the new test runner.

References #2524
2018-05-29 15:30:08 -07:00
Joel Einbinder
c9a843baa0 chore(types): generate protocol.d.ts on install (#2625)
Previously protocol.d.ts was generated on `npm run tsc`. This was inconvenient because it meant that vscode checking was wrong until type checking was run manually, and was inefficient because it necessarily regenerated the types even if no new Chromium was downloaded. This patch generates the types when npm install is run from the github checkout, assuming a new Chromium revision was downloaded.
2018-05-29 15:23:32 -07:00
Andrey Lushnikov
8a62b10fd0
chore: testrunner's ".not" should print appropriate message (#2459)
When failing, the ".not" matchers should print their name
with ".not" prefix.
2018-04-26 11:13:22 -07:00
Andrey Lushnikov
0820d48f80
chore: link to the latest-released API from the README.md (#2449)
This patch adds a preprocessor command to link to the latest-released
API from the README.md.

Fixes #1923.
2018-04-25 18:18:08 -07:00
Andrey Lushnikov
13a41495aa
chore(doclint): remove SourceFactory (#2447)
SourceFactory was meant to cache Sources so that they could be used
in different preprocessor tasks.

This turned out to be over-engineering. This patch kills the layer.
2018-04-25 18:07:20 -07:00
Andrey Lushnikov
6d19db4df1
chore: enhance preprocessor commands to automate releases. (#2446)
Last release v1.3.0 had an error in the documentation, claiming
it wasn't released.

This patch makes sure we have a little bit of automation in place
to save us from this in future.
2018-04-25 17:11:45 -07:00
Andrey Lushnikov
beea6f9c82
chore(testrunner): fix typo in readme 2018-04-10 12:25:14 -07:00
JoelEinbinder
294f33b75c chore(types): type check the rest of the protocol (#2328)
This adds events and commands into generated `protocol.d.ts`.
2018-04-07 17:58:52 -07:00
JoelEinbinder
8c54f41552 chore(types): generate a d.ts file for protocol types (#2325)
This uses the `/json/protocol` endpoint to generate type definitions for the protocol.

Currently it is lacking protocol events and commands, but I will add those later.
2018-04-06 18:20:48 -07:00
JoelEinbinder
2370618819 chore(types): upgrade to TypeScript 2.8.1 (#2304)
This converts `externs.d.ts` to export a global namespace instead of a UMD global.

See: https://github.com/Microsoft/TypeScript/issues/22969

Fixes #2279.
2018-04-04 14:06:21 -07:00
JoelEinbinder
d79eb70267 fix(node6): fix one line await arrow functions #2198
When the start of the function body was await, the async function transformer behaves
non-deterministically and can break.
2018-03-15 14:54:23 -07:00
Andrey Lushnikov
afcc74e7c7
test: fix Matcher.toEqual to not depend on key insertion order (#2091)
Objects `{foo: 1, bar: 2}` and `{bar: 2, foo: 1}` should be considered
equal.
2018-03-15 11:49:53 -07:00