1. TypeScript Types, Const/Let & Annotations

Why TypeScript for Playwright?

Playwright was authored in TypeScript. Writing tests in TypeScript provides: - Instant IDE Autocompletion: Code suggestions for all locators and expectations. - Compile-Time Safety: Catches misspelled element selectors and missing arguments before execution.
const baseUrl: string = "https://targetqa.com";
const timeoutMs: number = 5000;

Task

  • Declare two typed constants:
  • `appUrl` of type `string` set to `"https://targetqa.com"`.
  • `timeoutMs` of type `number` set to `5000`.
💡Common doubts
Did you like the problem?
Lesson 1 of 12
TypeScript
Loading code editor…
Next