adds playwright tests
This commit is contained in:
8
web/tests/playwright/e2e/index/index.spec.ts
Normal file
8
web/tests/playwright/e2e/index/index.spec.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { IndexPage } from '../../pages/index_page';
|
||||
|
||||
test('index page does not show error', async ({ page }) => {
|
||||
const indexPage = new IndexPage(page);
|
||||
await indexPage.goto()
|
||||
await indexPage.hasNoError()
|
||||
});
|
||||
30
web/tests/playwright/e2e/list/list.spec.ts
Normal file
30
web/tests/playwright/e2e/list/list.spec.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { test as base, expect } from '@playwright/test';
|
||||
import { ListsPage } from '../../pages/lists_page';
|
||||
|
||||
const test = base.extend<{ listsPage: ListsPage }>({
|
||||
listsPage: async ({ page }, use) => {
|
||||
const listsPage = new ListsPage(page);
|
||||
await listsPage.goto();
|
||||
await listsPage.create();
|
||||
await use(listsPage);
|
||||
await listsPage.removeAll();
|
||||
},
|
||||
});
|
||||
|
||||
test('shows a list card', async ({ listsPage }) => {
|
||||
const listItemCount = await listsPage.listItems.count();
|
||||
await listsPage.create();
|
||||
expect(listsPage.listItems).toHaveCount(listItemCount + 1);
|
||||
expect(listsPage.listItemsImage).toBeVisible();
|
||||
});
|
||||
|
||||
test('update a list card', async ({ listsPage }) => {
|
||||
await listsPage.update();
|
||||
expect(listsPage.listItems.first()).toContainText("Updated List");
|
||||
expect(listsPage.listItems.first()).toContainText("New Description");
|
||||
});
|
||||
|
||||
test('delete a list card', async ({ listsPage }) => {
|
||||
await listsPage.delete();
|
||||
expect(listsPage.listItems).toHaveCount(0);
|
||||
});
|
||||
11
web/tests/playwright/e2e/user/user.spec.ts
Normal file
11
web/tests/playwright/e2e/user/user.spec.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test('logs the user out', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.getByRole('button', { name: 'avatar' }).click();
|
||||
await page.locator(".menu .menu-item").filter({ hasText: "Logout" }).click();
|
||||
|
||||
const cookies = await page.context().cookies();
|
||||
const pbAuthCookie = cookies.find(cookie => cookie.name === 'pb_auth');
|
||||
expect(pbAuthCookie).toBeFalsy();
|
||||
});
|
||||
Reference in New Issue
Block a user