Project Setup and Teardown | Bondar Academy
Course: Playwright UI Testing with TypeScript
Module: Advanced Tricks and Techniques
Instructor: Artem Bondar
Lesson Summary
This lesson covers the use of Playwright projects to manage the setup and teardown phases of test execution, enhancing control over test flows. Here's a structured overview of the key concepts discussed: Project Setup Utilize Playwright projects to create dependencies for test execution. Example application: Conduit , previously configured with user session setup. Creating a Smoke Test Rename the existing Chromium project to Regression Project . Define a Smoke Test as a prerequisite for the regression tests. Create a new spec file named smoke.spec.ts to verify application readiness. Configuring Projects Add a new project in the configuration file for the smoke test. Set the project to match only smoke.spec.ts . Establish a dependency from the regression project to the smoke test. Execution Flow Run the regression test using the command: npx Playwright test --project=regression Execution order: setup → smoke test → regression tests . If the smoke test fails, regression tests are skipped. Teardown Process Optionally create a teardown project for cleanup after regression tests. Define a spec file, e.g., cleanup.teardown.ts , for cleanup actions. Execution sequence: setup → smoke test → regression → teardown . This structured approach allows for better organization and control of test execution, ensuring that tests are only run when prerequisites are met.