feat: inactive contacts hidden in sidebar

This commit is contained in:
Robert Perce 2026-04-03 16:03:16 -05:00
parent f75260c079
commit b079001cc5
7 changed files with 123 additions and 58 deletions

View file

@ -9,7 +9,7 @@ test.beforeEach(async ({ page }) => {
test('manual-freshen date is editable', async ({ page }) => {
await page.getByRole('link', { name: /edit/i }).click();
await expect(page.getByRole('textbox', { name: /freshened/i })).toBeVisible();
await expect(page.locator('input[name="manually_freshened_on"]')).toBeVisible();
});
test('last-contact date on display resolves journal mentions and manual-freshen', async ({ page }) => {
@ -38,7 +38,15 @@ test.skip("groups wrap nicely", async ({ page }) => {
});
test('allow marking as inactive', async ({ page }) => {
await page.getByRole('link', { name: /edit/i }).click();
await expect(page.locator('#alpine-loaded')).not.toHaveAttribute('x-cloak');
// TODO: this only works if there's no other comboboxes on the page :/
await page.getByRole('combobox').selectOption('Inactive')
await page.getByRole('button', { name: /save/i }).click();
await expect(page.locator('#alpine-loaded')).not.toHaveAttribute('x-cloak');
await expect(page.locator('#contacts-sidebar').getByText("Test Testerson")).not.toBeVisible();
});
test('allow exempting from stale', async ({ page }) => {
@ -50,7 +58,7 @@ test('stale list considers periodicity', async ({ page }) => {
});
test('page title has contact primary name', async ({ page }) => {
await expect(page.title()).toContain("Test Testerson");
expect(await page.title()).toContain("Test Testerson");
});

View file

@ -43,7 +43,6 @@ test("changing a contact's names updates journal entries", async ({ page }) => {
await page.getByRole('button', { name: 'Add' }).nth(1).click();
await page.getByRole('button', { name: /save/i }).click();
await page.getByRole('link', { name: 'Mascarpone' }).click();
console.log(await journal.innerHTML());
await expect.soft(journal.getByRole('link', { name: 'JC' })).toHaveCount(1);
// delete an existing name

View file

@ -1,72 +1,72 @@
import { defineConfig, devices } from '@playwright/test';
import 'custom-expects';
import './custom-expects';
// purposefully not using ??: we want to replace empty empty string with default
const BASE_URL = process.env.BASE_URL || 'http://localhost:3000';
let addlConfig = {
retries: process.env.CI ? 2 : 0,
retries: process.env.CI ? 2 : 0,
};
let projects = [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
/* Test against mobile viewports. */
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
/* Test against mobile viewports. */
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
},
];
const pfil = process.env.PROJECT_FILTER;
if (pfil) {
if (pfil.startsWith('!')) {
projects = projects.filter(p => p.name !== pfil.slice(1));
} else {
projects = projects.filter(p => p.name === pfil);
}
if (pfil.startsWith('!')) {
projects = projects.filter(p => p.name !== pfil.slice(1));
} else {
projects = projects.filter(p => p.name === pfil);
}
}
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './pages',
fullyParallel: true,
workers: 1,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: Boolean(process.env.CI),
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: BASE_URL,
testDir: './pages',
fullyParallel: true,
workers: 1,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: Boolean(process.env.CI),
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: BASE_URL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Configure projects for major browsers */
projects,
...addlConfig,
/* Configure projects for major browsers */
projects,
...addlConfig,
});