playwright/packages/playwright-test/src
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
..
matchers feat(expect): show expect timeout in the error message (#10388) 2021-11-17 17:28:30 -08:00
reporters fix(html reporter): show missing attachments as warnings (#10400) 2021-11-17 18:03:13 -08:00
third_party chore: move diff_match_patch into the test package (#9475) 2021-10-13 13:38:26 -07:00
cli.ts chore(test runner): route runner errors through Reporter.onError (#10257) 2021-11-11 16:48:08 -08:00
dispatcher.ts feat(test runner): introduce TestInfo.parallelIndex (#9762) 2021-11-01 10:37:34 -07:00
expect.ts feat(api): expose step location (#9602) 2021-10-18 21:06:18 -07:00
fixtures.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
globals.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
index.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
ipc.ts feat(test runner): introduce TestInfo.parallelIndex (#9762) 2021-11-01 10:37:34 -07:00
loader.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
profiler.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
project.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
runner.ts fix(test runner): route more errors to reporter (#10263) 2021-11-12 06:47:41 -08:00
test.ts feat(reporter): expose more apis (#9603) 2021-10-19 08:38:04 -07:00
testType.ts feat(test runner): allow top-level test.fixme similar to test.skip (#10250) 2021-11-19 11:40:40 -08:00
transform.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
types.ts fix(test runner): update TestInfo.duration before running afterEach hooks (#10228) 2021-11-10 16:02:27 -08:00
util.ts feat(serial): better errors from beforeAll (#10419) 2021-11-18 14:36:55 -08:00
webServer.ts fix: support even older node 12 (#9718) 2021-10-22 15:59:52 -04:00
worker.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
workerRunner.ts feat(api): add explicit async testInfo.attach (#10121) 2021-11-23 09:30:53 -08:00