Trace Usage Standard
0 min
Trace support must be included from the beginning in new Playwright projects. In existing projects, tracing must be started and stopped at hook points that match the framework lifecycle.
1. Create context: Create a new BrowserContext for test isolation.
2. Start tracing: Start recording before creating the Page and before navigation.
3. Run the test: Record actions, snapshots, and source information.
4. Stop tracing: Produce a uniquely named ZIP file at the end of the execution.
- screenshots, snapshots ve sources seçenekleri açık olmalıdır.
- Tracing must start before the Page is created.
- stop() must always run inside a finally block or the framework after hook.
- Parallel executions must not write to the same file name.
- Trace files generated in CI must be stored as job artifacts or test result attachments.