Files
AI/참고/playwright-main/examples/todomvc/tests/adding-todos/should-trim-whitespace-from-new-todo.spec.ts
2026-05-12 19:40:31 +09:00

17 lines
751 B
TypeScript

// spec: Adding Todos
// seed: tests/seed.spec.ts
import { test, expect } from '../fixtures';
test.describe('Adding Todos', () => {
test('should trim whitespace from new todo', async ({ page }) => {
// 1. Type ' Todo with spaces ' (with leading and trailing spaces) and press Enter
await page.getByRole('textbox', { name: 'What needs to be done?' }).fill(' Todo with spaces ');
await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
// Expect: The todo is added as 'Todo with spaces' without leading or trailing whitespace, Counter shows '1 item left'
await expect(page.getByText('Todo with spaces')).toBeVisible();
await expect(page.getByText('1 item left')).toBeVisible();
});
});