Files
playwright/examples/todomvc/tests/completing-todos/should-toggle-all-todos-incomplete.spec.ts

23 lines
1.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// spec: specs/basic-operations.plan.md
// seed: tests/seed.spec.ts
import { test, expect } from '../fixtures';
test.describe('Completing Todos', () => {
test('should toggle all todos incomplete', async ({ page }) => {
// 1. Add three todos and mark all as complete using the toggle all checkbox
await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('First todo');
await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Second todo');
await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Third todo');
await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
await page.getByRole('checkbox', { name: '❯Mark all as complete' }).click();
await expect(page.getByText('0 items left')).toBeVisible();
// 2. Click the 'Mark all as complete' checkbox again
await page.getByRole('checkbox', { name: '❯Mark all as complete' }).click();
await expect(page.getByText('3 items left')).toBeVisible();
});
});