예시
import { expect, test } from '@playwright/test';
test.beforeEach(async ({ page }) => {
await page.goto('/');
});
test.describe('Basic', () => {
test('Title', async ({ page }) => {
await expect(page).toHaveTitle('Loegnah Page');
});
});
test('Exist basic component', async ({ page }) => {
await expect(page.getByTestId('header')).toBeVisible();
await expect(page.getByRole('main')).toBeVisible();
await expect(page.getByTestId('footer')).toBeVisible();
});
여러 요소 중 하나를 선택해야할 때 → .first()
await expect(page.getByTestId('widgetItem').first()).toBeVisible();