Revert "add test"
This reverts commit 78c120c30a5834b565501a44ec81b487e6e51c23.
This commit is contained in:
parent
a5d7ca17ae
commit
8de68512c6
|
|
@ -1,49 +0,0 @@
|
||||||
/* eslint-disable notice/notice */
|
|
||||||
|
|
||||||
import { test, expect } from '@playwright/test';
|
|
||||||
import type { Page } from '@playwright/test';
|
|
||||||
|
|
||||||
test.describe.configure({ mode: 'parallel' });
|
|
||||||
|
|
||||||
test.beforeEach(async ({ page }) => {
|
|
||||||
await page.goto('https://demo.playwright.dev/todomvc');
|
|
||||||
});
|
|
||||||
|
|
||||||
const TODO_ITEMS = [
|
|
||||||
'buy some cheese',
|
|
||||||
'feed the cat',
|
|
||||||
'book a doctors appointment'
|
|
||||||
];
|
|
||||||
|
|
||||||
test.describe('New Todo', () => {
|
|
||||||
test('should allow me to add todo items', async ({ page }) => {
|
|
||||||
// create a new todo locator
|
|
||||||
const newTodo = page.getByPlaceholder('What needs to be done?');
|
|
||||||
// Create 1st todo.
|
|
||||||
await newTodo.fill(TODO_ITEMS[0]);
|
|
||||||
await newTodo.press('Enter');
|
|
||||||
|
|
||||||
// Make sure the list only has one todo item.
|
|
||||||
await expect(page.getByTestId('todo-title')).toHaveText([
|
|
||||||
TODO_ITEMS[0]
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Create 2nd todo.
|
|
||||||
await newTodo.fill(TODO_ITEMS[1]);
|
|
||||||
await newTodo.press('Enter');
|
|
||||||
|
|
||||||
// Make sure the list now has two todo items.
|
|
||||||
await expect(page.getByTestId('todo-title')).toHaveText([
|
|
||||||
TODO_ITEMS[0],
|
|
||||||
TODO_ITEMS[1],
|
|
||||||
]);
|
|
||||||
|
|
||||||
await checkNumberOfTodosInLocalStorage(page, 2);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
async function checkNumberOfTodosInLocalStorage(page: Page, expected: number) {
|
|
||||||
return await page.waitForFunction(e => {
|
|
||||||
return JSON.parse(localStorage['react-todos']).length === e;
|
|
||||||
}, expected);
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue