107 Commits

Author SHA1 Message Date
dependabot[bot]
a689e534ac
chore(deps): bump vite from 5.4.6 to 5.4.14 (#34420)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-22 14:23:05 +01:00
Adam Gastineau
3c160df06a
chore: mark v1.51.0-next (#34382) 2025-01-17 12:34:59 -08:00
yangsisi
d029b03d9f
fix(defineConfig): fix type issue passing custom property in the seco… (#33774)
Signed-off-by: yangsisi <13655750+yangsisi0422@users.noreply.github.com>
2024-12-09 09:20:47 -08:00
Max Schmitt
cd41404b05
chore: mark v1.50.0-next (#33572) 2024-11-13 12:51:54 +01:00
Max Schmitt
5a8b49910a
fix(ct): msw interception after msw v2.6.4 release (#33536) 2024-11-11 11:37:29 +01:00
Dmitry Gozman
541ce9f0bb
chore: mark 1.49.0-next (#32873) 2024-09-30 04:24:57 -07: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
Dmitry Gozman
1402dee9e6
Revert "fix(test runner): align with typescript behaviour for resolving index.js and package.json through path mapping (#32078)" (#32492)
This reverts commit effb1ae2349aeef1c0bfb0b6cd886b9b4b32c8e5.

This broke path mapping into directories in ESM mode. References #32480.
2024-09-06 12:08:10 -07:00
Dmitry Gozman
1ba3db6864
chore: implement clear-cache through plugins (#32471)
Also switches it to task runner.
2024-09-05 13:50:16 -07:00
Dmitry Gozman
d4c77ce260
chore: make find-related-test-files work through plugins (#32465)
Also switches it to the task runner.
2024-09-05 06:52:11 -07:00
Simon Knott
0f636116e2
chore: mark 1.48.0-next (#32466) 2024-09-05 12:57:16 +02:00
Dmitry Gozman
91012833c6
chore: move 'dev-server' extensibility point to plugin (#32448)
Instead of plumbing it through a custom unspecified config field, make
it a part of plugin interface.

Additionally, use task runner for starting/stopping dev server.
2024-09-05 02:22:27 -07:00
Dmitry Gozman
60631409d6
chore: make dev server only use public config (#32441)
In preparation to make it a part of a plugin.
2024-09-04 01:29:55 -07:00
Simon Knott
effb1ae234
fix(test runner): align with typescript behaviour for resolving index.js and package.json through path mapping (#32078)
Supercedes https://github.com/microsoft/playwright/pull/31915, closes
https://github.com/microsoft/playwright/issues/31811.

When TypeScript resolves a specifier via path mapping, it does not
interpret `package.json`. If path mapping resolves to a directory, it
only looks at the `index.js` file in that directory if it's in CommonJS
mode.

We need to mirror this in our `esmLoader.ts`.

---------

Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2024-08-12 15:05:19 +02:00
Simon Knott
8412d973c0
fix(ui): added test in watched file should be run (#31842)
Closes https://github.com/microsoft/playwright/issues/22211

Currently, when the server notifies the UI about changed files, the UI
determines what files to re-run based on an old test list. By listing
tests before that, we make sure that the test list is up-to-date, and
that added tests are included in the next run.

I've also removed the `listChanged` event as discussed in the team sync.
The event isn't used anywhere and fires in exactly the same cases where
`testFilesChanged` fired, so i've folded them into one another. This allowed simplifying `Watcher`.
2024-07-30 14:17:41 +02:00
Max Schmitt
e784e2df01
chore: mark 1.47.0-next (#31879) 2024-07-26 17:50:11 +02:00
Simon Knott
f23d02a211
feat(test runner): --only-changed option (#31727)
Introduces an `--only-changed [base ref]` option.

`playwright test --only-changed` filters the test run to only run test
suites that have uncommitted changes.
`playwright test --only-changed=foo` runs only tests that were changed
since commit `foo`.

In pull request CI, this can be used to run changed tests first and fail
fast: `--only-changed=$GITHUB_BASE_REF`.
During local development, it can be used to quickly filter down to the
touched set of tests suites.
In some rare usecases, this can also help to cut down on CI usage for
pull requests. Tread with caution though.

File dependencies are taken into account to ensure that if you touched a
utility file, all relevant tests are still executed.

Closes https://github.com/microsoft/playwright/issues/15075
2024-07-23 18:04:17 +02:00
Dmitry Gozman
e86c8af599
chore: rename route fixture in ct (#31817)
Addresses review feedback.
2024-07-23 07:43:28 -07:00
Simon Knott
1408a45595
chore(ct): remove suite dependency by connecting dependency graphs at read time, not write time (#31794)
Broken out of https://github.com/microsoft/playwright/pull/31727 as per
@dgozman's
[request](https://github.com/microsoft/playwright/pull/31727#discussion_r1685793229).

The PR goal is to remove the `suite` argument from the Component
testing's Vite Plugin. `suite` is used to enrich Vite's dependency graph
with information about dependencies between test suites and helper
files. It essentially merges the Vite graph with the
`compilationCache.ts > fileDependencies` graph, and then writes the
result back into `compilationCache.ts > externalDependencies`.

By refactoring this to make the connection on the reading end in
`collectAffectedTestFiles`, we can drop the `suite` parameter.

We didn't yet have a test that depended on the dependency graph being
connected correctly between `fileDependencies` and
`externalDepedencies`, so I've [extended an existing
test](53a539938b)
to capture that.
2024-07-23 10:19:58 +02:00
Max Schmitt
6a9e60d6a1
fix(ct): import ct* flavour types from ct-core and then from pwt (#31642) 2024-07-16 19:32:51 +02: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
Dmitry Gozman
32e25a252b
chore: mark v1.46.0-next (#31324) 2024-06-14 18:22:42 -07: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
Max Schmitt
a0938fc7a4
chore: set minimum Node.js requirement to 18 (#30684) 2024-05-08 17:41:27 +01:00
Yury Semikhatsky
ad0938c659
chore: mark 1.45.0-next (#30598) 2024-04-29 17:19:05 -07:00
Pavel Feldman
e91d372544
fix(ct): allow importing components from node_modules (#30493)
Fixes https://github.com/microsoft/playwright/issues/29854
2024-04-24 12:32:28 -07:00
Sander
1a34c85886
chore(ct): bump vite to v5.2.8 (#30264) 2024-04-08 09:48:05 +02:00
Pavel Feldman
3cea258a9c
chore: expose clear cache to test server (#30268) 2024-04-05 09:31:34 -07:00
Pavel Feldman
5043bd55dc
chore: move dev server to config-based framework extensibility (#30234) 2024-04-05 08:39:51 -07:00
dependabot[bot]
0d5964d3f9
chore(deps): bump vite from 5.0.12 to 5.0.13 (#30227) 2024-04-04 09:25:46 +02:00
Yury Semikhatsky
81bcf2a53b
docs: document FullReporter API (#30186)
* FullConfig split into FullConfig and ConfigInWorker
* FullProject split into FullProject and ProjectInWorker
* Tests can only access {Config, Project}InWorker, while reporters can
only access Full{Config,Project}. This will allow in the future to
change the reporter API independently from the tests.
* Added documentation for the 4 classes.
2024-04-02 16:15:02 -07:00
Pavel Feldman
baaf8c8093
chore: hide internal commands (#30170) 2024-03-28 12:19:03 -07:00
Dmitry Gozman
b9b06cb010
chore: mark version 1.44.0-next (#30129) 2024-03-26 13:44:10 -07:00
Max Schmitt
65d82797f1
fix(ct): ct ID clash on similar imports (#30108)
This restores the [best
effort](https://github.com/microsoft/playwright/pull/29407/files#diff-8dd3534dc5013c3779edeaded71324b0dd1c1807668f3c6d9e9a1aab1c20ae91L152)
logic if its a relativ path.

Fixes https://github.com/microsoft/playwright/issues/30085

---------

Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Pavel Feldman <pavel.feldman@gmail.com>
2024-03-25 23:50:45 +01:00
Dmitry Gozman
7a3c002944
fix(ct): allow importing json files (#30067)
While we are not fully resolving imports during compilation, do not
treat `json` as a non-importable asset.

Fixes #29926.
2024-03-25 07:41:54 -07:00
Pavel Feldman
baf2cdf936
fix(ct): stop-gap for shared file import (#29744)
Fixes: https://github.com/microsoft/playwright/issues/29739
2024-02-29 19:13:32 -08:00
Flo Becker
772345c83c
fit(ct): remove unused type import (#29706)
Signed-off-by: Flo Becker <flo@die-beckerei.de>
2024-02-28 13:31:43 +01:00
Pavel Feldman
9d0430fa26
chore: strengthen linting (#29669) 2024-02-26 16:52:28 -08:00
Yury Semikhatsky
01846b954d
chore: mark 1.43.0-next (#29670) 2024-02-26 16:45:25 -08:00
Pavel Feldman
ee93136132
chore: streamline config loader (#29627) 2024-02-22 15:14:13 -08:00
Pavel Feldman
d573c515a3
chore: add test server stub (#29568) 2024-02-20 09:56:33 -08:00
Pavel Feldman
217c0618df
chore: rename find-related-tests to find-related-test-files (#29483) 2024-02-13 15:40:49 -08:00
Pavel Feldman
7aef5249d8
chore: pass the private data to the runner via config (#29467) 2024-02-13 09:34:03 -08:00
Max Schmitt
b947639d3a
fix(ct): fix component.d.ts core types (#29463)
Fixes https://github.com/microsoft/playwright/issues/29461
2024-02-12 22:37:31 +01:00
Pavel Feldman
586d14f02c
chore: add find-related-tests command (#29439) 2024-02-09 19:02:42 -08:00
Pavel Feldman
7f81c6e138
feat(ct): allow clearing cached build and test transformations (#29410) 2024-02-08 10:24:01 -08:00
Pavel Feldman
84dea09cb9
fix(ct): resolve components used in tests during the vite build (#29407) 2024-02-07 20:39:45 -08:00
Pavel Feldman
fcd3c7b523
Revert "fix(ct): resolve paths before detecting JS" (#29312)
Reverts microsoft/playwright#29308
2024-02-01 21:11:30 -08:00
Pavel Feldman
eb8cbbbf62
fix(ct): resolve paths before detecting JS (#29308) 2024-02-01 21:06:31 -08:00
Pavel Feldman
6a14b1dc51
chore: automatically detect the dev server (#29176) 2024-01-25 11:46:47 -08:00