Test Execution | Bondar Academy
Course: Playwright API Testing with TypeScript
Module: API Testing Basics
Instructor: Artem Bondar
Lesson Summary
In this lesson, we explored various methods to run tests in Playwright . We previously utilized the Playwright extension in Visual Studio Code , which allows for convenient test execution through a user interface. Here are the key points discussed: Running Tests in Playwright You can run tests individually or all at once using the Test Explorer. Tests can also be executed via the terminal using the command: npx playwright test Understanding Test Failures During execution, we encountered failures due to concurrency issues when running tests in parallel across multiple browsers. Playwright defaults to running tests in Chromium , Firefox , and WebKit , which can lead to conflicts when tests modify shared data. Configuring Test Execution To avoid concurrency issues, we can disable parallel execution by setting fullyParallel to false in the Playwright configuration file. Tests can be executed sequentially, ensuring no conflicts arise from shared test data. Additional Terminal Commands Run a specific project: --project API testing Run a specific spec file: example.spec.ts Run a specific test by name: npx playwright test -g 'test name' Re-run only failed tests: npx playwright test --last-failed Test Annotations Utilize annotations to control test execution: test.only to run only specific tests. test.skip to skip a test. test.fixme for tests that need fixing later. This lesson provided a comprehensive overview of running tests in Playwright, focusing on both the graphical interface and terminal commands. Further exploration of the Playwright configuration will be covered in future lessons.