How to fix common Playwright test mistake: `Cannot read properties of undefined`?

Playwright

This is a test code bug, usually from missing fixture args or wrong variable scope.

Always destructure fixtures in the test signature.

import { test } from '@playwright/test';

test('profile opens', async ({ page }) => {
  await page.goto('https://example.com');
  await page.getByRole('link', { name: 'Profile' }).click();
});

Common mistake: writing async () => { await page.goto(...) } without { page }.