15. Installing Playwright & Configuration

Setup Command for JavaScript

npm init playwright@latest
# Choose: JavaScript

Basic playwright.config.js

// playwright.config.js
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
testDir: "./tests",
fullyParallel: true,
reporter: "html",
use: {
baseURL: "https://targetqa.com",
trace: "on-first-retry",
},
projects: [
{ name: "chromium", use: { ...devices["Desktop Chrome"] } },
],
});

Task

  • Implement buildLaunchSettings:
  • 1. Accept isHeaded boolean.
  • 2. Return { headless: !isHeaded }.
πŸ’‘Common doubts
Did you like the problem?
Lesson 15 of 35
JavaScript
Loading code editor…
Next