From 7468b3694cda692b60f62065a1408134e26fc5d1 Mon Sep 17 00:00:00 2001 From: jaji oluwatobiloba Date: Fri, 24 Feb 2023 14:55:03 -0500 Subject: [PATCH] Remove playwright --- .changeset/hot-ligers-deny.md | 5 +++ tests/example.spec.ts | 80 ----------------------------------- 2 files changed, 5 insertions(+), 80 deletions(-) create mode 100644 .changeset/hot-ligers-deny.md delete mode 100644 tests/example.spec.ts diff --git a/.changeset/hot-ligers-deny.md b/.changeset/hot-ligers-deny.md new file mode 100644 index 0000000..b59c694 --- /dev/null +++ b/.changeset/hot-ligers-deny.md @@ -0,0 +1,5 @@ +--- +'@finsweet/docs-theme': patch +--- + +Update exports file path diff --git a/tests/example.spec.ts b/tests/example.spec.ts deleted file mode 100644 index 67d2e89..0000000 --- a/tests/example.spec.ts +++ /dev/null @@ -1,80 +0,0 @@ -import type { Page } from '@playwright/test'; -import { expect, test } from '@playwright/test'; - -/** - * These are some demo tests to showcase Playwright. - * You can run the tests by running `pnpm dev`. - * If you need more info about writing tests, please visit {@link https://playwright.dev/}. - */ - -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 1st todo. - await page.locator('.new-todo').fill(TODO_ITEMS[0]); - await page.locator('.new-todo').press('Enter'); - - // Make sure the list only has one todo item. - await expect(page.locator('.view label')).toHaveText([TODO_ITEMS[0]]); - - // Create 2nd todo. - await page.locator('.new-todo').fill(TODO_ITEMS[1]); - await page.locator('.new-todo').press('Enter'); - - // Make sure the list now has two todo items. - await expect(page.locator('.view label')).toHaveText([TODO_ITEMS[0], TODO_ITEMS[1]]); - - await checkNumberOfTodosInLocalStorage(page, 2); - }); - - test('should clear text input field when an item is added', async ({ page }) => { - // Create one todo item. - await page.locator('.new-todo').fill(TODO_ITEMS[0]); - await page.locator('.new-todo').press('Enter'); - - // Check that input is empty. - await expect(page.locator('.new-todo')).toBeEmpty(); - await checkNumberOfTodosInLocalStorage(page, 1); - }); - - test('should append new items to the bottom of the list', async ({ page }) => { - // Create 3 items. - await createDefaultTodos(page); - - // Check test using different methods. - await expect(page.locator('.todo-count')).toHaveText('3 items left'); - await expect(page.locator('.todo-count')).toContainText('3'); - await expect(page.locator('.todo-count')).toHaveText(/3/); - - // Check all items in one call. - await expect(page.locator('.view label')).toHaveText(TODO_ITEMS); - await checkNumberOfTodosInLocalStorage(page, 3); - }); - - test('should show #main and #footer when items added', async ({ page }) => { - await page.locator('.new-todo').fill(TODO_ITEMS[0]); - await page.locator('.new-todo').press('Enter'); - - await expect(page.locator('.main')).toBeVisible(); - await expect(page.locator('.footer')).toBeVisible(); - await checkNumberOfTodosInLocalStorage(page, 1); - }); -}); - -async function createDefaultTodos(page: Page) { - for (const item of TODO_ITEMS) { - await page.locator('.new-todo').fill(item); - await page.locator('.new-todo').press('Enter'); - } -} - -async function checkNumberOfTodosInLocalStorage(page: Page, expected: number) { - return await page.waitForFunction((e) => { - return JSON.parse(localStorage['react-todos']).length === e; - }, expected); -}