Chapter 30: Typed test data mini project
Automation learning lab
Playwright Automation
Self Study Guide
Start from zero. Learn JavaScript and TypeScript, automate browsers, and build reliable end-to-end tests.
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
- Define a case type
- Build a data array
- Generate case names
Example
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}`);
}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
60-chapter learning path
Start at chapter 1, or choose any topic. Your progress is tracked separately for each chapter.
JavaScript fundamentals
TypeScript fundamentals
Playwright • setup & locators
Playwright • interactions & assertions
Playwright • framework & debugging
Playwright • real-world automation
Interactive practice lab
Try the controls below and observe the corresponding Playwright locator instructions. This browser demo does not execute Node.js or Playwright Test; copy the code to your local Playwright project to automate it.
Task manager demo
Suggested automation
Actions on the demo update these examples. In your local test use a page that contains the same controls.
Download a standalone lab page, then serve it locally (for example with Python's http.server). Navigate to it in a Playwright test.