UI and API Tests in a Single Framework | Bondar Academy
Course: Playwright API Testing with TypeScript
Module: Test Management
Instructor: Artem Bondar
Lesson Summary
In this lesson, the instructor explains how to configure Playwright to manage both UI tests and API tests within a single project. The setup allows for organized testing without conflicts. Key Steps for Configuration Create Separate Folders: Under the tests folder, create two subfolders: API test and UI test . Place API-related spec files in the API test folder and UI-related spec files in the UI test folder. Adjust Configuration File: In the configuration file, define separate projects for UI and API tests. Use the testDirectory property to specify the respective test folders. For UI tests, specify the browser to be used; this is not necessary for API tests. Running Tests To run the tests, you can switch between the projects using the Playwright runner: Select the desired project (API or UI) to execute the corresponding tests. Alternatively, you can switch projects via the command line. Configuration Files Maintain two configuration files: apitestconfig.ts for API testing. playwrightconfig.ts for UI testing and other configurations. This setup allows for a streamlined testing process, ensuring that both UI and API tests can coexist without issues. The instructor encourages organizing the framework for better management of tests.