5. ES Modules & Project Architecture

Modular Architecture

// utils/auth.js
export function generateAuthHeader(token) {
  return { Authorization: Bearer ${token} };
}

// In test spec:
import { test, expect } from "@playwright/test";
import { generateAuthHeader } from "../utils/auth.js";

Task

  • Implement isSupportedBrowser:
  • 1. Accept browserName string.
  • 2. Return true if browserName is "chromium", "firefox", or "webkit".
πŸ’‘Common doubts
Did you like the problem?
Lesson 5 of 18
JavaScript
Loading code editor…
Next