mirror of
https://github.com/morris/vanilla-todo.git
synced 2025-08-30 17:19:46 +02:00
add tests for custom lists
This commit is contained in:
31
test/e2e/addCustomList.test.mjs
Normal file
31
test/e2e/addCustomList.test.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test('Add custom to-do list', async ({ page }) => {
|
||||
await page.goto('http://localhost:8080');
|
||||
|
||||
const add = page.locator('.todo-frame.-custom .add');
|
||||
await add.click();
|
||||
|
||||
const title = page.locator('.todo-custom-list > .header > .title');
|
||||
await expect(title).toHaveText('...');
|
||||
});
|
||||
|
||||
test('Edit custom to-do list title (Enter)', async ({ page }) => {
|
||||
await page.goto('http://localhost:8080');
|
||||
|
||||
const add = page.locator('.todo-frame.-custom .add');
|
||||
await add.click();
|
||||
|
||||
const title = page.locator('.todo-custom-list > .header > .title');
|
||||
await title.click();
|
||||
|
||||
const input = page.locator('.todo-custom-list > .header > .form > .input');
|
||||
|
||||
await expect(input).toBeVisible();
|
||||
await expect(input).toBeFocused();
|
||||
|
||||
await input.fill('Hello, world!');
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
await expect(title).toHaveText('Hello, world!');
|
||||
});
|
@@ -1,11 +1,11 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test("Add item to today's todo list (Enter)", async ({ page }) => {
|
||||
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').filter();
|
||||
const input = page.locator('.-today .todo-item-input > input');
|
||||
await input.focus();
|
||||
await input.type('Hello, world!');
|
||||
await input.fill('Hello, world!');
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
await expect(page.locator('.-today .todo-item > .label')).toHaveText(
|
||||
@@ -13,15 +13,28 @@ test("Add item to today's todo list (Enter)", async ({ page }) => {
|
||||
);
|
||||
});
|
||||
|
||||
test("Add item to today's todo list (click)", async ({ page }) => {
|
||||
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').filter();
|
||||
const input = page.locator('.-today .todo-item-input > input');
|
||||
await input.focus();
|
||||
await input.type('Hello, world!');
|
||||
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