Rayrun
← Back to Discord Forum

how to use my playwright.config.ts file while I run tests in ui mode?

ibrahim8482posted in #help-playwright
Open in Discord
ibrahim8482

How can I use my playwright.config.ts file when I run my tests in --ui mode. My config file works when I run my tests in a docker container.

Thanks

This thread is trying to answer question "How can I use my playwright.config.ts file when I run my tests in --ui mode?"

0 replies

Answer

Configuring Playwright Test for UI Mode

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.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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].