Commit Graph

15 Commits

Author SHA1 Message Date
Yury Semikhatsky
e0c8d46af1 fix: abort page.waitForRequest/Response when page closes (#4865)
We'd like to pass an abortion signal inside Helper.waitForEvent in order to interrupt it when browser/page closes. Several approaches have been considered:

1. Pass CDPSession instance as a another parameter to the helper method and listen to Disconnected event on it. It would introduce undesired dependency on the session object.
2. Listen to the CDPSession closure at the call sites (e.g. waitForRequest) and pass an abortion promise which would be fulfilled when such event is fired. The listeners would have to be removed from the session on successful completion of waitForEvent so we'd have to pass some kind of DisposablePromise which would be disposed during cleanup. Such parameter looked somewhat hairy.
3. Create DisconnectPromise on CDPSession. One potential risk with that is all chained promises would hang around until the event is fired which might inadvertently cause memory leaks. On the other hand, adding such promise to Promise.race will remove dependency as soon as the race is finished. So this is the approach we're taking with one tweak: the promise is created locally inside Page. 

Ideally the disconnectPromise would throw when the session is closed but it may lead to uncaught promise errors if all chained promises are resolved, to avoid that the promise is resolved with an Error and Helper.waitForEvent throws it later.

Fix #4733
2019-08-21 10:26:48 -07:00
Yury Semikhatsky
a39d553511 fix(tests): Get TLS version from Node instead of hardcoding it (#4700) 2019-07-14 18:33:31 -07:00
Darío Kondratiuk
bad98baf70 fix(test): browser.disconnect should not be awaited (#4446)
browser.disconnect does not return a promise
2019-05-21 17:26:04 +03:00
Andrey Lushnikov
e3abb0aa32
feat(puppeteer): introduce puppeteer.errors and puppeteer.devices (#4312)
These getters are introduced as a more convenient substitute for
a `require('puppeteer/Errors')` and
`require('puppeteer/DeviceDescriptors')`.

This way we can make cross-browser story nicer - a single require
of `puppeteer` or `puppeteer-firefox` fully defines Puppeteer
environment.
2019-04-19 15:33:06 -07:00
Andrey Lushnikov
20988775bf
fix: gracefully handle multiple contexts for secondary DOM World (#4276)
In case of multiple sessions to the same target, there's a race between
sessions to create a secondary isolated world. As a result, we might
end up having 2 execution contexts created for the needs of the
secondary isolated world.

This patch starts handling this race gracefully: instead of crashing,
we can use either of the execution contexts and ignore the rest.

Notably, the same race condition might happen if page reloads itself
in-between the calls to `page.addEvaluateOnNewDocument` and
`page.createIsolatedWorld`.

Fixes #4197.
2019-04-11 16:26:18 -04:00
Joel Einbinder
f32d77e074 test: check if the executable path is an exact match (#4117)
References #4102
2019-03-04 23:46:14 -08:00
Joel Einbinder
ba5f94d2b0 test: disable flaky cookies test (#4112)
References #4111
2019-03-04 18:18:54 -08:00
Andrey Lushnikov
3541b894f5
test: split out all chromium-specific tests into chromiumonly.spec.js (#4068) 2019-02-25 12:51:06 -08:00
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
03c542a6c1
feat(firefox): implement missing launcher options (#4036)
This patch implements `puppeteer.defaultArgs()` and also missing
options, such as `ignoreDefaultArgs`.
2019-02-19 22:08:09 -08:00
Andrey Lushnikov
9782f9c827
fix(firefox): add test to make sure remote browser can be closed (#4023) 2019-02-15 18:26:14 -08:00
Andrey Lushnikov
c35821a1a1
feat(firefox): switch over to WebSocket and support multiclient (#4022)
- switch transport from TCP to WS (yay!)
- implemenet `puppeter.connect()`, `browser.disconnect()`, `'disconnected'`
event and `browser.wsEndpoint()`
2019-02-15 17:57:48 -08:00
Andrey Lushnikov
6887ad881a
chore: further unify Puppeteer-Firefox tests with Puppeteer (#3931)
This patch:
* unifies assets between tests
* enables a few puppeteer tests on Puppeteer-Firefox

Drive-by: beautify failing output of `expect.toEqual` matcher.

References #3889
2019-02-06 13:49:14 -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
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