Commit Graph

946 Commits

Author SHA1 Message Date
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
ce0dd25349
chore: use braces in function bodies (#8525) 2022-06-15 12:42:21 +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
jrandolf
e6442dd767
chore: use curly (#8519) 2022-06-14 13:55:35 +02:00
jrandolf
0678343b53
chore: move helper.js to util.js (#8510) 2022-06-14 13:16:21 +02:00
jrandolf
6c960115a3
chore: use private fields (#8506) 2022-06-13 11:16:25 +02:00
jrandolf
733cbecf48
chore: use c8 coverage (#8495) 2022-06-10 18:49:14 +02:00
jrandolf
4d359906a4
fix: use error-like (#8504) 2022-06-10 15:27:42 +02:00
Alex Rudenko
58ff348b76
chore: skip an oopif test for headful and chrome headless (#8501) 2022-06-10 12:39:18 +02:00
jrandolf
75c3f94a54
chore: namespace commands (#8494) 2022-06-10 11:55:53 +02:00
jrandolf
465a7c405f
feat: export puppeteer methods (#8493) 2022-06-09 19:00:50 +02:00
jrandolf
b30f3f44cd
fix: parse empty options in <select> (#8489) 2022-06-09 13:27:34 +02:00
jrandolf
e8378666c6
fix: don't throw on bad access (#8472) 2022-06-07 16:17:21 +02:00
Alex Rudenko
5c9050aea0
fix: use isPageTargetCallback in Browser::pages() (#8460) 2022-06-02 13:27:31 +02:00
jrandolf
30438e6532
chore: use ts-doc and factor out importFSModule (#8449) 2022-06-01 11:11:09 +02:00
jrandolf
b4e751f29c
feat: use strict typescript (#8401) 2022-05-31 16:34:16 +02:00
Junyan
92110151d9
fix: multiple same request event listener (#8404) 2022-05-30 20:34:08 +00:00
Julian Descottes
f866274360
chore: enable anchor navigation tests for Firefox (#8394) 2022-05-25 06:46:17 +00:00
Alex Rudenko
f657233ca4
test: skip dumpio test in non-headless modes (#8388) 2022-05-24 11:50:49 +00:00
Alex Rudenko
ea47ff0766
chore: fix failing test for the chrome headless (#8364) 2022-05-19 07:41:29 +00:00
jrandolf
74380303ac
fix: only check loading iframe in lifecycling (#8348) 2022-05-17 12:15:44 +00:00
Alex Rudenko
24dfbd5f7f
chore: remove console.log from test (#8351) 2022-05-16 10:04:57 +02:00
Alex Rudenko
3b66a2c47e
feat: allow handling other targets as pages internally (#8336)
Co-authored-by: jrandolf <101637635+jrandolf@users.noreply.github.com>
2022-05-13 08:04:46 +02:00
Alex Rudenko
0ae8936f5e
chore: disable failing permission test (#8337) 2022-05-12 20:09:23 +02:00
Pirikara
a61144d437
fix: If currentNode and root are the same, do not include them in the result (#8332)
* fix: If currentNode and root are the same, do not include them in the result

* fix: Tests that only child element is included in the result

Co-authored-by: jrandolf <101637635+jrandolf@users.noreply.github.com>
2022-05-11 12:17:02 +00:00
Alex Rudenko
7eaadafe19
feat: add waitForXPath to ElementHandle (#8329) 2022-05-10 12:45:20 +02:00
Alex Rudenko
553959884f
fix: make sure inner OOPIFs can be attached to (#8304) 2022-05-04 07:46:38 +02:00
Alex Rudenko
e841d7f9f3
fix: tests failing in headful (#8273)
* fix: test failing in headful

* fix: install Firefox for headful tests

* fix: skip favicon.ico requests in test

* fix: auth test in headful

* fix: disable NetworkTimeServiceQuerying

* fix: filter more favicon requests

* fix: network test with favicon

* fix: improve fixes
2022-05-02 11:37:21 +02:00
Darío Kondratiuk
f39eb70f2f
test: run Frame.evaluate tests on Firefox (#8296) 2022-05-02 08:21:19 +02:00
Darío Kondratiuk
25d363bf9c
test: move async predicate to waitForResponse describe (#8285) 2022-04-28 14:51:57 +00:00
jrandolf
7a51bff47f
feat: add back and forward mouse buttons (#8284) 2022-04-27 21:00:07 +00:00
Alex Rudenko
912dfbaf48
test: disable a failing Firefox test (#8286) 2022-04-27 17:34:53 +02:00
Alex Rudenko
1308d9aa6a
feat: support chrome headless mode (#8260)
* feat: support chrome headless mode

Co-authored-by: Ergün Erdoğmuş <erdogmusergun@gmail.com>
2022-04-25 13:11:23 +02:00
Henrik Skupin
c6cf1a9f27 fix: use different test names for browser specific tests in launcher.spec.ts (#8250) 2022-04-20 12:09:40 +02:00
Matheus Marabesi
e93faadc21
fix(network.spec.ts): typo in the word should (#8223) 2022-04-19 13:24:53 +00:00
Henrik Skupin
b6504d7186
fix: also kill Firefox when temporary profile is used (#8233)
* fix: also kill Firefox when temporary profile is used

* fix: use separate tests for Puppeteer.launch should filter out ignored default arguments
2022-04-19 12:09:23 +00:00
Joel Baranick
91a8e73b11
fix: forget queuedEventGroup when emitting response in responseReceivedExtraInfo (#8234) (#8239) 2022-04-19 09:28:44 +00:00
Julian Descottes
2b45027d25
fix: enable page.spec event handler test for firefox (#8214) 2022-04-08 13:01:03 +00:00
Julian Descottes
04e5c88997
fix: ignore favicon requests in page.spec event handler tests (#8208) 2022-04-07 16:06:12 +00:00
Alex Rudenko
0955225b51
fix: consider existing frames when waiting for a frame (#8200) 2022-04-07 15:05:36 +02:00
Junyan
c1dcd857e3
feat: respond multiple headers with same key (#8183) 2022-04-05 09:06:35 +00:00
Junyan
37ede68770
fix: get extra headers from Fetch.requestPaused event (#8162) 2022-03-28 07:54:24 +00:00
Alex Rudenko
34775e5831
fix: waitForNavigation in OOPIFs (#8117) 2022-03-09 12:24:17 +01:00
James Diefenderfer
3feca325a9
fix: Inherit browser-level proxy settings from incognito context (#7770)
* chore: add request proxy tests

* fix: inherit browser-level proxy settings from incognito context

* fix: skip test on Windows
2022-03-07 10:12:26 +00:00