Playwright + JS · Lesson 35 of 35

0/35 done

Module 35: Playwright Configuration & Reporting

35. Master Class: Configuration & HTML Test Reporting

18 minlesson

Try it yourself

Implement calculateTestPassRate:

  1. Accept summary object { passed: number, failed: number, flaky: number }.
  2. Calculate total. If 0, return 0.
  3. Return Number(((summary.passed / total) * 100).toFixed(1)).

The editor has a worked example. Read it, tweak it, then press Mark as complete.

Production playwright.config.js

javascript
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
  testDir: "./tests",
  fullyParallel: true,
  retries: process.env.CI ? 2 : 0,
  timeout: 30000,
  expect: { timeout: 5000 },
  reporter: [
    ["html", { open: "never" }],
    ["list"],
    ["junit", { outputFile: "results.xml" }],
  ],
  use: {
    baseURL: process.env.BASE_URL || "https://targetqa.com",
    trace: "retain-on-failure",
    screenshot: "only-on-failure",
  },
  projects: [
    { name: "chromium", use: { ...devices["Desktop Chrome"] } },
    { name: "firefox", use: { ...devices["Desktop Firefox"] } },
    { name: "webkit", use: { ...devices["Desktop Safari"] } },
  ],
});

Key Takeaways & Walkthrough Summary

Congratulations on reaching the final module of Playwright with JavaScript! In this lesson, we explore complete playwright.config.js architecture and interactive HTML reports. You will learn how to analyze step-by-step actionability call logs and deliver clean test metrics to your engineering team. Happy testing!

Part of the Playwright + JS course (Playwright with JavaScript). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.

Common Doubts & Lesson Q&A

How do I publish Playwright HTML reports on GitHub Pages?

The 'playwright-report/' directory is a completely static website. Simply upload that folder as a CI artifact or deploy to GitHub Pages.

Finished reading?

Review the worked example in the editor, then mark the lesson complete.

Back to course overview
JavaScript
Finish course