Commit Graph

59 Commits

Author SHA1 Message Date
Yury Semikhatsky
c0d0f54a12
feat(runner): allow filtering setup and tests (#18900)
Running `npx playwright test file:123` will have the following behavior
- if only test files match then only matching subset of tests will run
but all setup files will run as well
- if only setup files match the filter then only those setup tests will
run
- if both setup and test files match an error will be thrown
2022-11-18 11:35:29 -08:00
Yury Semikhatsky
0f4b67bc6d
test(cli): setup files are in list-files and test --list output (#18890) 2022-11-17 16:31:04 -08:00
Pavel Feldman
7ab4c17519
chore: support jsx/tsx syntax in test files (#18123)
Fixes https://github.com/microsoft/playwright/issues/17964
2022-10-18 12:45:33 -07:00
Yury Semikhatsky
10d7c60abf
feat(runner): project execution schedule (#17548) 2022-09-23 20:01:27 -07:00
Dmitry Gozman
445fe032f5
feat(test runner): separate interrupted status from skipped (#16124) 2022-08-02 12:55:43 -07:00
Dmitry Gozman
22ead7b5ab
Revert "fix(test runner): handle istty in line reporter (#15455)" (#15633)
This reverts commit 767babc3a2.
2022-07-13 15:11:56 -07:00
Dmitry Gozman
767babc3a2
fix(test runner): handle istty in line reporter (#15455)
When running without tty, line reporter outputs a line for each
percent of the tests, thus limiting the output to ~100 lines.

In addition, reporters now support PLAYWRIGHT_LIVE_TERMINAL
env variable to force tty mode.
2022-07-07 09:55:12 -07:00
Ross Wollman
981f5ab8c1
fix(test-runner): apply fixme v. skip annotations (#15277)
Currently, if `text.fixme()` or `test.skip()` is used within a test, we
add a `fixme` or `skip` annotation. However, if the wrapper style is
used:

```
test.fixme('should work', () => {…})
```

the annotations were missing. This change adds annotations for the
above.

These annotations are important for reporting purposes and knowing
exactly what flavor of "skipped" was used.

Fixes #15239.
2022-07-05 10:46:30 -07:00
Pavel Feldman
e8070ee1b2
chore: warn users on clashing test output and html reporter folders (#14964) 2022-06-18 15:47:26 -07:00
Pavel Feldman
e912b6897d
fix(esm): respect source maps in esm-transpiled code (#14561) 2022-06-01 16:50:23 -07:00
Pavel Feldman
29fd1d86df
chore: hide plugins for now (#13908) 2022-05-03 14:25:56 -07:00
Pavel Feldman
a1b10c3856
chore: try serializing the config instead of requiring it in the worker (#13839) 2022-04-29 16:05:08 -07:00
Pavel Feldman
7989427ea6
chore: bundle core deps (#13621) 2022-04-18 20:20:49 -07:00
Pavel Feldman
63ea81ec54
chore: make bundles typed (#13620) 2022-04-18 17:50:25 -07:00
Pavel Feldman
58d79e5e4d
chore: add core utils bundle (#13615) 2022-04-18 13:47:23 -07:00
Yury Semikhatsky
7ffce1da53
chore: remove PlaywrightClient and Docker factory (#13571) 2022-04-15 12:11:38 -07:00
Yury Semikhatsky
aee6ba299a
chore: remove GridClient, run only page tests in service mode (#13566) 2022-04-14 15:30:04 -07:00
Wojciech Jureczka
7ba527c65f
chore: expose JSON Reporter types (#13241)
Resolves #13208
2022-04-14 13:55:29 -07:00
Pavel Feldman
5ae2017a5b
chore: always import type (#13365) 2022-04-06 14:57:14 -07:00
Andrey Lushnikov
e1700bd167
feat: use package.json directory as a default for outputDir (#12942)
This patch:
- starts using directory of `package.json` to resolve default
  output directory path
- starts using either `package.json` directory or configuration
  directory to resolve all relative paths

References #12970
2022-03-23 16:05:49 -07:00
Ross Wollman
541fb39a51
feat(html-reporter): add report context header (#12734)
Resolves #11318.

* Adds `TestConfig.attachments` public API. (We opted to not implement an analog to the async `TestInfo.attach(…)` API.)
* Adds `TestConfig.attachments` to common reporters.
* Dogfoods some git and CI-info inference to generate useful atttachments
* Updates HTML Reporter to include a side bar to present a pre-defined set of attachments (a.k.a git/commit context sidebar)

Here's what it looks like:

<img width="1738" alt="Screen Shot 2022-03-21 at 3 23 28 PM" src="https://user-images.githubusercontent.com/11915034/159373291-8b937d30-fba3-472a-853a-766018f6b3e2.png">

See `tests/playwright-test/reporter-html.spec.ts` for an example of usage (for dogfood-ing only). In the future, if this becomes user-facing, there the Global Setup bit would likely become unnecessary (as would interaction with attachments array); there would likely just be a nice top-level config and/or CLI flag to enable collecting of info.
2022-03-22 16:28:04 -07:00
Max Schmitt
e231db1810
chore: restore expect.any()/expect.anything() (#12820) 2022-03-16 21:34:41 +01:00
Dmitry Gozman
237954212c
Revert "feat(line reporter): show stats, handle tty" (#12735)
This reverts commit be817d1a53, PR #12695.
Reason: found issues with stdout messing with stats.
2022-03-14 10:37:43 -07:00
Dmitry Gozman
be817d1a53
feat(line reporter): show stats, handle tty (#12695)
- Line reporter now shows stats in addition to the test name:
  ```log
  [chromium] › page/page-click-react.spec.ts:108:1 › should not retarget when element changes on hover
  23% [21/93] Passed: 17 Flaky: 0 Failed: 0 Skipped: 4 (7s)
  ```

- When connected to a TTY or with `env.PLAYWRIGHT_LIVE_TERMINAL`
set to anything but `'0'` or `'false'`, line reporter updates in place.

- When not connected to a TTY, line reporter prints an update
after each ~1% of tests done, so it never prints more than 100 lines.

- Updated tests to the golden style.
2022-03-11 18:19:33 -08:00
Dmitry Gozman
e8ce5d0258
feat(test runner): on beforeAll failure, precisely skip the tests (#12417)
Previously, we used to skip all the tests from the same file when
any `beforeAll` fails in the file.

Now, we only skip the rest of the tests affected by this particular
`beforeAll` and continue with other tests in the new worker.
2022-03-08 20:29:31 -08:00
Andrey Lushnikov
396d920145
feat(test-runner): implement expect(pageOrLocator).toHaveScreenshot (#12242)
Fixes #9938
2022-02-28 12:25:59 -08:00
Dmitry Gozman
91672595f2
fix(reporters): normalize usage of isTTY, env.CI and debug env variables (#12295)
- `stdout.isTTY` controls whether list reporter updates lines or just adds them;
- `env.CI` is used in a few places to affect the defaults:
  - whether to open interactive html;
  - default reporter dot/line;
  - default terminal reporter added to non-terminal reporters;
- `env.PWTEST_SKIP_TEST_OUTPUT` is removed;
- `env.PW_TEST_DEBUG_REPORTERS` is introduced specifically for tests.
2022-02-24 12:39:28 -08:00
Andrey Lushnikov
5879c7f362
chore: refactor toMatchSnapshot once again (#12313)
Keep massaging code in preparation for `toHaveScreenshot`.

References #9938
2022-02-23 13:17:37 -08:00
Pavel Feldman
e9e5de2d57
feat(debug): allow preprocessing JS scripts as well (#11953) 2022-02-09 07:14:11 -08:00
Pavel Feldman
b2e15b8c60
chore: mute more test runner extension vars (#11881) 2022-02-08 09:22:45 -08:00
Dmitry Gozman
a30bc171c5
chore: make playwright-test tests debuggable with extension (#11798) 2022-02-01 17:15:55 -08:00
Andrey Lushnikov
2336692e8a
feat: support clarification message for expect (#11735)
The clarification message is displayed in the HTML report as the name of the step:

![image](https://user-images.githubusercontent.com/746130/151852652-48194140-5ea4-439d-afee-12583a8caf71.png)

It is also shown in terminal output:

![image](https://user-images.githubusercontent.com/746130/151852666-5c956ef1-6e94-4bc2-8e55-b58688dfc7e0.png)

Fixes #7816
2022-01-31 17:14:59 -08:00
Dmitry Gozman
9d5bf0e90d
fix(test runner): fixture teardown double error, testInfo.attach() (#11365)
- Use file path, not content to calculate the attachment hash.
- Always cleanup fixture from the list on teardown, to avoid reporting
  teardown error multiple times: from the test, and from the cleanup.
2022-01-13 10:38:47 -08:00
Pavel Feldman
373042ed89
chore: don't allow importing @playwright/test twice (#11218) 2022-01-06 09:29:05 -08:00
Dmitry Gozman
e48231655f
chore: roll stable-test-runner to dec-18-2021 (#11008) 2021-12-18 10:12:35 -08:00
Pavel Feldman
7eb3f76f49
feat(esm): allow running tests in type module projects (#10503) 2021-11-24 12:42:48 -08:00
Dmitry Gozman
d9f849fb14
feat(test runner): replace declare/define with "options" (#10293)
1. Fixtures defined in test.extend() can now have `{ option: true }` configuration that makes them overridable in the config. Options support all other properties of fixtures - value/function, scope, auto.
```
const test = base.extend<MyOptions>({
  foo: ['default', { option: true }],
});
```

2. test.declare() and project.define are removed.

3. project.use applies overrides to default option values and nothing else. Any test.extend() and test.use() calls take priority over config options.

Required user changes: if someone used to define fixture options with test.extend(), overriding them in config will stop working. The solution is to add `{ option: true }`.

```
// Old code
export const test = base.extend<{ myOption: number, myFixture: number }>({
  myOption: 123,
  myFixture: ({ myOption }, use) => use(2 * myOption),
});

// New code
export const test = base.extend<{ myOption: number, myFixture: number }>({
  myOption: [123, { option: true }],
  myFixture: ({ myOption }, use) => use(2 * myOption),
});
```
2021-11-18 15:45:52 -08:00
Andrey Lushnikov
1a577ac344
chore: introduce docker integration dogfood (#9998)
This patch:
- rolls stable-test-runner to Nov 2, 2021 tip-of-tree
- introduces a new npm script, `npm run vtest`, to run Visual Regression
  Tests for our HTML reporter
2021-11-03 15:26:18 -07:00
Pavel Feldman
31faa7d9a7
chore: sort out base fixtures (#9809) 2021-10-27 08:28:53 -07:00
Pavel Feldman
75cfe5d1f5
chore: start adding html runner e2e tests (#9518) 2021-10-14 15:48:05 -07:00
Max Schmitt
76142a33ae
test: fix tests which include special signal handling (#9433) 2021-10-11 12:07:40 -07:00
Joel Einbinder
c89d5a50dd
chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
Pavel Feldman
bc71d20d0f
feat(request): add global request fixture (#9332) 2021-10-06 10:09:27 -07:00
Dmitry Gozman
018467911b
test: introduce some common test fixtures (#9060) 2021-09-21 16:24:48 -07:00
Dmitry Gozman
7ec1035b98
test: improve child process utilities in tests (#9036) 2021-09-20 17:17:12 -07:00
Dmitry Gozman
2b4a93972d
test: use ToT test runner for non-test-runner tests (#8671) 2021-09-03 11:22:25 -07:00
Dmitry Gozman
44cdda43fe
feat(test runner): show stdio for failures in terminal reporters (#8150) 2021-08-11 16:44:19 -07:00
Dmitry Gozman
1bbf86d060
feat(test runner): file scope fixtures (#7969)
These are reset after running tests from a single file.
2021-08-04 21:11:02 -07:00
Joel Einbinder
eb31b9e4a9
feat(test-runner): support esm modules in more places (#7542) 2021-07-12 11:59:58 -05:00
Dmitry Gozman
77deca1d6b
feat(test runner): export testInfo.data (#7525)
This is a key-value storage for any information that goes into the report.
Also export JSONReport types.
2021-07-08 17:16:36 -07:00