Files
paseo/packages/website/e2e/changelog.spec.ts
T
Mohamed Boudra eda939b092 feat(changelog): lead each release with highlights and fold the rest away
A release entry now opens with a short list of highlights above its first
section. The What's new sheet, the website changelog and the GitHub release
body show those and keep the sections, the full record, behind one control,
so a 100-bullet release reads as ten lines.

CHANGELOG.md stays plain Markdown because the app and the website render it
without HTML, including apps already installed. Each surface folds the
sections itself; only the release body gets a <details> block, written by
Release Notes Sync. A release with nothing before its first section shows
its sections as before.

Adds the 0.16.0-beta.1 entry in the new format, with its Chinese
translation, and the highlight writing rules in docs/release.md.
2026-11-10 09:57:12 +01:00

70 lines
2.6 KiB
TypeScript

import { expect, test, type Locator, type Page } from "./fixtures";
// The page renders the repository's CHANGELOG.md, so releases are found by shape, never by version:
// a release with highlights has the toggle, a release without them does not.
function releases(page: Page): Locator {
return page.getByRole("region");
}
function releaseWithHighlights(page: Page): Locator {
return releases(page)
.filter({ has: page.getByText("Show all changes", { exact: true }) })
.first();
}
function releaseWithoutHighlights(page: Page): Locator {
return releases(page)
.filter({ hasNot: page.getByText(/^(Show|Hide) all changes$/) })
.first();
}
function sectionHeadings(release: Locator): Locator {
return release.getByRole("heading", { level: 4 });
}
async function showAllChanges(release: Locator): Promise<void> {
await release.getByText("Show all changes", { exact: true }).click();
await expect(release.getByText("Hide all changes", { exact: true })).toBeVisible();
}
async function hideAllChanges(release: Locator): Promise<void> {
await release.getByText("Hide all changes", { exact: true }).click();
await expect(release.getByText("Show all changes", { exact: true })).toBeVisible();
}
test("shows each release's highlights and opens its sections on request", async ({ page }) => {
await page.goto("/changelog");
const highlighted = releaseWithHighlights(page);
const plain = releaseWithoutHighlights(page);
await test.step("tucks away the sections of a release with highlights", async () => {
await expect(highlighted.getByRole("listitem").first()).toBeVisible();
await expect(sectionHeadings(highlighted)).toHaveCount(0);
});
await test.step("opens and closes them again", async () => {
await showAllChanges(highlighted);
await expect(sectionHeadings(highlighted).first()).toBeVisible();
await hideAllChanges(highlighted);
await expect(sectionHeadings(highlighted)).toHaveCount(0);
});
await test.step("shows a release without highlights whole", async () => {
await expect(sectionHeadings(plain).first()).toBeVisible();
});
});
test("opens a release from a deep link with its highlights in view", async ({ page }) => {
await page.goto("/changelog");
const anchor = await releaseWithHighlights(page)
.getByRole("link", { name: /^Link to Paseo / })
.getAttribute("href");
await page.goto(`/changelog${anchor}`);
const linked = page.locator(`[id="${anchor!.slice(1)}"]`);
await expect(linked).toBeInViewport();
await expect(releaseWithHighlights(page).getByRole("listitem").first()).toBeVisible();
});