TestingDocs.com logoTestingDocs.com
Automation learning lab
TestingDocs • Self-paced course

Playwright Automation
Self Study Guide

Start from zero. Learn JavaScript and TypeScript, automate browsers, and build reliable end-to-end tests.

60 chaptersBeginner friendlyHands-on practice
TypeScript / Chapter 30 of 60~12 min • Beginner
Chapter 30TypeScript

Typed test data mini project

Combine arrays, interfaces, functions and async workflows in a small test-data module. A typed array catches many accidental field-name errors, and mapping produces readable case labels. This is preparation for parameterized Playwright tests.

How it works

Step-by-step walkthrough

  1. Define a case type
  2. Build a data array
  3. Generate case names

Example

TypeScript
type Case = { name: string; expected: boolean };
const cases: Case[] = [
  { name: 'valid login', expected: true },
  { name: 'invalid login', expected: false }
];
for (const c of cases) {
  console.log(`${c.name}: ${c.expected}`);
}
Expected result: valid login: true; invalid login: false
💡 Point to remember
Keep test data deterministic and independent from real accounts.

✎ Your practice task

Add a third case for an empty username.

Knowledge check

What catches a missing expected field before runtime?

🌐 Continue learning