Commit Graph

376 Commits

Author SHA1 Message Date
Andrey Lushnikov
77a4ea505e
test: split out fixture tests and make them work with FF (#4067)
Drive-By: give Puppeteer-Firefox its own copy of DeviceDescriptors.
2019-02-25 12:40:17 -08:00
Andrey Lushnikov
57e7f12fbc
test: split out tests for security details (#3996)
This adds missing test coverage for security details and
re-generates our self-signed ceritificate to have meaningful
issuer and subject name.
2019-02-13 11:35:49 -08:00
Andrey Lushnikov
1ce578b787
chore(test): remove the server.EMPTY_PAGE2 asset (#3967)
Firefox used to have a bug that prevented adding iframes with the
same URL as main frame. In this case, we used the EMPTY_PAGE2
so that it doesn't clash with top-level EMPTY_PAGE.

The bug seems to be fixed after we rolled onto a fresh Firefox;
there's no more need for this test asset.
2019-02-08 19:24:40 -08:00
Andrey Lushnikov
0bb657cb26
chore(test): remove --firefox-status flag from tests (#3956)
The [IsPuppeteerFirefoxReady?](https://aslushnikov.github.io/ispuppeteerfirefoxready/)
website now has its own script to compute test and api coverage.
2019-02-08 13:29:13 -08:00
Andrey Lushnikov
addd7f4c6a
chore(testrunner): introduce verbose mode (#3946) 2019-02-07 13:17:29 -08:00
Andrey Lushnikov
14fb3e38db
chore(firefox): mark all Puppeteer tests that are failing on FF (#3924)
This patch:
- introduces new testRunner methods `addTestDSL` and `addSuiteDSL`
  to add annotated test / suite.
- introduces new test/suite declaration methods: `it_fails_ffox` and
  `describe_fails_ffox`. These are equal to `it`/`describe` for chromium
  tests and to `xit`/`xdescribe` for firefox.
- marks all unsupported tests with `it_fails_ffox`
- adds a new command-line flag `'--firefox-status'` to `//test/test.js`.
  This flag dumps current amount of tests that are intentionally skipped
  for Firefox.

End goal: get rid of all `it_fails_ffox` and `describe_fails_ffox`
tests.

Drive-By: remove cookie tests  "afterEach" hook that was removing
cookies - it's not needed any more since every test is run in a
designated browser context.

References #3889
2019-02-05 22:32:41 -08:00
Andrey Lushnikov
a210dd7ee2
chore(testrunner): show 5 slowest tests on CI (#3919)
Show top slowest tests on CI.

Drive-by: some facelifting for the test reporter.
2019-02-05 15:28:35 -08:00
Andrey Lushnikov
00bcecbf72
chore: increase test timeout to 20 seconds on Appveyour (#3918)
Looks like Appveyour is indeed slow; try giving it more time
to run tests.

Drive-by: support TIMEOUT env variable for Puppeteer tests.
2019-02-05 13:38:56 -08:00
Andrey Lushnikov
dd8bd6dcb1
test(firefox): support Puppeteer-Firefox specific env variables (#3907)
This patch:
- adds support to `FFOX` env variable for Puppeteer testsuite
- install Firefox preferences when running tests with custom firefox
  executable

References #3889
2019-02-05 13:17:02 -08:00
Andrey Lushnikov
69c434af75
test(firefox): further unify Puppeteer-Firefox and Puppeteer tests (#3894)
This patch:
- changes Puppeteer-Firefox plumbing of defaultBrowserOptions to align
  with the way we do it for Puppeteer.
- plumbs puppeeteer-dependent Errors and DeviceDescriptors down to every
  test.
- unifies a few tests between Puppeteer-Firefox and Puppeteer.

**Note:** in future, we should expose errors as `puppeteer.errors` and
device descriptors as `puppeteer.devices` to make it easy to pass around
Puppeteer/Puppeteer-Firefox instance.

References #3889.
2019-02-02 18:49:12 -07:00
Andrey Lushnikov
84fe6014e9
chore(firefox): run Puppeteer-Firefox against Puppeteer tests (#3888)
Introduce a `npm run funit` script that runs puppeteer tests
against Puppeteer-Firefox.

Next steps:
- bring Puppeteer-Firefox unique tests to Puppeteer
- skip failing tests and run Puppeteer-Firefox on CI
- work through tests to pass them all with Puppeteer-Firefox
2019-02-01 17:04:19 -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
Andrey Lushnikov
1a7995558f
chore(test): prepare tests to be run with Puppeteer-Firefox (#3833)
This patch aligns Puppeteer testing infrastructure with the approach
we use in Puppeteer-Firefox.

This patch:
- makes all tests accept Puppeteer object as a function argument
  rather than require it statically. This way we can pass either
  Puppeteer or Puppeteer-Firefox to drive tests.
- renames the `puppeteer.spec.js` into `launcher.spec.js`. The
  `puppeteer.spec.js` is now the entry point for all cross-browsers
  tests.
2019-01-24 01:04:42 -05:00
Andrey Lushnikov
489be90c75
test: move tracing tests to one-per-browser (#3781)
Tracing is working on a per-browser level, not per-page. In order
to paralellize these tests effectively and properly, each should run
a designated browser.
2019-01-15 16:39:30 -08:00
Andrey Lushnikov
6656519560
test: split out dialog tests (#3586) 2018-11-20 20:18:57 -08:00
Andrey Lushnikov
309cbe625f
test: split out navigation tests (#3585) 2018-11-20 20:09:25 -08:00
Andrey Lushnikov
d61916b53e
test: split out evaluation tests (#3584) 2018-11-20 19:59:59 -08:00
Andrey Lushnikov
e83918987a
test: split input tests into keyboard, mouse and touchscreen (#3583) 2018-11-20 19:43:07 -08:00
Andrey Lushnikov
25f4f26851
test: extract clicking tests (#3582) 2018-11-20 19:34:57 -08:00
Andrey Lushnikov
a181bdde31
test: split out emulation tests (#3581) 2018-11-20 19:17:56 -08:00
Andrey Lushnikov
a5b1978190
test: split out waittask tests (#3580) 2018-11-20 18:57:28 -08:00
Andrey Lushnikov
e5830d1199
test: split queryselector tests into separate file (#3579) 2018-11-20 18:45:37 -08:00
Andrey Lushnikov
aa9fb82f14
test: split screenshot tests into separate file (#3578) 2018-11-20 18:32:42 -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
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
85aca8e1a5
chore(testserver): prepare test server (#3294) 2018-09-24 12:46:39 -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
1ba2b8540d
feat(network): introduce Response.remoteAddress() (#3192)
Closes #2171.
2018-09-04 20:39:59 +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
0c49bf5245
test: use new browser context for every page test (#3010)
This allows us:
- dogfood browser contexts the way we want them to be used
- simplifies the dance around service workers / cookies setting up and tier down.
2018-08-01 15:49:41 -07:00
Andrey Lushnikov
4bbaa9d4f5
test: do not handle sigint for all the browsers launched in tests (#2990)
Puppeteer's default handler issues "process.exit(130)", causing
test runner to shut too early.

As a result, test runner doesn't show run summary.
2018-07-30 18:07:01 -07:00
Andrey Lushnikov
392d3b94bd
Revert "chore(tests): redirect debugError to the output category of tests (#2969)" (#2987)
This reverts commit c5fe1dbdbb.
2018-07-30 16:41:39 -07:00
Joel Einbinder
c5fe1dbdbb chore(tests): redirect debugError to the output category of tests (#2969)
I have seen some flaky test failures where it would be nice to have run the tests with `DEBUG=puppeteer:error`. Instead of always running tests like that, I am redirecting `debugError` to the output category of the test. This is the same thing that we do for Chromium's stderr.

As a drive-by, I added an additional `debugError` where we were usually a try..finally pattern.
2018-07-30 11:16:12 -07:00
Andrey Lushnikov
af0bd15d88
test: split out ignoreHTTPSErrors tests (#2745)
We'll get more of these soon.
2018-06-14 16:48:14 -07:00
Joel Einbinder
2ff0adcad8 feat: worker convenience methods (#2677)
This patch:
- adds `worker.evaluate` and `worker.evaluateHandle` methods as a shortcut to their execution context equivalents.
- makes the error messages a bit nicer when interacting with a closed worker (as opposed to a closed page).
- moves the worker tests into their own spec file.
2018-06-06 20:16:17 -05:00
Andrey Lushnikov
07b91f61a9
test: split out headful tests into headful.spec.js (#2657) 2018-06-01 13:48:34 -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
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
Rafal Jarmolkovič
23d25a6e12 feat(Target): Pass through "background_page" types (#2439) (#2493) 2018-05-16 14:36:34 -07:00
Andrey Lushnikov
3b03ff65c7
feat(BrowserContext): introduce Browser Contexts. (#2523)
This patch introduces Browser Contexts and methods to manage them:
- `browser.createIncognitoBrowserContext()` - to create new incognito
  context
- `browser.browserContext()` - to get all existing contexts
- `browserContext.dispose()` - to dispose incognito context.

Fixes #85.
2018-05-10 13:26:08 -07:00
Andrey Lushnikov
18f2ecdffd
fix(Launcher): launch chrome with --disable-dev-shm-usage by default (#2351)
Fixes #1834.
2018-04-10 20:05:27 -07:00
Andrey Lushnikov
0b64242f85
test: add missing rm function to test.js (#2349)
This was missing while we were splitting the tests.

Fixes #2236.
2018-04-10 18:05:10 -07:00
Andrey Lushnikov
fafd156d7b
fix(Page): support anchor navigation (#2338)
This patch fixes puppeteer navigation primitives to work with
same-document navigation.

Same-document navigation happens when document's URL is changed,
but document instance is not re-created. Some common scenarios
for same-document navigation are:
- History API
- anchor navigation

With this patch:
- pptr starts dispatching `framenavigated` event when frame's URL gets
changed due to same-document navigation
- `page.waitForNavigation` now works with same-document navigation
- `page.goBack()` and `page.goForward()` are handled correctly.

Fixes #257.
2018-04-09 23:38:20 -07:00
Andrey Lushnikov
5d106f79d8
test: flatten tests (#2337)
Today, we have tests split into multiple files, with files pulling
tests from some other files.

This patch starts explicitly gathering all tests from the same
`test.js` file.

Drive-By: move one test from `browser.spec.js` into `puppeteer.spec.js`
since it starts browser itself.
2018-04-09 16:38:00 -07:00
Yaniv Efraim
47481967c5 test: Break 'page.spec.js' to smaller files (#2218)
This patch breaks huge `page.spec.js` into a bunch of smaller files.
2018-03-19 20:00:12 -07:00
Yaniv Efraim
38c6873fbb test: break test.js into smaller files (#2193)
This patch breaks test.js into smaller files:
- `page.spec.js`
- `puppeteer.spec.js`

Fixes #2082
2018-03-16 15:33:31 -07:00
Andrey Lushnikov
ec3025fe84
feat(Network): implement request.redirectChain() api (#2194)
The request.redirectChain() returns all the requests issued to fetch
the resource.

Fixes #1816.
2018-03-15 17:17:38 -07:00
Andrey Lushnikov
c4b1ac99b0
test: another attempt to fix sw test #2201 2018-03-15 16:58:02 -07:00
Andrey Lushnikov
150e5a9bbf
test: eliminate racy pattern in multiple tests (#2202)
This patch eliminates a race pattern we've been using in a bunch
of tests.
2018-03-15 16:53:34 -07:00
JoelEinbinder
309cafb876 feat(Chromium): roll chromium to r543305 (#2196)
This roll contains a [fix](https://chromium-review.googlesource.com/c/chromium/src/+/963302) for boundingBox not forcing a layout, and the patch contains a corresponding test.
2018-03-15 16:37:10 -07:00