Commit Graph

17 Commits

Author SHA1 Message Date
Jack Franklin
5518bac291
chore: update how we track coverage during unit tests (#5779)
* chore: update how we track coverage during unit tests

The old method of tracking coverage was causing issues. If a test failed
on CI, that test's failure would be lost because the test failing would
in turn cause the coverage to fail, but the `process.exit(1)` in the
coverage code caused Mocha to not output anything useful.

Instead the coverage checker now:

* tracks the coverage in memory in a Map (this hasn't changed)
* after all tests, writes that to disk in test/coverage.json (which is
gitignored)
* we then run a single Mocha test that asserts every method was called.

This means if the test run fails, the build will fail and give the error
about that test run, and that output won't be lost when the coverage
then fails too.

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-04-30 13:00:41 +01:00
Jack Franklin
7a2a41f208
chore: move code to src/ and emit with TypeScript (#5568)
This updates our `tsconfig.json` so it emits our JavaScript files as
well as type checking them. We compile into `./lib` which we then ship
in our npm package. The source code has moved from `./lib` into `./src`.

Because the `src/` directory is exclusively JS files, this change is a
no-op in terms of code functionality but is the first step towards being
able to replace `src/X.js` with `src/X.ts` in a way that allows us to
migrate incrementally.

The `lib` directory is gitignored, and the `src` directory is
npmignored. On `npm publish` we will now run `npm run tsc` in order to
generate the outputted code.
2020-04-02 16:25:19 +02:00
Maja Frydrychowicz
33f1967072
(feat) Add option to fetch Firefox Nightly (#5467)
* (feat) Add option to fetch Firefox Nightly

Add Firefox support to BrowserFetcher and the install script.
By default, the latest Firefox Nightly is downloaded
directly from archive.mozilla.org (dmg, tar.bz2 and zip)

This also required changes that impact `puppeteer.launch()`
and `puppeteer.executablePath()`

Fixes #5151

* Update docs/api.md

Co-Authored-By: Mathias Bynens <mathias@qiwi.be>

* Clean up revision promise

* Improve error handling in revision check

* Remove matchAll

* Use explicit octal mode

* Update .gitignore

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-03-10 21:59:03 +01:00
Andrey Lushnikov
6bb0350b4d
test(firefox): introduce vendor-specific specs (#3890)
Certain Puppeteer methods do expose the inner browser - e.g.
`browser.version()` depends on the browser we run.

Split out these tests into a vendor-specific test suites.

References #3889
2019-02-01 17:55:12 -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
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
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
f2b6016354 chore: switch to npm from yarn (#1878)
This patch:
- migrates CI to use NPM
- drops lockfiles (`yarn.lock`). Lockfiles are ignored by package
  managers when the package is installed as a dependency, so this makes CI closer to the 
  installation our clients run.
2018-01-22 17:11:10 -08:00
Andrey Lushnikov
391d1abaa7
chore: generalize node6 transpilation (#1560)
This patch unifies node6 transpilation:
- instead of generating multiple top-level directories, prefixed with
  `node6-`, all transpiled code gets placed under single `node6/` folder
- transpilation doesn't change require paths of transpiled modules any
  more
2017-12-08 15:14:28 -08:00
Andrey Lushnikov
e6725e15af
tests: drop jasmine test runner (#1519)
This patch introduces a tiny test runner to run puppeteer tests.
The test runner is self-container and allows parallel (wrt IO) test execution.
It will also allow us to split tests into multiple files if necessary.

Comparing to the jasmine, the testrunner supports parallel execution, properly
handles "unhandled promise rejection" event and signals.

Comparing to ava/jest, the testrunner doesn't run multiple node processes,
which makes it simpler but sufficient for our goals.
2017-12-07 16:37:22 -08:00
Eli Sherer
9ecf20fc03 chore: Allow development under Windows platform (#992)
This patch improves life of puppeteer contributor on Windows:

- Setting environment variables using cross-env since Windows requires the SET command.
- Calling Jasmine in the script debug-unit using jasmine's JavaScript binary instead of shell.
- Add /test/test-user-data-dir* to .gitignore since temporary user data directories, in case of test 
  fails, remains in the test directory.
2017-10-11 12:14:13 -07:00
JoelEinbinder
cd81944e66 Test node6 on travis (#551)
This patch starts running all puppeteer tests with node6 on travis-ci.
2017-08-25 19:28:49 -07:00
JoelEinbinder
9212863b92 Node 6 support (#484)
This patch:
- introduces a transpiler which substitutes async/await logic with
generators.
- starts using the transpiler to generate a node6-compatible version of puppeteer
- introduces a runtime-check to decide which version of code to use

Fixes #316.
2017-08-24 12:20:05 -07:00
JoelEinbinder
cb471e3666 Ignore package-lock.json (#191)
pacakge-lock.json seems to be buggy now, with different OS giving different results. 
See https://github.com/npm/npm/issues/17749

We have been having trouble keeping it up to date with yarn.lock. It doesn't give us a big win, because it is ignored if you install the package from npm.

This patch removes package-lock.json and starts ignoring it.
2017-08-02 14:18:14 -07:00
JoelEinbinder
bf7698e8f8 Intorduce Page.keyboard (#74)
Introduce page.keyboard to provide low-level access to the keyboard.
2017-07-17 18:49:52 -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
2cda8c18d1 Puppeteer: staging commit. 2017-05-11 00:06:41 -07:00