wip: more tests

This commit is contained in:
Robert Perce 2026-02-14 13:35:59 -06:00
parent 7e2f5d0a18
commit b0630a25e1
7 changed files with 114 additions and 10 deletions

View file

@ -1,28 +1,26 @@
import { test, expect } from '@playwright/test';
import { login, verifyCreateUser, todate } from './util';
test('can log out', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await login(page);
});
test('can log out', async ({ page }) => {
await page.getByText("Logout").click();
await expect(page.getByLabel("Username")).toBeVisible();
});
test('has no contacts', async ({ page }) => {
await login(page);
await expect(page.getByRole("navigation").getByRole("link")).toHaveCount(0);
});
test('can add contacts', async ({ page }) => {
await login(page);
await verifyCreateUser(page, { names: ['John Contact'] });
await verifyCreateUser(page, { names: ['Jack Contact'] });
await expect(page.getByRole("navigation").getByRole("link")).toHaveCount(2);
});
test('shows "never" for unfreshened contacts', async ({ page }) => {
await login(page);
await verifyCreateUser(page, { names: ['John Contact'] });
await page.getByRole('link', { name: 'Mascarpone' }).click();
@ -30,7 +28,6 @@ test('shows "never" for unfreshened contacts', async ({ page }) => {
});
test('shows the date for fresh contacts', async ({ page }) => {
await login(page);
await verifyCreateUser(page, { names: ['John Contact'] });
await page.getByRole('link', { name: /edit/i }).click();
await page.getByRole('button', { name: /fresh/i }).click();
@ -40,7 +37,6 @@ test('shows the date for fresh contacts', async ({ page }) => {
});
test('sidebar is sorted alphabetically', async ({ page }) => {
await login(page);
await verifyCreateUser(page, { names: ['Zulu'] });
await verifyCreateUser(page, { names: ['Alfa'] });
await verifyCreateUser(page, { names: ['Golf'] });