Commit Graph

160 Commits

Author SHA1 Message Date
Max Schmitt 081031f50e
chore: bump vite to v6 (#34663) 2025-02-18 13:29:16 +01:00
Max Schmitt 9e433060fe
test: keep testing React 18 (#34671) 2025-02-07 12:24:53 +01:00
Max Schmitt 8accb0ad1b
test: change ct-vite projects to type: module (#34662) 2025-02-06 23:11:06 +01:00
Max Schmitt 65688d623e
chore: update TypeScript to v5.7 (#33994) 2024-12-13 04:52:04 -08:00
Dmitry Gozman 0937d2f7b9
fix(types): update types for test.extend (#33784) 2024-12-09 08:59:01 -08:00
Segev Finer f3ae940684
fix(ct-vue): Upgrade plugin-vue to be compatible with Vite 5 (#33758) 2024-11-26 17:42:36 +01:00
Pavel Feldman 0d9bcd45d5
chore: pin typescript while vue-tsc is broken (#33746) 2024-11-23 11:48:34 -08:00
Yury Semikhatsky e3ed9fa7c3
chore: drop support for solid component testing (#33523) 2024-11-11 10:26:50 -08:00
Yury Semikhatsky 87b896e597
chore: remove playwright-ct-vue2 (#33302) 2024-10-25 13:31:55 -07:00
Simon Knott ff0c498904
fix(ct-vue): update default slot should work (#32952)
Closes https://github.com/microsoft/playwright/issues/32809

We were writing onto the wrong object.
2024-10-04 14:18:21 +02:00
Simon Knott 208a54529d
fix(ct-react): support shorthand fragment notation (#32900)
Closes https://github.com/microsoft/playwright/issues/32853

Vite turns the shorthand fragment notation `<></>` into `import {
Fragment } from "react"; <Fragment></Fragment>`. On the Node.js side of
things, this `react` import resolves to our mock version of React, which
currently mocks `Fragment` as `{}`. Currently, we pass that straight to
`React.createElement`, which throws an error.

The fix is to make our `Fragment` mock detectable with a tag, and when
we render it replace it with the real `__pwReact.Fragment`.
2024-10-02 11:19:09 +02:00
Max Schmitt 9fa06be49e
fix(ct): throw error if inline component is getting mounted (#32531)
What was happening?
- When we use CT, we go over the test files, look at the imports using
`tsxTransform.ts` and store them inside a map, these we feed into the
import registry which we build using Vite and have access inside the
browser
- In case of an inline component in the same file as where the test file
is, this is not happening.
- jsx-runtime via babel kicks in, transforms every JSX component in
something like that:

```
{
  __pw_type: 'jsx',
  type: [Function: MyInlineComponent],
  props: { value: 'Max' },
  key: undefined
}
```

this then gets passed into `wrapObject` which maps any function from the
Node.js side into expose function calls so they work inside the browser.
The assumption for `wrapObject` was to do it mostly for callbacks. So it
does for `type` - which is actually our component. We then pass this to
the React render function, which calls back the exposed function but we
never return anything, so it mounts `undefined`.

---

While there have been experiments from certain vendors to get the
'client only' code inside a server side file, we should throw for now to
not confuse users. We might revisit this in the future since Babel / TSX
doesn't support it outside of the box.

Fixes https://github.com/microsoft/playwright/issues/32167
2024-09-10 11:15:20 +02:00
Simon Knott b599335404
chore(ui): enable `react/recommended` lint rules (#32214)
Closes https://github.com/microsoft/playwright/issues/32159. I
originally set out to enable Strict Mode for our React UI, but found a
way better thing: Enabling the lint rules we had already installed!

`eslint-plugin-react` is already in of our `package.json`, and this PR
enables it and fixes some of the reported issues. Most of them are
around the `key` prop which is mostly about performance, but there's
also fixes for misspelled `data-testid` props.
2024-08-20 14:16:28 +02:00
Dmitry Gozman e86c8af599
chore: rename `route` fixture in ct (#31817)
Addresses review feedback.
2024-07-23 07:43:28 -07:00
Dmitry Gozman 369a1eca48
feat(ct): experimental `route` fixture (#31554)
This fixture accepts the same arguments as `context.route()`, but also
supports request handlers compatible with msw syntax.
2024-07-06 09:35:20 -07:00
Max Schmitt 2285bcd55d
test: fix ct-vue-vite tests (#31406) 2024-06-22 00:50:10 +02:00
Sander e047c478a4
feat(ct): resolve hooksConfig import refs (#31024)
closes https://github.com/microsoft/playwright/issues/30453
2024-05-28 12:29:52 -07:00
Sander 9ce41fa1b0
fix(ct): mount then unmount then mount (#30657)
closes https://github.com/microsoft/playwright/issues/30628
2024-05-14 11:03:46 -07:00
Viktor Szépe 150cbcbdf3
chore: fix typos (#30645) 2024-05-08 19:40:03 +01:00
Sander 1a34c85886
chore(ct): bump vite to v5.2.8 (#30264) 2024-04-08 09:48:05 +02:00
Max Schmitt 18b51308ff
test(svelte): migrate svelte-navigator to custom minimal router (#30225)
Repro: `cd tests/components/ct-svelte && rm -rf node_modules
package-lock.json && npm i && npx playwright test --project=chromium`

Follow-up based on
https://github.com/microsoft/playwright/pull/28624#issuecomment-1858608101.

Svelte has no router by default, only SvelteKit - so lets remove the
package which is not maintained anymore and not recommended.
2024-04-04 16:01:08 +02:00
Max Schmitt 94e61fc95a
test: bump ct typescript version (#29855) 2024-03-11 17:09:26 +01:00
Sander 015a1bcc1c
feat(ct): double unmounting component throws error (#29650) 2024-02-26 11:16:27 -08:00
Sander 7e502e91b2
fix(ct): solid pass children when they are defined (#29648) 2024-02-26 11:15:08 -08:00
Jeppe Reinhold 4d868f6ba8
fix(ct-react+ct-react17): only pass `children` to `React.createElement` when they are defined (#29592) 2024-02-23 12:30:42 -08:00
Pavel Feldman 41c15cb176
chore: move vite root dir into template folder (#29081) 2024-01-23 09:40:05 -08:00
Pavel Feldman d61f99034a
fix(ct-react): do not reset mount hooks upon update (#29072)
Fixes https://github.com/microsoft/playwright/issues/29058
2024-01-19 12:55:36 -08:00
Pavel Feldman 71a48c2562
chore: migrate ct to vite5 (#29033)
Closes https://github.com/microsoft/playwright/issues/28607
2024-01-19 11:13:03 -08:00
Pavel Feldman 4010940315
chore: move off babel proposals to plugins (#29053) 2024-01-18 17:50:52 -08:00
Pavel Feldman 92ad1b385c
chore: refactor import processing in ct (#28975) 2024-01-12 20:02:27 -08:00
Sander eebb69121e
fix(ct): vue update slots (#28835)
Due to [Vue 3.4](https://blog.vuejs.org/posts/vue-3-4): _"refactored
reactivity system that makes effect triggering more accurate and
efficient"_

closes: https://github.com/microsoft/playwright/issues/28830
2024-01-03 20:48:41 +01:00
Sander df4b11c169
fix(ct): react17 eslint errors (#28783) 2023-12-30 17:29:20 -08:00
Sander 4d62784eeb
feat(ct): react component as props (#28382)
closes: https://github.com/microsoft/playwright/issues/28367#issuecomment-1830298864
2023-12-22 20:51:59 -08:00
Ben McCann bbf588a992
feat(ct): upgrade to vite-plugin-svelte 3 (#28624) 2023-12-19 19:48:37 +01:00
Sander aaf9cc5b49
fix(ct): solid typecheck (#28686) 2023-12-16 12:42:50 -08:00
Sander f58c1f37eb
fix(ct): empty slots or children (#28225)
closes: https://github.com/microsoft/playwright/issues/28212
2023-11-27 15:53:50 -08:00
Sander 1a34b6d211
fix(ct): solid render array as child (#27849)
closes:
https://github.com/microsoft/playwright/issues/27587#issuecomment-1762133376

related: https://github.com/microsoft/playwright/pull/27692

CC @dgozman

Co-authored-by: sand4rt <mbr@mbrs-MacBook-Air.local>
2023-10-28 11:22:10 -07:00
Sander 96787d2626
fix(ct): vue render array as slot (#27851)
partial fix for:
https://github.com/microsoft/playwright/issues/27587#issuecomment-1762133376

related: https://github.com/microsoft/playwright/pull/27692

CC @dgozman

Co-authored-by: sand4rt <mbr@mbrs-MacBook-Air.local>
2023-10-28 11:21:37 -07:00
Sander 3313381040
fix(ct): react render array as child (#27692)
Signed-off-by: Sander <info@mesander.com>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
Co-authored-by: mbr <mbr@mbrs-MacBook-Air.local>
2023-10-28 10:36:48 -07:00
Sander 27daa5e7b1
fix(ct): solid render array as child (#27715) 2023-10-20 11:44:30 -07:00
Max Schmitt 0a49c3dbb9
chore: bump @babel dependencies (#27632)
This fixes:

```
Run npm audit --omit dev
# npm audit report

@babel/traverse  <7.23.2
Severity: critical
Babel vulnerable to arbitrary code execution when compiling specifically crafted malicious code - https://github.com/advisories/GHSA-[6](https://github.com/microsoft/playwright/actions/runs/6535308689/job/17744452034?pr=27631#step:10:7)[7](https://github.com/microsoft/playwright/actions/runs/6535308689/job/17744452034?pr=27631#step:10:8)hx-6x53-jw[9](https://github.com/microsoft/playwright/actions/runs/6535308689/job/17744452034?pr=27631#step:10:10)2
fix available via `npm audit fix`
node_modules/@babel/traverse

1 critical severity vulnerability

To address all issues, run:
  npm audit fix
Error: Process completed with exit code 1.
```
2023-10-17 20:52:41 +02:00
Dmitry Gozman d426f2fd4e
fix(chromium): continue requests paused for the second time (#27429)
Sometimes Chromium restarts requests. This leads to multiple
`Fetch.requestPaused` for a single `Network.requestWillBeSent`.

Fixes #27294.
2023-10-04 11:18:06 -07:00
Dmitry Gozman 186f86905c
chore: make `@playwright/test` depend on `playwright` (#26946) 2023-09-08 14:23:35 -07:00
Sander e2a11bed19
feat(ct): svelte vite context (#26554) 2023-08-19 16:26:06 -07:00
Sander 7c5d73a3c3
feat(ct): vue type safe mount props (#23151) 2023-07-31 17:45:34 -07:00
Pavel Feldman 0409bfca56
chore: ensure module deps in ct-core (#24056)
Fixes https://github.com/microsoft/playwright/issues/23823
2023-07-06 12:01:45 -07:00
Max Schmitt 9980f054bc
docs: align Node.js code snippets with ESLint (#23916) 2023-06-27 11:53:53 +02:00
Sander 9d3edb0aa3
fix(ct): vue3 fallthrough events & callbacks (#23649)
closes:
https://github.com/microsoft/playwright/issues/23526#issuecomment-1583074280

closes: https://github.com/microsoft/playwright/issues/23435
2023-06-19 11:20:37 -07:00
Sander c9cedc78b1
chore(ct): inline reporter in ci (#23608) 2023-06-08 16:23:59 -07:00
Max Schmitt 5701ff1e9b
chore: do not always return 200 on component testing network requests (#23408)
Fixes https://github.com/microsoft/playwright/issues/23364

See here about their AppTypes:
https://vitejs.dev/config/shared-options.html#apptype
2023-06-01 01:33:48 +02:00