import { expect, test } from "@playwright/test"; import { newProjectButton } from "./product-journeys/project-context-flow.js"; import { storyArtifactDownloadLink } from "./story-artifact.js"; const id = "11111111-2222-4333-8444-555555555555"; test("finds the attachment download link in legacy and Artifacts V1 markup only", async ({ page }) => { const markup = { legacy: `Download`, // Artifacts V1: an icon-only "Open raw" link precedes the icon-only download link. v1: `slugify.zip` + ``, none: `Open` + `Download`, }; for (const kind of ["legacy", "v1"] as const) { await page.setContent(markup[kind]); await expect(storyArtifactDownloadLink(page, id)).toHaveAttribute("href", `/api/attachments/${id}/content?download=1`); } await page.setContent(markup.none); await expect(storyArtifactDownloadLink(page, id)).toHaveCount(0); }); test("opens new-project creation with the previous or current toolbar label only", async ({ page }) => { for (const label of ["Add Project", "Create project"]) { await page.setContent(``); await expect(newProjectButton(page)).toHaveText(label); } await page.setContent(``); await expect(newProjectButton(page)).toHaveCount(0); });