← Back to Discord Forum

renaming html report from index.html

adamrandonsm4621posted in #help-playwright
Open in Discord

Is this possible? Can I rename an htm report to something other than index.html, if so, to what extent, i.e. can I name after the test I'm running?

This thread is trying to answer question "Can I rename an html report to something other than index.html, and if so, to what extent?"

1 reply

There's no built-in way to rename but you could work a round that by renaming file in custom reporter onExit() method with fs or other library. But I suspect that npx playwright show-report will not work with renamed file.


Sure, you can customize the name of your HTML report in Playwright. This is done through the outputFolder option in the playwright.config.ts file.

Here's how you can do it:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: [['html', { outputFolder: 'my-custom-report' }]],

In this example, Playwright will generate an HTML report named "my-custom-report.html" instead of "index.html". The report will be saved in a folder called "my-custom-report".

Remember, when renaming the HTML report, make sure that you provide a valid and unique filename with the ".html" extension. Also, ensure that there are no conflicting filenames or folders with the same name within your project directory.

This way, you can organize and name your test reports according to your preferences or project requirements.

For more detailed information or specific use cases related to renaming an HTML report using Playwright, I recommend referring directly to their official documentation.

Related Discord Threads

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 luc@ray.run.