Commit Graph

349 Commits

Author SHA1 Message Date
jrandolf
b032b629cb
test: skip headful tests in headless modes (#10578) 2023-07-18 20:18:22 +02:00
Alex Rudenko
e3dd5968ca
fix(locators): reject the race if there are only failures (#10567) 2023-07-18 11:26:06 +02:00
Nikolay Vitkov
de09b058ba
chore: update Prettier and other deps (#10555) 2023-07-17 10:52:54 +02:00
Nikolay Vitkov
0d2c42a1c4
ci: fix Actions not running sometimes (#10503) 2023-07-04 14:17:25 +02:00
Nikolay Vitkov
0caf124182
chore: move unit tests (#10498) 2023-07-03 13:25:43 +00:00
Nikolay Vitkov
d0d738d2fc
chore: readd browser setup hook (#10478) 2023-07-03 14:01:29 +02:00
Alex Rudenko
5a3abb2f5e
ci: fix mocha utils (#10496) 2023-07-03 11:41:24 +02:00
Alex Rudenko
02634d80da
test: update tests for aborted requests (#10476) 2023-06-30 11:56:16 +02:00
jrandolf
84a956f56b
fix: fix escaping algo for P selectors (#10474) 2023-06-29 11:00:57 +00:00
jrandolf
1c80ebe846
chore: update Bidi key values (#10466) 2023-06-29 07:31:49 +00:00
Nikolay Vitkov
1f0dc4f3a3
refactor: move EventEmitter tests (#10463) 2023-06-28 13:36:26 +02:00
Nikolay Vitkov
ceb6fbb365
chore: use a less chatty BiDi+ (#10453) 2023-06-28 09:54:16 +02:00
Alex Rudenko
e452647739
chore: move Deferred test (#10452) 2023-06-26 14:01:36 +02:00
Alex Rudenko
c35084dd2c
ci: separate unit tests (#10436) 2023-06-26 10:57:48 +02:00
Nikolay Vitkov
45a05e038b
chore: add Deferred.race test (#10432) 2023-06-21 22:51:15 +02:00
Nikolay Vitkov
ff8529696d
ci: remove before hooks (#10431) 2023-06-21 19:41:09 +00:00
Nikolay Vitkov
337184e722
chore: BiDi waitForNavigation (#10424) 2023-06-21 12:45:17 +02:00
jrandolf
fbdcc0d646
fix: add parenthesis to JS values in interpolateFunction (#10426) 2023-06-20 16:26:10 +02:00
jrandolf
4f6b0d4e45
chore: implement Webdriver BiDi mouse and touchscreen (#10402)
Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
2023-06-19 11:26:30 +00:00
jrandolf
39847bd231
refactor: use input API for CDP inputs (#10401) 2023-06-19 10:12:43 +02:00
Alex Rudenko
90a9de7257
chore: implement default context and newPage/pages (#10397) 2023-06-16 15:27:31 +02:00
Nikolay Vitkov
d560299aa8
chore: add waitForSelector for BiDi (#10383) 2023-06-16 09:16:04 +02:00
Alex Rudenko
2961449391
test: misc test improvements (#10371) 2023-06-13 13:05:01 +00:00
Alex Rudenko
9473d740e7
chore: tracing over bidi+ (#10370)
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
2023-06-13 09:25:32 +00:00
Alex Rudenko
c2d3488ad8
fix: specify the context id when adding bindings (#10366) 2023-06-13 10:17:48 +02:00
Alex Rudenko
903afc3715
chore: implement acceptInsecureCerts and version for BiDi (#10365) 2023-06-13 10:17:23 +02:00
jrandolf
35aedc0dbb
feat: add reset to mouse (#10340) 2023-06-12 17:59:28 +00:00
Nikolay Vitkov
9aee41a53d
chore: run more BiDi test (#10355) 2023-06-12 14:50:30 +02:00
Nikolay Vitkov
a31231ef54
chore: implement common functions for BiDi (#10345) 2023-06-12 11:32:19 +02:00
Nikolay Vitkov
e3e68a99d2
chore: use launch helper (#10344) 2023-06-12 10:44:18 +02:00
Nikolay Vitkov
3552d97360
chore: update dependencies (#10336) 2023-06-07 11:17:31 +00:00
Alex Rudenko
9c35e9ab1f
feat: implement Locator.race (#10337) 2023-06-07 12:45:02 +02:00
Nikolay Vitkov
dde569b97d
ci: fix flaky test (#10335) 2023-06-07 10:18:01 +02:00
Nikolay Vitkov
0371beebba
chore: $ and $$ BiDi support (#10318) 2023-06-06 12:39:54 +00:00
Alex Rudenko
514ad107d7
docs: add a few examples for ARIA queries (#10320)
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
2023-06-06 09:46:26 +02:00
Alex Rudenko
ade6ad89f4
test: update bidi tests for firefox (#10316) 2023-06-05 16:11:30 +00:00
Alex Rudenko
1f978f5fc5
feat: implement Locators (#10305) 2023-06-02 17:46:10 +00:00
Nikolay Vitkov
4d0dbbc517
feat: add page.removeExposedFunction (#10297) 2023-06-02 14:08:36 +02:00
Nikolay Vitkov
9abd48a062
fix: content() not showing comments outside html tag (#10293) 2023-06-01 21:51:16 +02:00
Nikolay Vitkov
39e9737232
refactor: Deferred to a class (#10282) 2023-05-31 23:36:19 +02:00
Alex Rudenko
54d6192262
chore: add methods to configure locators (#10273) 2023-05-30 13:20:00 +00:00
Alex Rudenko
73b72b31b2
test: catch unhandled in a network test (#10242) 2023-05-30 08:03:06 +00:00
Alex Rudenko
ff22ba8679
refactor: rename DeferredPromise to Deferred (#10255) 2023-05-26 09:42:22 +00:00
Junyan
b5a124ff73
feat: Page.removeScriptToEvaluateOnNewDocument (#10250)
Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
2023-05-26 07:56:45 +00:00
Alex Rudenko
79b5299c5b
chore: recover Buffer.concat on errors (#10252) 2023-05-26 06:45:02 +00:00
Alex Rudenko
c9cca17833
refactor: make deferred promises more robust to use (#10245) 2023-05-26 08:02:17 +02:00
Nikolay Vitkov
557ec24cfc
fix: stacktraces should not throw errors (#10231) 2023-05-24 14:42:08 +02:00
Alex Rudenko
cf28dae775
chore: convert async describe to sync (#10238) 2023-05-24 12:08:36 +00:00
Nikolay Vitkov
49360eac10
chore: fixes expectation for test in Firefox (#10239) 2023-05-24 11:56:24 +02:00
Alex Rudenko
9ca9bbf259
chore: implement fill for locators (#10220) 2023-05-23 13:55:12 +02:00
Junyan
81f73a55f3
feat: Page.setBypassServiceWorker (#10229)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
2023-05-23 13:51:32 +02:00
Nikolay Vitkov
070ee03d31
chore: network module for BiDi (#10159) 2023-05-22 14:52:31 +02:00
Alex Rudenko
87ca58f97a
chore: implement locators for scroll and hover (#10219) 2023-05-22 09:57:51 +00:00
Nikolay Vitkov
2808240c71
chore: implement Frames for BiDi (#10121) 2023-05-15 16:39:47 +02:00
Nikolay Vitkov
c00cf45009
chore: create a test helper for launching browser (#10152) 2023-05-11 13:10:27 +00:00
jrandolf
317fa732f9
feat: implement detailed errors for evaluation (#10114) 2023-05-10 10:23:29 +02:00
Alex Rudenko
9a1aff8a4c
chore: implement locators with a click (#10009)
Co-authored-by: jrandolf <101637635+jrandolf@users.noreply.github.com>
2023-05-05 09:11:16 +00:00
Nikolay Vitkov
4615607b7d
chore: add test console after navigation (#10110) 2023-05-04 09:43:12 +00:00
Alex Rudenko
df4d60c187
feat!: switch to Chrome for Testing instead of Chromium (#10054)
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
2023-05-02 08:53:40 +02:00
Nikolay Vitkov
e4b57c279a
chore: add EsLint rule for no-floating-promises (#10084) 2023-04-26 09:53:02 +00:00
Alex Rudenko
4dd4cb9292
feat: add AbortSignal to waitForFunction (#10078)
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
2023-04-26 10:50:08 +02:00
Nikolay Vitkov
5e79d53bd3
refactor: tests use toHaveLength and waitEvent (#10061) 2023-04-25 15:02:25 +02:00
jrandolf
8124a7d5bf
fix: implement click count (#10069) 2023-04-25 13:28:47 +02:00
Alex Rudenko
704624eb20
fix: move fs.js to the node folder (#10055) 2023-04-21 09:45:04 +02:00
Alex Rudenko
8283823cb8
fix: continue requests without network instrumentation (#10046) 2023-04-20 12:28:56 +00:00
jrandolf
bbf2c0a8ec
chore: use AbortSignal instead of AbortController (#10048) 2023-04-20 08:18:48 +02:00
Alex Rudenko
9109b76276
feat: support AbortController in waitForSelector (#10018) 2023-04-18 16:45:10 +00:00
jrandolf
34db39e447
fix: improve mouse actions (#10021) 2023-04-17 10:56:51 +02:00
Alex Rudenko
26c81b7408
feat: add ElementHandle.isVisible and ElementHandle.isHidden (#10007) 2023-04-12 11:19:46 +02:00
Alex Rudenko
0d556a71d6
feat: add ElementHandle.scrollIntoView (#10005) 2023-04-12 07:17:18 +02:00
Alex Rudenko
656b562c74
fix: make isIntersectingViewport work with SVG elements (#10004) 2023-04-11 14:05:10 +00:00
Alex Rudenko
e7265c9aa9
fix: ignore extraInfo events if the response is served from cache (#9983) 2023-04-06 12:29:10 +02:00
Alex Rudenko
c8f6adf9f3
refactor: use browsers for launchers (#9937) 2023-04-04 13:29:21 +00:00
Nikolay Vitkov
fe934ad092
chore: fix only for skipped tests (#9964) 2023-04-04 09:37:15 +02:00
jrandolf
728547d460
fix: use shadowRoot for tree walker (#9950) 2023-03-31 17:19:59 +02:00
Alex Rudenko
9af680d3e5
chore: increase timeouts for tests creating many pages (#9931) 2023-03-28 15:09:18 +00:00
Nikolay Vitkov
95c99e84b8
chore: add PDF print for BiDi (#9914) 2023-03-27 11:39:40 +02:00
Alex Rudenko
de86cafe3c
chore: reduce default timeout to 10s (#9906) 2023-03-24 09:35:45 +01:00
jrandolf
6c018acf5d
chore: update deep implementation for P selectors (#9908) 2023-03-23 15:46:33 +01:00
Alex Rudenko
976684e4e1
chore: remove operations for now (#9899) 2023-03-22 16:56:12 +01:00
Alex Rudenko
1f76cdda12
chore: replace rimraf with a helper in BrowserFetcher/Connector (#9890) 2023-03-21 13:41:56 +01:00
Alex Rudenko
f1488b6c3a
chore: replace rimraf in tests with a helper with retries (#9888) 2023-03-21 11:39:15 +01:00
Nikolay Vitkov
36c029b38d
fix: waitForNavigation issue with aborted events (#9883) 2023-03-21 10:22:57 +01:00
Michael "Z" Goddard
a5149d52f5
feat: add Page.waitForDevicePrompt (#9299)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
2023-03-21 10:21:10 +01:00
Nikolay Vitkov
cb079378bb
chore: add BiDi support for SetContent (#9878) 2023-03-20 14:00:13 +01:00
Nikolay Vitkov
9ccde6ebf5
chore: added * pattern for test expectations (#9870) 2023-03-20 10:59:50 +01:00
Alex Rudenko
aa7c475461
test: add a few regressed selectors (#9875) 2023-03-17 12:55:39 +01:00
jrandolf
9f9394ca42
chore: use parsel (#9865) 2023-03-16 14:41:38 +01:00
Nikolay Vitkov
16b39de5ca
chore: extract HTTP prep for BiDi network module (#9840) 2023-03-15 17:51:34 +01:00
Nikolay Vitkov
4351e0de9e
chore: fix Actions Node version to LTS (#9859) 2023-03-15 13:59:42 +01:00
Nikolay Vitkov
17c650b6d1
chore: prefer use of fs/promise to utils/promisify (#9848)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
2023-03-14 18:30:41 +01:00
jrandolf
dd16ecae03
chore: use custom tokenizer (#9837) 2023-03-14 10:13:23 +01:00
jrandolf
9044609be3
fix: sort elements based on selector matching algorithm (#9836) 2023-03-13 16:11:16 +01:00
Nikolay Vitkov
175362c048
chore: add BiDi for goto navigation (#9795) 2023-03-10 15:59:02 +00:00
Alex Rudenko
5bb41e1c11
chore: restore rimraf in test code (#9823) 2023-03-10 10:37:14 +01:00
jrandolf
364b23f8b5
fix: update dependencies (#9781) 2023-03-06 13:43:37 +01:00
jrandolf
2123f809e8
chore: remove rimraf (#9775) 2023-03-06 11:33:38 +01:00
jrandolf
f84873c121
chore: support commas in P selectors (#9769) 2023-03-06 10:56:52 +01:00
Nikolay Vitkov
3db7d55d26
chore: remove BigInt exists checks (#9744) 2023-02-24 19:26:29 +01:00
Nikolay Vitkov
9910aae2f7
chore: Fix BiDi session.status Param type (#9723) 2023-02-21 19:16:07 +00:00
jrandolf
84845e4901
chore: implement operations (#9717) 2023-02-21 11:12:27 +01:00
Nikolay Vitkov
9b54365df5
chore: Add Page.Console event to BiDi (#9700) 2023-02-20 13:00:29 +01:00
Nikolay Vitkov
eefe9583d0
chore: Add EsLint rule import/order (#9685) 2023-02-15 15:09:31 -08:00
jrandolf
2b3cf3ace9
chore: implement P queries (#9639) 2023-02-15 10:42:32 -08:00
jrandolf
e8f25e403f
refactor: custom query handlers and global bindings (#9678) 2023-02-15 07:33:18 -08:00
Nikolay Vitkov
0c85c0611c
chore: Implement JSHandle for BiDi (#9660) 2023-02-15 10:29:18 +00:00
jrandolf
56f99f7b10
refactor: migrate to iterator-based query handlers (#9676) 2023-02-14 13:31:30 -08:00
Henrik Skupin
404839d175
Refactor test expectation status for recent Firefox Nightly builds (#9642) 2023-02-10 12:45:40 +01:00
Nikolay Vitkov
b8ea891ab8
chore: Extract JSHandle to API (#9632) 2023-02-09 18:04:06 +01:00
Henrik Skupin
e14cf7ebac
fix: update test expectations for next Firefox Nightly changes (#9635) 2023-02-09 12:50:42 +01:00
Rafael Martins
ddb0cc174d
fix: page.goto error throwing on 40x/50x responses with an empty body (#9523) (#9577)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
2023-02-06 09:40:51 +00:00
charlieinitialdigital
c8bb11adfc
feat: add touchstart, touchmove and touchend methods (#9622) 2023-02-03 10:59:21 +00:00
Nikolay Vitkov
abcc1756dd
chore: Add BiDi Page.evaluate (#9609) 2023-02-02 15:14:28 +01:00
Rafael-Martins
f12f27e1eb
docs: clarify the waitForXPath return type (#9541) (#9583) 2023-02-01 15:23:32 +00:00
jrandolf
050a7b0624
fix: atomically get Puppeteer utilities (#9597) 2023-01-27 11:58:40 -08:00
Alex Rudenko
6edd996768
fix(revert): use LazyArg for puppeteer utilities (#9590)
Reverts puppeteer/puppeteer#9575
2023-01-26 09:50:06 +01:00
jrandolf
496658f029
fix: use LazyArg for puppeteer utilities (#9575)
This PR fixes the following edge case:

 - `const oldPromise = world.puppeteerUtil`. 
- setContext occurs but context is immediately destroyed, i.e.
`world.#puppeteerUtil === oldPromise` is not resolved.
- clearContext occurs due to destruction, i.e. `world.#puppeteerUtil` is
replaced (`world.#puppeteerUtil !== oldPromise`).
 - `oldPromise` never resolves.
2023-01-26 08:56:33 +01:00
Ophir Back
e3d69ec554
feat(page): Adding support for referrerPolicy in page.goto (#9561)
Issue: #9394

**What kind of change does this PR introduce?**

Feature - Added support of the `referrerPolicy` parameter (from CDP's
`Page.navigate`) to Puppeteer's `page.goto`.

**Did you add tests for your changes?**

No, currently it has no meaning that isn't browser implementation based,
which might get broken in the future. If there are suggestions to tests,
please let me know so I'll add them.

**If relevant, did you update the documentation?**
Yes, the documentation of the `goto` method has been updated.

**Summary**
I wanted to contribute to this project, which I used for testing on our
environment and saw issue #9394, so I decided to resolve it :)

**Does this PR introduce a breaking change?**
No. I added the `referrerPolicy` as an optional parameter, which will
use the HTTP header `Referrer-Policy` if not provided (much like the
`referer` parameter) so it will not interfere.

Co-authored-by: Ophir Back <ophir.back@broadcom.com>
2023-01-23 11:11:20 +00:00
Kyrylo
3e80667048
chore: use named import for devtools-protocol module (#9511)
<!-- Thanks for submitting a pull request! Please provide enough
information so that others can review your pull request. -->

**What kind of change does this PR introduce?**
types fix

**Did you add tests for your changes?**
No

**If relevant, did you update the documentation?**
Not relevant

**Summary**
I am updating `import`s of `devtools-protocol` to always use named
import instead of the default.
For some reason, typescript doesn't understand when it is imported as
default.

```
node_modules/puppeteer-core/lib/esm/puppeteer/common/TargetManager.d.ts:23:59 - error TS2694: Namespace '"/Users/kyrylo/pacakge/node_modules/puppeteer-core/node_modules/devtools-protocol/types/protocol"' has no exported member 'Target'.

23 export declare type TargetFactory = (targetInfo: Protocol.Target.TargetInfo, session?: CDPSession) => Target;
                                                             ~~~~~~


Found 1 error in node_modules/puppeteer-core/lib/esm/puppeteer/common/TargetManager.d.ts:23
```

**Does this PR introduce a breaking change?**
No
<!-- If this PR introduces a breaking change, please describe the impact
and a migration path for existing applications. -->

**Other information**
I am updating `import`s of `devtools-protocol` to always use named
import instead of the default.
2023-01-17 11:34:57 +00:00
Kian-Meng Ang
4437bceb6e docs: fix typos (#9476)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
2023-01-16 20:25:09 +01:00
Alex Rudenko
06e816bbfa
feat(chromium): roll to Chromium 110.0.5479.0 (r1083080) (#9500)
Closes #9470
2023-01-12 11:31:20 +01:00
jrandolf
c7a063a152
feat: add element validation (#9352)
This PR adds a method to ElementHandle that validates the tag type of
that handle and returns it.

Fixed: #8579, #9280
2022-12-19 13:25:56 +01:00
Darío Kondratiuk
e3e9cc622a
fix(puppeteer-core): target interceptor is not async (#9430)
I found that the only call to `addTargetInterceptor` passes
`onAttachedToTarget` and is not async.
I also found a typo 🤓
2022-12-17 17:47:21 +00:00
Alex Rudenko
02fe50194e
fix: improve a11y snapshot handling if the tree is not correct (#9405)
Bug #9404
2022-12-13 08:31:26 +00:00
Alex Rudenko
810e0cd74e
fix: remove oopif expectations and fix oopif flakiness (#9375)
With M109 the flakiness should be reduced. Any present flakiness should
be investigated.

Drive-by: a new debugging helper to debug on CI.
2022-12-09 11:36:39 +00:00
Nikolay Vitkov
1875da6191
feat(chromium): roll to Chromium 109.0.5412.0 (r1069273) (#9364)
Closes #9233
2022-12-07 14:54:00 +01:00
Henrik Skupin
be7626bad8
chore: fix race in test Frame.waitForFunction should work when context is destroyed (#9368)
Fixes the race condition which causes intermittent failures in Firefox
because we haven't implemented bootstrap scripts to run on document
creation.
2022-12-06 16:59:44 +00:00
Junyan
b7ebc5d9bb
feat(puppeteer-core): keydown supports commands (#9357)
Issue: #1313

<!-- Thanks for submitting a pull request! Please provide enough
information so that others can review your pull request. -->

**What kind of change does this PR introduce?**

Feature.

**Did you add tests for your changes?**

Yes.

**If relevant, did you update the documentation?**

Yes.

**Summary**

Supports keyboard shotcuts on MacOS. See Chrome Devtools Protocol
document:
https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchKeyEvent.
2022-12-03 11:23:47 +01:00
Alex Rudenko
f3c87dcdb7
chore: upgrade mitt (#9340) 2022-11-29 19:50:58 +00:00
Alex Rudenko
30c6b13eec
chore: re-export all exports (#9241)
Adds index files to subfolders and removes generation of types.ts in
puppeteer-core.
2022-11-10 17:11:18 +01:00
Alex Rudenko
e78a4e89c2
feat(chromium): roll to Chromium 108.0.5351.0 (r1056772) (#9153) 2022-10-25 12:55:19 +02:00
jrandolf
ec201744f0
feat: use configuration files (#9140)
This PR adds configurations files to `puppeteer`'s methods for
configuration. Under the hood, `puppeteer` relies on
https://www.npmjs.com/package/cosmiconfig which resolves several formats
of configuration:

- a `puppeteer` property in package.json
- a `.puppeteerrc` file in JSON or YAML format
- a `.puppeteerrc.json`, `.puppeteerrc.yaml`, `.puppeteerrc.yml`,
`.puppeteerrc.js`, or `.puppeteerrc.cjs` file
- a `puppeteer.config.js` or `puppeteer.config.cjs` CommonJS module
exporting an object

Documentation will be added later.

Fixed: #9128
2022-10-21 15:09:21 +02:00
Alex Rudenko
122778a1f8
feat: expose browser context id (#9134)
Closes #9132
2022-10-19 08:30:57 +00:00
Alex Rudenko
a19b270018
chore: extract BrowserContext to its own file (#9133) 2022-10-19 07:06:31 +00:00
jrandolf
3df375baed
feat!: use ~/.cache/puppeteer for browser downloads (#9095) 2022-10-11 11:20:45 +00:00
jrandolf
1847704789
fix!: refactor custom query handler API (#9078)
This PR removes the deprecated query selector API from the `puppeteer`
instance. Direct imports of the query selector API have also been
deprecated and users are now expected to use the static methods defined
on `Puppeteer`.
2022-10-10 16:01:09 +02:00
jrandolf
acbc59999b
fix: remove viewport conditions in waitForSelector (#9087)
This PR removes the viewport conditions in `waitForSelector`.

See discussion:
https://github.com/puppeteer/puppeteer/pull/8954#issuecomment-1272338883
2022-10-10 16:00:47 +02:00
jrandolf
87c08fd86a
fix!: remove puppeteer.devices in favor of KnownDevices (#9075)
This PR removes the deprecated `puppeteer.devices` in favor of a new
exported object `KnownDevices`. `devices` can also be exported, but has
been deprecated.
2022-10-10 15:30:12 +02:00
smithc
a032583b6c feat: add ability to collect JS code coverage at the function level (#9027) 2022-10-06 23:53:05 +02:00
jrandolf
41d0122b94 fix!: deprecate indirect network condition imports (#9074) 2022-10-06 23:52:58 +02:00
jrandolf
9f4f43a28b fix!: deprecate indirect error imports (#9072) 2022-10-06 23:52:51 +02:00
Egor Andreyuk
8f6b2c9b7c
fix: waitForRequest works with async predicate (#9058) 2022-10-05 20:46:34 +02:00
jrandolf
f42336cf83
feat: separate puppeteer and puppeteer-core (#9023)
This PR moves the puppeteer source code into separate mono-repo packages:

- `puppeteer` and `puppeteer-core` are now separated into their own
packages.
- `puppeteer-core` has a new exports called `puppeteer-core/internal`
for internal usage.

Tests and various tools have been updated to accommodate the migration.
2022-10-05 14:17:03 +02:00
jrandolf
c0c7878adc
chore: initiate monorepo migration (#9022)
This PR starts the monorepo migrations as per
https://github.com/puppeteer/puppeteer/issues/8922. To scope migrations,
we are only moving the `testserver` into a separate package. Further
migrations will come later.
2022-09-29 10:08:55 +02:00
Alex Rudenko
31e7b608d5
chore: implement basic evaluate in BiDi (#8989)
Only the basic return values are supported.
The follow-up PRs will re-use the shared code
from the ExecutionContext and introduce Frame
in BiDi.
2022-09-21 08:10:50 +02:00
jrandolf
7efcb9ca3d
chore: remove unused code (#8977) 2022-09-19 12:48:14 +02:00
jrandolf
2a2af7134f
chore: incrementally erase cache on text change (#8961) 2022-09-15 18:48:55 +02:00
Alex Rudenko
fa084bcdcd
chore: extract CDPSession base class for easy mocking (#8950) 2022-09-15 13:50:12 +00:00
jrandolf
633e7cfdf9
feat: add text query handler (#8956) 2022-09-15 11:12:13 +00:00
jrandolf
ac9929d80f
fix!: fix bounding box visibility conditions (#8954) 2022-09-15 09:25:20 +02:00
jrandolf
7c4f41fadc
chore: use injections for wait tasks (#8943)
This PR refactors wait tasks to use injected scripts.
2022-09-15 08:22:20 +02:00
Alex Rudenko
db28203e64 chore: support WebDriver BiDi browser instances (#8932)
This PR adds a basic support for WebDriver BiDi that currently includes only the ability to establish a connection and shutdown the browser. Therefore, the implementation is marked as internal and won't show up in the changelog as it's barely useful at the moment.

The API classes are kept as classes instead of interfaces so that clients relying on instanceof checks still work.
2022-09-15 02:15:15 +02:00
jrandolf
6fd05d963e
chore: use handle instead of globals for injection (#8946) 2022-09-13 14:06:40 +02:00
Alex Rudenko
504c7a1ae6
chore: implement custom mocha interface for the runner (#8929)
Instead of checking skipped tests in mocha-utils this PR
implements a custom mocha interface for better flexibility
when skipping tests. That should allow skipping tests without
running before and after hooks.
2022-09-09 11:12:18 +02:00
Alex Rudenko
d8830cbc55
chore: implement a test runner on top of mocha (#8866)
* chore: implement a test runner on top of mocha

This PR implements a test runner on top of mocha
that performs multiple mocha runs as defined in
TestSuites.json and compares the outcome of the runs
against TestExpectations.json. This allows us to
remove most of helpers from mocha-utils and be more
flexible when defining the test configurations.
2022-09-08 10:32:39 +00:00
Alex Rudenko
8b3caae8d1
chore: enable cookie restoration test (#8909)
Closes #4111
2022-09-07 09:42:06 +00:00
smithc
0c577b9bf8
fix: add missing code coverage ranges that span only a single character (#8911) 2022-09-07 07:10:07 +00:00
Alex Rudenko
260e428227
fix: support scale for screenshot clips (#8908)
Closes #5329
2022-09-07 05:27:40 +00:00
Alex Rudenko
a870c258bf
chore: update expectations for Firefox when evaluate fails (#8890) 2022-09-02 09:41:34 +00:00
jrandolf
6b4a99fcfa
chore: migrate addStyleTag (#8879)
* chore: remove unnecessary type signature

* chore: fix tests

* chore: migrate `addStyleTag`

* chore: fix tests

* chore: fix tests
2022-09-01 17:52:08 +02:00
jrandolf
8f11237a67
chore: migrate addScriptTag (#8878) 2022-09-01 17:09:57 +02:00
Alex Rudenko
61624d2695
chore: fix a flaky test in request interception (#8870) 2022-08-31 16:10:49 +02:00
Alex Rudenko
6e9a47a6fa
feat(chromium): roll to Chromium 106.0.5249.0 (r1036745) (#8869) 2022-08-31 15:27:59 +02:00
jrandolf
292216652b
chore: add injection framework (#8862)
* chore: add injection framework
2022-08-31 10:50:22 +02:00
jrandolf
b49e742e30
chore: make execution context frame-independent (#8845) 2022-08-25 17:38:02 +02:00
Alex Rudenko
2a0eefb99f
fix: handle service workers in extensions (#8807)
Closes #8800
2022-08-17 19:34:34 +02:00
jrandolf
51b2f0576d
chore: move Frame to Frame.ts (#8806) 2022-08-17 17:45:45 +02:00
jrandolf
bdcb748b98
chore: infrastructure for injecting scripts into DOMWorlds (#8801) 2022-08-17 14:39:41 +02:00
Alex Rudenko
3fad05d333
fix: custom sessions should not emit targetcreated events (#8788)
Closes #8787
2022-08-16 10:56:13 +00:00
jrandolf
ddbe88b887
chore: add custom rule for formatting comments (#8777) 2022-08-12 14:15:26 +02:00
jrandolf
a238f5758d
chore: refactor JSHandle and ExecutionContext (#8773) 2022-08-11 11:45:35 +02:00
Alex Rudenko
ee2540baef
fix: use targetFilter in puppeteer.launch (#8774)
Drive-by: adds Symbol.toStringTag to Target to simplify
debugging.

Closes #8772
2022-08-11 09:15:00 +00:00
Alex Rudenko
2580347b50
fix: resolve navigation flakiness (#8768)
Two main sources of flakiness addressed: 

1) we should dispose the lifecycle watcher after we waited for the navigation response (bad API? we need to refactor but I think it'd be valuable to stabilize tests first without too many changes).
2) we should wait for the navigation request's response if there is a navigation request in the watcher.

Closes #8644
2022-08-10 15:59:58 +00:00
Alex Rudenko
c23cdb73a7
fix: make sure there is a check for targets when timeout=0 (#8765)
Previously, if timeout is falsy, the targets would only
be checked if a browser-level event fires which lead to
a race: if the events arrived before waiting for a target,
the promise would never resolve.

Fixes #8763
2022-08-10 15:49:59 +02:00
Alex Rudenko
af78cc768f
chore: fix proxy-related tests (#8753) 2022-08-08 14:31:12 +00:00
Alex Rudenko
8cb5043868
fix: resolve target manager init if no existing targets detected (#8748)
Closes #8747
2022-08-06 15:35:42 +02:00
jrandolf
5cf9b4de8d
feat: use an xpath query handler (#8730) 2022-08-04 15:45:21 +02:00
Alex Rudenko
2abd772c9c feat: detect Firefox in connect() automatically (#8718)
This PR implements automatic detection of the Firefox product when the `.connect()` method is used. This partially undoes the breaking change in https://github.com/puppeteer/puppeteer/pull/8520 but it's also a breaking change on its own since we don't accept an explicit product name anymore (it does not look like it was used anyway).
2022-08-02 13:18:51 +00:00
Alex Rudenko
6f81b23728 fix: address flakiness in frame handling (#8688)
When we attach to a frame, we send a call to get
the page frame tree from CDP. Based on the tree data
we look up the parent frame if parentId is provided.
The problem is that the call to get the page frame
tree could take arbitrary time and the calls for the
parent and child frames might happen at the same time.
So the situation where the frame tree for the child frame
is resolved before the parent frame is known is fairly
common.

This PR addresses the issue by awaiting for the parent
frame id before attempting to register a child frame.
2022-08-02 13:18:47 +00:00
Alex Rudenko
2cbfdeb0ca feat: use CDP's auto-attach mechanism (#8520)
* feat: use CDP's auto-attach mechanism

In this PR, we refactor Puppeteer to make use of the CDP's auto-attach mechanism. This allows the backend to pause
new targets and give Puppeteer a chance to configure them properly. This fixes the flakiness related to dealing with
OOPIFs and should fix some other issues related to the network interception and navigations. If those are not fixed completely by this PR, the PR serves a solid base for fixing them.

Closes https://github.com/puppeteer/puppeteer/issues/8507, https://github.com/puppeteer/puppeteer/issues/7990
Unlocks https://github.com/puppeteer/puppeteer/issues/3667

BREAKING CHANGE: With Chromium, Puppeteer will now attach to page/iframe targets immediately to allow reliable configuration of targets.
2022-08-02 13:18:07 +00:00
Alex Rudenko
2abb9f0c14
fix: taking a screenshot with null viewport should be possible (#8680)
Closes #8673
2022-07-21 10:34:18 +02:00
Alex Rudenko
af08c5c903
feat: expose the page getter on Frame (#8657)
* feat: expose the page getter on Frame

Closes #8654

* test: add a test
2022-07-11 21:06:35 +02:00
Asen Bozhilov
b47f066c2c
fix(page): fix page.#scrollIntoViewIfNeeded method (#8631)
This patch fixes page.#scrollIntoViewIfNeeded, so that it works with devtools protocol.
Now it blocks the main thread and waits until the scrolling action finishes in Chrome.
Fallbacks to the old implementation if `DOM.scrollIntoViewIfNeeded` is not supported for Firefox.

Issues: #8627, #1805
2022-07-08 06:53:45 +00:00
Alex Rudenko
d0c4291995
fix: expose a RemoteObject getter (#8642)
Closes #8639
2022-07-07 13:04:28 +00:00
jrandolf
5ff205dc8b
fix: extends ElementHandle to Nodes (#8552)
* fix: extends `ElementHandle` to `Node`s (#8552)
2022-07-06 09:05:37 +02:00
jrandolf
28e236f1a6
chore: use --parallel (#8612) 2022-07-05 14:42:55 +02:00
Levi Pesin
79e11985ba
feat: add fromSurface option to page.screenshot (#8496) 2022-06-27 12:37:37 +00:00
Alex Rudenko
329195011f
chore: fix chrome-headless ci (#8560) 2022-06-27 12:35:09 +02:00
jrandolf
7001322cd1
feat: export public types only (#8584) 2022-06-27 09:24:23 +02:00
Pablo Matías Gomez
9787a1d8df
fix: clean up tmp profile dirs when browser is closed (#8580)
* fix: clean up tmp profile dirs when browser is closed
2022-06-27 07:40:30 +02:00
Alex Rudenko
fb7d31e369
feat(chromium): roll to Chromium 104.0.5109.0 (r1011831) (#8569)
* feat(chromium): roll to Chromium 104.0.5109.0 (r1011831)

* test: update a11y test expectations
2022-06-24 14:13:31 +00:00
Alex Rudenko
383e855847
fix: CSS coverage should work with empty stylesheets (#8570)
Closes #8535
2022-06-24 14:17:16 +02:00
jrandolf
8100cbb295
fix: infer unioned handles (#8562) 2022-06-24 06:40:08 +00:00
jrandolf
ebcb8a2760
chore: split JSHandle.ts (#8551) 2022-06-23 11:31:43 +02:00
jrandolf
26c3acbb07
feat!: type inference for evaluation types (#8547)
This PR greatly improves the types within Puppeteer:

- **Almost everything** is auto-deduced.
  - Parameters don't need to be specified in the function. They are deduced from the spread.
  - Return types don't need to be specified. They are deduced from the function. (More on this below)
  - Selections based on tag names correctly deduce element type, similar to TypeScript's mechanism for `getElementByTagName`.
- [**BREAKING CHANGE**] We've removed the ability to declare return types in type arguments for the following reasons:
  1. Setting them will indubitably break auto-deduction.
  2. You can just use `as ...` in TypeScript to coerce the correct type (given it makes sense).
- [**BREAKING CHANGE**] `waitFor` is officially gone.

To migrate to these changes, there are only four things you may need to change:
- If you set a return type using the `ReturnType` type parameter, remove it and use `as ...` and `HandleFor` (if necessary).
 `evaluate<ReturnType>(a: number, b: number) => {...}, a, b)`
 `(await evaluate(a, b) => {...}, a, b)) as ReturnType`
 `evaluateHandle<ReturnType>(a: number, b: number) => {...}, a, b)`
 `(await evaluateHandle(a, b) => {...}, a, b)) as HandleFor<ReturnType>`
- If you set any type parameters in the *parameters* of an evaluation function, remove them.  
 `evaluate(a: number, b: number) => {...}, a, b)`
 `evaluate(a, b) => {...}, a, b)`
- If you set any type parameters in the method's declaration, remove them.
 `evaluate<(a: number, b: number) => void>((a, b) => {...}, a, b)`
 `evaluate(a, b) => {...}, a, b)`
2022-06-23 11:29:46 +02:00
jrandolf
347101883f
chore: split Launcher.ts (#8544) 2022-06-23 00:13:39 +02:00
jrandolf
84712cbc28
chore: use Google's TS style guide's format config (#8542) 2022-06-22 15:25:44 +02:00
jrandolf
570087ea94
chore: use strict typing in tests (#8524)
* The testing tsconfig.json inherits from the base TS config.
  * A lot of type assertions have been inserted...a lot.
* All testing utilities have migrated to TS.
* text-diff is being replaced with diff for TS compatibility.
* ProtocolError has been added to PuppeteerErrors and PuppeteerErrors is no longer a record (it's been frozen).
* Fixes a small bug where null was an allowable media type in emulation (should be undefined).
2022-06-15 12:09:22 +02:00
jrandolf
80373f7a12
chore: use composite builds for tests (#8522) 2022-06-15 12:05:25 +02:00