To use your playwright.config.ts
file in UI mode, ensure it's in your project directory. Open it and define your test configurations. For instance, you can specify the reporter to use in UI mode. If you want to use the JUnit reporter and save the report to "results.xml", add this code:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [['junit', { outputFile: 'results.xml' }]],
});
After saving your changes, navigate to your project directory in a terminal or command prompt. Run npx playwright test --ui
to launch Playwright Test in UI mode and load your test files.
In UI mode, you'll see your test files on the sidebar. You can expand each file and describe block to run, view, watch, and debug each test. Use the search bar or dropdown menu to filter tests. To run all tests, click the triangle icon in the sidebar. To run a single test file, a block of tests, or a single test, hover over the name and click the triangle next to it.
During test execution, you can view the full trace of your tests and hover back and forward over each action to see what was happening during each step. Once your tests have finished running, you'll see the results in the UI mode interface.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].