Commit Graph

331 Commits

Author SHA1 Message Date
Dmitry Gozman
9814c592d2
fix(test runner): shutdown redundant workers (#12062) 2022-02-14 10:57:15 -08:00
Pavel Feldman
96b5831a49
chore: add support private methods in TS (#12051) 2022-02-11 14:46:49 -08:00
Dmitry Gozman
d8db785c0a
fix(reporters): correctly handle missing stdout.columns (#12016)
When columns are not available, do not trim the output.
2022-02-11 08:33:56 -08:00
Ross Wollman
0d42c16a17
fix(test-runner): undefined body crash with manual attachments (#11995)
The new (as of 1.18) `async testInfo.attach(…)` API handles this
gracefully (and is part of the reason for the new API's existence).
However, for the foreseeable future, it's still possible to manually
push onto the attachments array where we can't validate the contents
until it's too late, so this change ensures more graceful handling in
that case.

Fixes #11565
2022-02-10 12:33:38 -08:00
Pavel Feldman
fbc05b74a7
chore: revert "fix(test-runner): escape backslashes in win cli (#11763)" (#12004) 2022-02-10 07:02:37 -08:00
Andrey Lushnikov
6904b3294e
fix(test-runner): fix browser initialization in test modifiers (#11984)
Fixes #11985
2022-02-09 15:30:14 -08:00
Dmitry Gozman
ae7c52154f
fix(fixtures): make sure connected browser respects context options (#11990)
Connected browser was wired up to the wrong browserType object.
2022-02-09 15:25:15 -08:00
Andrey Lushnikov
40b4218962
chore: roll stable test runner to Feb 9, 2022 (#11971) 2022-02-09 09:34:25 -08:00
Yury Semikhatsky
706c897031
feat(fixtures): respect tracing config for APIRequestContext (#11954) 2022-02-09 08:54:09 -08:00
Pavel Feldman
e9e5de2d57
feat(debug): allow preprocessing JS scripts as well (#11953) 2022-02-09 07:14:11 -08:00
Dmitry Gozman
19368e93af
feat(test runner): support connectOptions (#11919)
This allows to specify `connectOptions` in the config that
switch built-in `browser` to be remotely connected.
2022-02-08 20:45:42 -08:00
Dmitry Gozman
5881a46ecf
fix(test runner): skip beforeAll/afterAll when all tests are skipped (#11952)
There is a corner case where tests were skipped like this:

```js
test.skip('title', () => {});
```
2022-02-08 16:36:30 -08:00
Dmitry Gozman
e92caf01b3
fix(webServer): do not set baseURL equal to webServer.url (#11951) 2022-02-08 15:57:36 -08:00
Pavel Feldman
8dff2e35c8
chore: don't throw on no testDir (#11950) 2022-02-08 15:27:05 -08:00
Pavel Feldman
b2e15b8c60
chore: mute more test runner extension vars (#11881) 2022-02-08 09:22:45 -08:00
Dmitry Gozman
8a5c93436d
fix(reporter): do not report parallel tests as slow (#11921) 2022-02-07 20:10:13 -08:00
Pavel Feldman
9116adc684
chore: allow opt-into the legacy global setup mode (#11888) 2022-02-07 10:41:56 -08:00
Dmitry Gozman
d9a8bb057d
fix(test-fail): allow unhandled expects in test.fail (#11850)
Previously, we would consider this a worker error, but
we make an exception for "expect()" calls.
2022-02-03 17:14:12 -08:00
Pavel Feldman
fdda759a9d
feat(parallel): allow setting enclosing scope parallel mode (#11822) 2022-02-02 20:44:11 -08:00
Andrey Lushnikov
ba0c7e679b
feat(test-runner): support expect.soft (#11800)
Soft expects will still fail the test, but will not abort it's execution. As a consequence of this:
-  `TestResult` now might have multiple errors, which is reflected with a new `testResult.erros: TestError[]` field.
- `TestInfo` now might have multiple errors as well, which is reflected with a new `testInfo.errors: TestError[]` field.

Fixes #7819
2022-02-02 18:33:51 -08:00
Andrey Lushnikov
b0daa7754f
feat: filter stack traces to exclude test runner frames (#11795)
Before:

```bash
Running 1 test using 1 worker
  1) [chromium] › tests/example.spec.ts:3:1 › should work ==========================================

    Error: expect(received).toBe(expected) // Object.is equality

    Expected: 2
    Received: 1

      2 |
      3 | test('should work', async({page}) => {
    > 4 |   expect(1).toBe(2);
        |             ^
      5 | });
      6 |

        at Proxy.<anonymous> (/Users/andreylushnikov/prog/playwright/packages/playwright-test/src/expect.ts:151:30)
        at /Users/andreylushnikov/tmp/tests/example.spec.ts:4:13
        at /Users/andreylushnikov/prog/playwright/packages/playwright-test/src/workerRunner.ts:335:13
        at runNextTicks (node:internal/process/task_queues:61:5)
        at processImmediate (node:internal/timers:437:9)
        at TestInfoImpl._runFn (/Users/andreylushnikov/prog/playwright/packages/playwright-test/src/testInfo.ts:164:7)
        at WorkerRunner._runTestWithBeforeHooks (/Users/andreylushnikov/prog/playwright/packages/playwright-test/src/workerRunner.ts:317:24)
        at TimeoutRunner.run (/Users/andreylushnikov/prog/playwright/packages/playwright-core/src/utils/async.ts:48:14)
        at TestInfoImpl._runWithTimeout (/Users/andreylushnikov/prog/playwright/packages/playwright-test/src/testInfo.ts:151:7)
        at WorkerRunner._runTestOrAllHook (/Users/andreylushnikov/prog/playwright/packages/playwright-test/src/workerRunner.ts:276:5)
        at WorkerRunner._runSuite (/Users/andreylushnikov/prog/playwright/packages/playwright-test/src/workerRunner.ts:190:11)
        at WorkerRunner.run (/Users/andreylushnikov/prog/playwright/packages/playwright-test/src/workerRunner.ts:137:9)
        at process.<anonymous> (/Users/andreylushnikov/prog/playwright/packages/playwright-test/src/worker.ts:87:5)
```

after:

```
Running 1 test using 1 worker
  1) [chromium] › tests/example.spec.ts:3:1 › should work ==========================================

    Error: expect(received).toBe(expected) // Object.is equality

    Expected: 2
    Received: 1

      2 |
      3 | test('should work', async({page}) => {
    > 4 |   expect(1).toBe(2);
        |             ^
      5 | });
      6 |

        at /Users/andreylushnikov/tmp/tests/example.spec.ts:4:13
```
2022-02-01 18:40:44 -08:00
Dmitry Gozman
a30bc171c5
chore: make playwright-test tests debuggable with extension (#11798) 2022-02-01 17:15:55 -08:00
Pavel Feldman
011d743f90
chore: roll test runner to ToT (#11796) 2022-02-01 15:34:09 -08:00
Pavel Feldman
f875ebe730
fix(test-runner): respect source maps when reporting test files (#11770) 2022-02-01 13:04:54 -08:00
Caio Agiani
b6b60decdf
fix: typos (#11789) 2022-02-01 11:09:41 -08:00
Pavel Feldman
3a5e8184b5
fix(html-reporter): open tests from required file (#11784) 2022-02-01 11:01:52 -08:00
Pavel Feldman
c5d852f1bb
fix(test-runner): escape backslashes in win cli (#11763) 2022-01-31 17:48:05 -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
Pavel Feldman
2b55adaafa
feat(breaking): always report onBegin/onEnd, report file errors (#11758) 2022-01-31 17:09:04 -08:00
Andrey Lushnikov
b58b004f0f
fix: run reporter.onEnd after webserver teardown (#11712)
Fixes #11647
2022-01-31 06:19:33 -08:00
Dmitry Gozman
30f3cbd6da
fix(fixtures): make sure defaultLaunchOptions are always there (#11713) 2022-01-28 10:51:55 -08:00
Dmitry Gozman
b1fbc4fdbe
fix(test runner): resolve tsconfig for each file (#11662)
This allows us to properly handle path mappings
that are not too ambiguous.
2022-01-26 18:28:42 -08:00
divdavem
512a245f13
feat(test-runner): wait for a url before starting tests (#10138)
The webServer configuration in @playwright/test now accepts a url as an
alternative to a port number to wait for a url to return a 2xx status code.
2022-01-26 16:32:58 -08:00
Dmitry Gozman
19820de7a9
fix(test runner): correctly save videos when running remotely (#11633) 2022-01-26 07:43:07 -08:00
Dmitry Gozman
a8a81eba11
test: default to one worker on CI for tests/playwright-test (#11618) 2022-01-25 10:11:44 -08:00
Ross Wollman
64e7557fb9
fix: falsey behavior in route.continue, page.post, testInfo.attach (#11421)
In several of the Playwright APIs, falsey values were not handled correctly. This changeset adds tests (and some fixes):

- route.continue: If options.postData was the empty string, the continue failed to override the post data.
- page.post (application/json with options.data: false|''|0|null): Raw falsey values were getting dropped (i.e. you can't do the equivalent of curl --header application/json … -d 'false'). This has been fixed with most values across all browsers, but an additional fix is needed for 'null' which the channel serializer treats extra specially.
- testInfo.attach: This didn't get reported as an error when options.path was the empty string, but should have been.
#11413 (and its fix #11414) inspired this search as they are the same
class of bug.
2022-01-24 15:06:36 -08:00
Pavel Feldman
9542b007cf
fix(esm): don't emit module shorthand warning (#11596) 2022-01-24 11:22:56 -08:00
Max Schmitt
f29a673b4c
fix: do not mute route handler exceptions (#11555) 2022-01-22 22:19:32 +01:00
Pavel Feldman
6b3e596fd8
fix(baseurl): support path-less baseurl (#11527) 2022-01-20 18:11:56 -08:00
Pavel Feldman
daa2f00bfb
chore: roll stable-test-runner to ToT (#11445) 2022-01-17 19:45:59 -08:00
Ross Wollman
33f32368e5
fix(test runner): dispatcher transformation of empty attachments (#11414) 2022-01-17 18:47:24 -08:00
Pavel Feldman
8ecf581b45
chore: focus by line should override only (#11427) 2022-01-16 08:47:09 -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
Dmitry Gozman
4efb30999f
feat(request): show request context methods as steps (#11337) 2022-01-11 17:33:41 -08:00
Dmitry Gozman
d36ff8a96c
fix(test runner): remove test output for failures (#11308) 2022-01-10 13:22:09 -08:00
Dmitry Gozman
14fd837e94
fix(test runner): hide beforeAll/afterAll hooks from the reporter api (#11306)
This api is not ready yet.
2022-01-10 12:09:51 -08:00
Dmitry Gozman
058f98d3dd
fix(test runner): revert error location from top frame (#11250)
This does not play nicely with some internal Playwright errors, so
it needs more tweaks.
2022-01-07 11:06:47 -08:00
Pavel Feldman
5fa7d19f1c
feat(html): render inline attachments as monospace (#11214) 2022-01-06 09:29:55 -08:00
Pavel Feldman
373042ed89
chore: don't allow importing @playwright/test twice (#11218) 2022-01-06 09:29:05 -08:00
Dmitry Gozman
3ecac56cc0
fix(test runner): testInfo.attach api review changes (#11211)
Remove overload, require name, merge options.
2022-01-05 16:39:33 -08:00