fix: manually-freshened-at date overwritten
This commit is contained in:
parent
b079001cc5
commit
5866c94535
4 changed files with 47 additions and 21 deletions
10
e2e/Taskfile
10
e2e/Taskfile
|
|
@ -10,20 +10,12 @@ playwright:local() {
|
|||
exec docker run \
|
||||
--interactive --tty --rm --ipc=host --net=host \
|
||||
--volume "$SCRIPT_DIR":/e2e:rw --env BASE_URL="$BASE_URL" \
|
||||
--env ASTRO_TELEMETRY_DISABLED=1 \
|
||||
"mcr.microsoft.com/playwright:$(_playwright_version)" \
|
||||
bash -c "cd /e2e && env PROJECT_FILTER=firefox ./Taskfile _test $*"
|
||||
}
|
||||
|
||||
playwright:ui() {
|
||||
xhost +local:docker
|
||||
exec docker run \
|
||||
--interactive --tty --rm --ipc=host --net=host\
|
||||
--env DISPLAY="$DISPLAY" \
|
||||
--volume /tmp/.X11-unix:/tmp/.X11-unix \
|
||||
--volume "$SCRIPT_DIR":/e2e:rw --env BASE_URL="$BASE_URL" \
|
||||
"mcr.microsoft.com/playwright:$(_playwright_version)" \
|
||||
/bin/bash -c "cd /e2e && ./Taskfile _test --ui $*"
|
||||
playwright:local --ui-host=0.0.0.0
|
||||
}
|
||||
|
||||
playwright:ci() {
|
||||
|
|
|
|||
|
|
@ -41,23 +41,52 @@ 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.getByLabel('status').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 }) => {
|
||||
await page.goto('/');
|
||||
await expect(page.locator('#freshness')).toContainText('Test Testersonnever');
|
||||
await page.locator('#freshness').getByRole('link', { name: /testerson/i }).click();
|
||||
await page.getByRole('link', { name: /edit/i }).click();
|
||||
|
||||
await page.getByLabel('status').selectOption('Cannot go stale');
|
||||
await page.getByRole('button', { name: /save/i }).click();
|
||||
await page.goto('/');
|
||||
await expect(page.locator('#freshness')).not.toContainText('Test Testersonnever');
|
||||
});
|
||||
|
||||
test('stale list considers periodicity', async ({ page }) => {
|
||||
await page.getByRole('link', { name: /edit/i }).click();
|
||||
const last_week = (() => {
|
||||
let last_week = new Date();
|
||||
last_week.setDate(last_week.getDate() - 7);
|
||||
return last_week.toISOString().split("T")[0];
|
||||
})();
|
||||
await page.getByLabel('freshened').fill(last_week);
|
||||
await page.getByRole('button', { name: /save/i }).click();
|
||||
await expect(page.locator('#journal')).toBeVisible();
|
||||
await expect(page.locator('#fields')).toContainText(`freshened${last_week}`);
|
||||
|
||||
await page.goto('/');
|
||||
await expect(page.locator('#freshness')).toContainText(`Test Testerson${last_week}7d`);
|
||||
await page.locator('#freshness').getByRole('link', { name: /testerson/i }).click();
|
||||
await page.getByRole('link', { name: /edit/i }).click();
|
||||
|
||||
await page.getByLabel('minimum stale time').fill('2 weeks');
|
||||
await page.getByRole('button', { name: /save/i }).click();
|
||||
await expect(page.locator('#journal')).toBeVisible();
|
||||
|
||||
await page.goto('/');
|
||||
await expect(page.locator('#freshness')).not.toContainText(`Test Testerson`);
|
||||
});
|
||||
|
||||
test('page title has contact primary name', async ({ page }) => {
|
||||
// wait for page load to finish
|
||||
await expect(page.locator('#journal')).toBeVisible();
|
||||
expect(await page.title()).toContain("Test Testerson");
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue