Commit Graph

153 Commits

Author SHA1 Message Date
Pavel Feldman
a0aeaeb929
test: expose repeatEachIndex (#11158) 2022-01-03 17:29:54 -08:00
Yury Semikhatsky
8f9eaf7cba
fix(types): allow specifying element type in locator.evaluate callback (#11048) 2021-12-21 13:17:45 -08:00
Yury Semikhatsky
0eaa19d5e7
docs(expect): APIResponse assertions (#10957) 2021-12-16 11:27:30 -08:00
Dmitry Gozman
0d54afab9c
feat(test runner): show beforeAll/afterAll hooks similar to tests (#10923)
Reporters now get notified about hooks start/end/steps.
2021-12-15 10:39:49 -08:00
Pavel Feldman
518d67add5
feat(test.info): expose information on the currently running test (#10708) 2021-12-06 09:25:11 -08:00
Max Schmitt
af28a779be
docs: migrate JS assertions over to Java/Python assertions (#10431) 2021-11-24 21:58:35 +01:00
Ross Wollman
854f321532
feat(api): add explicit async testInfo.attach (#10121)
feat(api): add explicit async testInfo.attach

We add an explicit async API for attaching file paths (and Buffers) to
tests that can be awaited to help users ensure they are attaching files
that actually exist at both the time of the invocation and later when
reporters (like the HTML Reporter) run and package up test artifacts.

This is intended to help surface attachment issues as soon as possible
so you aren't silently left with a missing attachment
minutes/days/months later when you go to debug a suddenly breaking test
expecting an attachment to be there.

NB: The current implemntation incurs an extra file copy compared to
manipulating the raw attachments array. If users encounter performance
issues because of this, we can consider an option parameter that uses
rename under the hood instead of copy. However, that would need to be
used with care if the file were to be accessed later in the test.
2021-11-23 09:30:53 -08:00
Dmitry Gozman
0302e759df
feat(test runner): allow top-level test.fixme similar to test.skip (#10250)
```js
test.fixme('my test name', () => {});
```
2021-11-19 11:40:40 -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
Pavel Feldman
7b64161a37
feat(test-runner): allow specifying fine-grained trace options (#10147) 2021-11-08 15:39:58 -08:00
Dmitry Gozman
9cebe60831
feat(reporters): augment non-stdio reporters with dot/line (#10003) 2021-11-03 08:25:16 -07:00
Nick Partridge
a51ac39275
feat: add snapshotDir to set base snapshot directory (#9260) 2021-11-02 08:02:49 -07:00
Pavel Feldman
56ca3a18f5
feat(trace-viewer): show test name (#9957) 2021-11-01 21:23:35 -07:00
Dmitry Gozman
4f1027bdd0
feat(test runner): introduce TestInfo.parallelIndex (#9762)
This is a worker number between `0` and `workers - 1` that
does not change after worker process restart.
2021-11-01 10:37:34 -07:00
Pavel Feldman
d6adff7792
fix(html): include html into the reporter types (#9907) 2021-10-31 11:06:28 -07:00
Joel Einbinder
53c866c0f2
fix(monorepo): explicitly list package.json exports instead of using glob patterns (#9584) 2021-10-19 12:28:02 -04:00
Dmitry Gozman
6d554a5e30
feat(reporter): expose more apis (#9603) 2021-10-19 08:38:04 -07:00
Yury Semikhatsky
6d727401bf
chore(fetch): rename ApiRequest* to APIRequest* (#9606) 2021-10-19 07:38:27 -07:00
Pavel Feldman
e37660b068
feat(api): expose step location (#9602) 2021-10-18 21:06:18 -07:00
Joel Einbinder
c8f875a193
chore: move test runner types into the playwright test package (#9472)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2021-10-14 11:55:08 +02:00
Max Schmitt
ded1e718b5
types(test-runner): fix access worker fixtures in test.skip (#9447) 2021-10-12 17:44:00 +02:00
Max Schmitt
9dd6bb8c6a Revert "feat(test-runner): allow parametrized tests that don't extend base (#9301)"
This reverts commit f63af830de.
2021-10-11 17:32:31 +02: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
Pavel Feldman
f63af830de
feat(test-runner): allow parametrized tests that don't extend base (#9301) 2021-10-04 17:16:33 -07:00
Sidharth Vinod
ec5e7495df
types(test-runner): Add github to built in reporters (#9283) 2021-10-04 11:31:26 +02:00
Yury Semikhatsky
235eaca34a
fix(fetch): use data, form and multipart for different post data (#9248) 2021-10-01 12:11:33 -07:00
Nick Partridge
b126a5685b
feat: add path option to toMatchSnapshot (#9156) 2021-10-01 09:15:44 -07:00
Dmitry Gozman
d22dd4a4e7
feat(test runner): improve fixture typings for function fixtures (#9138)
When fixture value `R` is a function, TypeScript sometimes confuses
function `R` and function `async ({}, use) => {}`. This leads to
`any` types in the latter because it could be either of the functions
as TS thinks.

The solution is to only accept the second syntax, assuming that noone
passes fixture value that is a function as is:

```js
// This will stop working.
test.extend<{ foo: (x: number) => number }>({
  foo: x => 2 * x,
});

// This will get inferred types and autocomplete.
test.extend<{ foo: (x: number) => number }>({
  foo: async ({}, use) => {
    await use(x => 2 * x);
  },
});
```
2021-09-24 19:59:30 -07:00
Max Schmitt
89aace688f
fix: make Serializable type any (#9059) 2021-09-23 11:06:34 -07:00
Yury Semikhatsky
79eb7744bc
feat(fetch): support options in playwright._newRequest (#9061) 2021-09-22 12:44:22 -07:00
Dmitry Gozman
cb7285a8c0
docs(test): separate TestOptions from Fixtures (#9000) 2021-09-17 17:13:47 -07:00
Yury Semikhatsky
c58f34fb2e
feat(fetch): introduce global fetch request (#8927) 2021-09-14 18:31:35 -07:00
Dmitry Gozman
d9d2d809a2
fix(test): make use in config accept option values only (#8828)
Also include default options in FullConfig/FullProject.
Also make examples compile and add a test.
2021-09-13 17:50:31 -07:00
Dmitry Gozman
962a33993f
fix(types): leave a single js-flavor=ts snippet in JSDoc (#8669) 2021-09-02 16:18:22 -07:00
Dmitry Gozman
e691b649de
feat(test runner): describe.parallel (#8662) 2021-09-02 15:42:07 -07:00
Dmitry Gozman
947ff6755d
feat(types): generate JSDoc for things like test.describe.only (#8663) 2021-09-02 13:56:36 -07:00
Dmitry Gozman
bee8ed117b
feat(html reporter): preview source code, steps and step errors (#8598) 2021-08-31 16:34:52 -07:00
Dmitry Gozman
bb5e44fbc4
docs: introduce overloads, generate JSDoc for overloads (#8485)
- Each overload, e.g. for `page.evaluate`, shows a nice autocomplete doc,
  not only the first one.
- We can have multiple overloads directly on the docs page, e.g.
  `test.skip(title, fn)` and `test.skip(condition, description)`.
  These overloads are internally named `Test.skip#1` and all aliased
  to `test.skip`.
2021-08-27 21:57:40 -07:00
Dmitry Gozman
a479cb6f52
fix(test runner): add an overload for test.skip(title, fn) (#8454)
We shipped this feature, but forgot to add the right overload to d.ts.
2021-08-25 14:36:36 -07:00
Pavel Feldman
710cec80a0
feat(test-runner): render step titles (#8270) 2021-08-17 16:41:36 -07:00
Pavel Feldman
97ba4f22f3
feat(test-runner): report nested steps (#8266) 2021-08-17 13:57:26 -07:00
Dmitry Gozman
052e0e197c
fix(types): allow specifying scope when overriding fixtures (#8139)
Otherwise it show a confusing error.
2021-08-11 10:44:15 -07:00
Dmitry Gozman
a5e0965087
feat(test runner): implement test.describe.serial (#8132) 2021-08-10 21:26:45 -07:00
Dmitry Gozman
3bf3318350
fix(test runner): make sure options, trace and screenshot apply to all contexts (#8083)
- Uses some auto fixtures to set default options and instrumentation on BrowserType.
- Moves screenshot, trace and video to worker-scoped fixtures.
- Throws in page/context when used from beforeAll/afterAll.
- Plumbs around BrowserType to be accessible from Browser and BrowserContext.
2021-08-09 18:09:11 -07:00
Dmitry Gozman
87548f94c1
feat(test runner): support test fixtures in beforeAll/afterAll (#8082)
Each hook gets its own test scope. This is not too useful for
object fixtures like `page` (although one can use a page in
`beforeAll` to save storage state), but much more useful for option
fixtures like `viewport`.
2021-08-09 13:26:33 -07:00
Dmitry Gozman
41949e559e
Revert "feat(test runner): file scope fixtures (#7969)" (#8081)
This reverts commit 1bbf86d060,
leaving small improvements around.
2021-08-09 12:33:16 -07:00
Pavel Feldman
290f601dae
feat(expect): introduce explicit default async expect timeout (#8071) 2021-08-07 22:08:56 -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
Max Schmitt
385d489b35
feat(test-runner): re-enable web server (#7906)
Co-authored-by: Joel Einbinder <joel.einbinder@gmail.com>
2021-08-03 23:24:14 +02:00