mirror of
https://github.com/morris/vanilla-todo.git
synced 2025-08-30 00:59:53 +02:00
set type module, simplify tests, update deps
This commit is contained in:
41
test/e2e/addTodoItem.test.js
Normal file
41
test/e2e/addTodoItem.test.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import '../coverage.js';
|
||||
|
||||
test("Add item to today's to-do list (Enter)", async ({ page }) => {
|
||||
await page.goto('http://localhost:8080');
|
||||
|
||||
const input = page.locator('.-today .todo-item-input > input');
|
||||
await input.focus();
|
||||
await input.fill('Hello, world!');
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
await expect(page.locator('.-today .todo-item > .label')).toHaveText(
|
||||
'Hello, world!',
|
||||
);
|
||||
});
|
||||
|
||||
test("Add item to today's to-do list (click)", async ({ page }) => {
|
||||
await page.goto('http://localhost:8080');
|
||||
|
||||
const input = page.locator('.-today .todo-item-input > input');
|
||||
await input.focus();
|
||||
await input.fill('Hello, world!');
|
||||
await page.locator('.-today .todo-item-input > .save').click();
|
||||
|
||||
await expect(page.locator('.-today .todo-item > .label')).toHaveText(
|
||||
'Hello, world!',
|
||||
);
|
||||
});
|
||||
|
||||
test("Add item to today's to-do list (blur)", async ({ page }) => {
|
||||
await page.goto('http://localhost:8080');
|
||||
|
||||
const input = page.locator('.-today .todo-item-input > input');
|
||||
await input.focus();
|
||||
await input.fill('Hello, world!');
|
||||
await page.locator('.-today').click();
|
||||
|
||||
await expect(page.locator('.-today .todo-item > .label')).toHaveText(
|
||||
'Hello, world!',
|
||||
);
|
||||
});
|
Reference in New Issue
Block a user