From be5a0a3947d927655ea80f10f003e60f0a16e851 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Nov 2026 00:30:24 -0300 Subject: [PATCH] Fix copy fallback, language picker, stepper navigation and headline hover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Copy: browsers that refuse the async clipboard (the Claude desktop browser denies its permission) did nothing visible; the error showed only at the top of the page. Copy now falls back to a selection copy, then selects the command and asks for ⌘C beside the button. - Language list: on Review and later views at widths up to 1050 px the hidden floating summary measured 0 x 0 and was taken as the bottom edge, so the list opened above the viewport. Hidden summaries are ignored and lists open above only with real room. - Flag: the trigger inherited space-between and sat 2 px off-centre. - Language names drop countries: English, Português, Español. - Stepper: steps are buttons for Choose, Review and the chosen route; the companion locks earlier steps during a run. - Headline: hover switched the gradient size instantly and snapped back; registered colour stops now glide for 900 ms, still under Calm. Verification: unit 22 + 21, format and catalogue checks; Playwright WebKit 34/34, Chromium and Firefox 27/27 on affected specs. The four new interface tests fail against main. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JBgAhZ6s45DnrKXbhbwYet --- CHANGELOG.md | 23 ++++ docs/COMPONENTS.md | 6 +- docs/LIQUID_INTERFACE.md | 9 +- docs/assets/app.mjs | 104 ++++++++++++++--- docs/assets/i18n.mjs | 6 +- docs/assets/liquid.css | 50 +++++--- docs/assets/messages.mjs | 14 +++ docs/assets/source-picker.mjs | 13 ++- docs/assets/style.css | 74 +++++++++--- docs/index.html | 28 ++++- tests/browser/interface.spec.mjs | 190 +++++++++++++++++++++++++++++++ tests/browser/languages.spec.mjs | 25 ++-- tests/browser/setup.spec.mjs | 10 +- 13 files changed, 474 insertions(+), 78 deletions(-) create mode 100644 tests/browser/interface.spec.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b68d6..844e1ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed — interface feedback + +- **Copy** did nothing in browsers that refuse the async clipboard (the Claude + desktop browser denies its permission), and the error appeared only at the + top of the page. Copy now falls back to a selection copy; if that is refused + too, it selects the command and says to press ⌘C beside the button. +- The language list opened above the viewport on Review and later views at + widths up to 1050 px: the hidden floating summary measured 0 × 0 and was + taken as the bottom edge. Hidden summaries no longer limit the list. +- The round flag sat 2 px off-centre in its circle; the trigger now centres it. +- Language names no longer carry countries: English, Português, Français, + Deutsch and Español. Translations remain en-GB, pt-BR, fr-FR, de-DE and es-ES. +- The headline's hover colour change switched the gradient size instantly and + snapped back. Registered colour stops now glide for 900 ms in and out, and + stay still under Calm or reduced motion. + +### Added — navigable stepper + +- Steps 1–3 are buttons: Choose, Review, and the chosen install route (the + handoff, without downloading, or the Homebrew command). The local companion + locks earlier steps while an installation runs and enables its progress step + once a run exists. + ### Added — Homebrew command route - Review now offers a choice: the existing **Guided setup** (plan download and diff --git a/docs/COMPONENTS.md b/docs/COMPONENTS.md index c46813f..dcf4140 100644 --- a/docs/COMPONENTS.md +++ b/docs/COMPONENTS.md @@ -17,8 +17,10 @@ exceptions in the component stylesheet. The motion layer must not override component radii. Comparable review panels share their inset and heading origin. Immediate feedback, elastic surface response and spatial transitions use the -shared quick/fast/slow duration and easing tokens. Ambient breathing and checkbox -stroke drawing retain their documented expressive timing. +shared quick/fast/slow duration and easing tokens. Ambient breathing, checkbox +stroke drawing and the 900 ms headline colour glide retain their documented +expressive timing. Stepper steps are buttons; the current one carries +`aria-current="step"`. Calm and system reduced motion override decoration. Disabled or busy actions suppress press/hover deformation and pointer sheen. Starting an installation sets `aria-busy`, disables duplicate activation, and clears busy state on success diff --git a/docs/LIQUID_INTERFACE.md b/docs/LIQUID_INTERFACE.md index 15d29a0..d90ccf6 100644 --- a/docs/LIQUID_INTERFACE.md +++ b/docs/LIQUID_INTERFACE.md @@ -84,10 +84,11 @@ retains canonical English text for reversible language changes. Longer phrases take precedence over broad interpolation templates; template slots are checked in the Node suite. Translated descriptions also participate in search. -The shared language picker uses project-local round flags with full language -names and native-language option labels. Flags are decorative; accessible names -identify languages independently. It supports the source picker's keyboard and -focus contract. English (UK) is the default. A choice is saved only in this +The shared language picker uses project-local round flags with native language +names and no country qualifiers (English, Português, Français, Deutsch, +Español); the translations remain en-GB, pt-BR, fr-FR, de-DE and es-ES. Flags +are decorative; accessible names identify languages independently. It supports +the source picker's keyboard and focus contract. British English is the default. A choice is saved only in this browser, under `mac-setup.locale.v1`, and applies to setup and Safety. App names, package tokens, plan IDs, commands, raw installer output, downloaded diff --git a/docs/assets/app.mjs b/docs/assets/app.mjs index 96cdf4c..3f3239f 100644 --- a/docs/assets/app.mjs +++ b/docs/assets/app.mjs @@ -77,6 +77,9 @@ let session = null; let token = ""; let pollTimer; let commands = { brew: "", appStore: "" }; +let currentView = "choose"; +let runState = "none"; // none | active | finished, for the local companion +let planDownloaded = false; let followupSignature = ""; let lastRunStatus = ""; let starting = false; @@ -525,13 +528,9 @@ function setView(view, moveFocus = true) { requestTranslation(); for (const name of ["choose", "review", "guide", "command", "progress"]) $(`${name}-view`).hidden = name !== view; - const step = view === "choose" ? 0 : view === "review" ? 1 : 2; + currentView = view; renderInstallStep(); - document.querySelectorAll(".stepper li").forEach((node, index) => { - node.classList.toggle("complete", index < step); - if (index === step) node.setAttribute("aria-current", "step"); - else node.removeAttribute("aria-current"); - }); + renderStepper(); const titles = { choose: [ "Make this ", @@ -658,6 +657,34 @@ function renderReviewActions() { renderInstallStep(); requestTranslation(); } +// Steps navigate like the Back buttons. A running installation locks the +// earlier steps, and the companion's progress step needs a run to show. +function renderStepper() { + const step = currentView === "choose" ? 0 : currentView === "review" ? 1 : 2; + document.querySelectorAll(".stepper li").forEach((node, index) => { + const link = node.querySelector(".step-link"); + node.classList.toggle("complete", index < step); + if (index === step) link.setAttribute("aria-current", "step"); + else link.removeAttribute("aria-current"); + link.disabled = + index < 2 + ? runState === "active" + : Boolean(session) && runState === "none"; + }); +} +function goToStep(step) { + if (step === "choose") setView("choose"); + else if (step === "review") renderReview(); + else if (session) setView("progress"); + else if (method === "homebrew") renderCommands(); + else showGuide(); +} +function showGuide() { + $("download-again").textContent = planDownloaded + ? "Download again" + : "Download plan"; + setView("guide"); +} function renderInstallStep() { $("install-step-label").textContent = !session && method === "homebrew" @@ -687,6 +714,8 @@ function renderCommands() { showCommand($("app-store-command"), result.appStoreCommand); for (const id of ["copy-brew-command", "copy-app-store-command"]) $(id).textContent = "Copy"; + for (const status of $("command-view").querySelectorAll(".copy-status")) + status.textContent = ""; $("not-included").hidden = result.notIncluded.length === 0; $("not-included-list").replaceChildren( ...result.notIncluded.map((item) => element("li", "", item.name)), @@ -704,19 +733,57 @@ function showCommand(node, command) { ]), ); } +// Some browsers refuse the async clipboard (embedded browsers deny its +// permission), so fall back to a selection copy, then to a manual ⌘C. +function copyWithSelection(text) { + const focused = document.activeElement; + const buffer = element("textarea", "copy-buffer"); + buffer.value = text; + buffer.readOnly = true; + buffer.tabIndex = -1; + buffer.setAttribute("aria-hidden", "true"); + document.body.append(buffer); + buffer.focus({ preventScroll: true }); + buffer.setSelectionRange(0, text.length); + let copied = false; + try { + copied = document.execCommand("copy"); + } catch { + copied = false; + } + buffer.remove(); + focused?.focus?.({ preventScroll: true }); + return copied; +} +async function copyText(text) { + if (navigator.clipboard?.writeText) { + try { + await navigator.clipboard.writeText(text); + return true; + } catch { + /* Fall back below. */ + } + } + return copyWithSelection(text); +} function bindCopy(button, text) { + const box = button.closest(".command-box"); + const status = element("p", "copy-status"); + status.setAttribute("role", "status"); + box.after(status); button.addEventListener("click", async () => { const value = oneLine(text()); if (!value) return; - try { - await navigator.clipboard.writeText(value); + status.textContent = ""; + if (await copyText(value)) { button.textContent = "Copied"; announce("Command copied. Paste it into Terminal and press Return."); - } catch { - showError( - "Clipboard access is unavailable. Select the command and copy it manually.", - ); + } else { + getSelection().selectAllChildren(box.querySelector("code")); + status.textContent = + "This browser blocked copying. The command is selected: press ⌘C."; } + requestTranslation(); }); } function download(content, name, type = "application/json") { @@ -730,6 +797,7 @@ function download(content, name, type = "application/json") { setTimeout(() => URL.revokeObjectURL(url), 1000); } function exportPlan() { + planDownloaded = true; download( JSON.stringify(createPlan(catalog, profile, selected), null, 2) + "\n", "mac-setup-plan.json", @@ -764,7 +832,7 @@ async function startInstallation() { return; } exportPlan(); - setView("guide"); + showGuide(); return; } if (!$("confirm-install").checked) { @@ -807,6 +875,8 @@ async function startInstallation() { } catch (error) { showError(error.message); $("continue-button").disabled = false; + runState = "none"; + renderStepper(); } finally { $("continue-button").removeAttribute("aria-busy"); starting = false; @@ -952,6 +1022,8 @@ function renderRun(run) { ? "Reports describe this run, including dry-run mode." : "Available when the run finishes."; $("new-plan").hidden = !finished; + runState = finished ? "finished" : "active"; + renderStepper(); if (lastRunStatus !== run.status) { announce($("progress-description").textContent); lastRunStatus = run.status; @@ -1029,6 +1101,11 @@ function bindEvents() { $("review-button").addEventListener("click", renderReview); $("back-button").addEventListener("click", () => setView("choose")); $("guide-back").addEventListener("click", renderReview); + for (const link of document.querySelectorAll(".step-link")) + link.addEventListener("click", () => { + if (link.getAttribute("aria-current") !== "step") + goToStep(link.dataset.step); + }); $("export-button").addEventListener("click", exportPlan); $("download-again").addEventListener("click", exportPlan); $("continue-button").addEventListener("click", startInstallation); @@ -1127,6 +1204,7 @@ async function init() { ); } bindEvents(); + renderStepper(); renderProfiles(); renderCategories(); renderSelection(); diff --git a/docs/assets/i18n.mjs b/docs/assets/i18n.mjs index ea72e0d..9226e91 100644 --- a/docs/assets/i18n.mjs +++ b/docs/assets/i18n.mjs @@ -1,11 +1,11 @@ import messages from "./messages.mjs"; export const LANGUAGES = [ - { id: "en-GB", name: "English (UK)", flag: "gb" }, - { id: "pt-BR", name: "Português (Brasil)", flag: "br" }, + { id: "en-GB", name: "English", flag: "gb" }, + { id: "pt-BR", name: "Português", flag: "br" }, { id: "fr-FR", name: "Français", flag: "fr" }, { id: "de-DE", name: "Deutsch", flag: "de" }, - { id: "es-ES", name: "Español (España)", flag: "es" }, + { id: "es-ES", name: "Español", flag: "es" }, ]; const normalise = (text) => text.replace(/\s+/g, " ").trim(); const dictionaries = new Map( diff --git a/docs/assets/liquid.css b/docs/assets/liquid.css index 215b3f2..e1e971d 100644 --- a/docs/assets/liquid.css +++ b/docs/assets/liquid.css @@ -4,6 +4,7 @@ --duration-fast: 250ms; --duration-slow: 400ms; --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1); + --ease-title: cubic-bezier(0.45, 0, 0.25, 1); --ease-liquid: cubic-bezier(0.2, 1.45, 0.4, 1); --modal-open-dur: var(--duration-fast); --modal-close-dur: var(--duration-quick); @@ -223,20 +224,43 @@ html[data-theme="light"] { ).has-scroll-elasticity { box-shadow: inset 0 var(--scroll-drift, 0px) 18px var(--tint); } -.gradient-text { - background-size: 100% 100%; +/* Hover shifts the title colours one place along the gradient. Registered + colour stops interpolate, so the change glides in and back out; browsers + without @property simply switch colours. Resting colours are unchanged. */ +@property --title-stop-1 { + syntax: ""; + inherits: false; + initial-value: transparent; } -.gradient-text:hover { - background-size: 240% 100%; - animation: gradient-flow 3.6s ease-in-out infinite alternate; +@property --title-stop-2 { + syntax: ""; + inherits: false; + initial-value: transparent; } -@keyframes gradient-flow { - from { - background-position: 0% 50%; - } - to { - background-position: 100% 50%; - } +@property --title-stop-3 { + syntax: ""; + inherits: false; + initial-value: transparent; +} +.gradient-text { + --title-stop-1: var(--title-1); + --title-stop-2: var(--title-2); + --title-stop-3: var(--title-3); + background-image: linear-gradient( + 115deg, + var(--title-stop-1), + var(--title-stop-2) 49%, + var(--title-stop-3) + ); + transition: + --title-stop-1 900ms var(--ease-title), + --title-stop-2 900ms var(--ease-title), + --title-stop-3 900ms var(--ease-title); +} +html:not([data-motion="reduced"]) .gradient-text:hover { + --title-stop-1: var(--title-2); + --title-stop-2: var(--title-3); + --title-stop-3: var(--title-1); } .primary-button::after, .secondary-button::after, @@ -411,7 +435,7 @@ html[data-motion="reduced"] .window-toolbar { transform: none; } html[data-motion="reduced"] .gradient-text { - background-size: 100% 100%; + transition: none; } html[data-motion="reduced"] .has-liquid-light::after { opacity: 0; diff --git a/docs/assets/messages.mjs b/docs/assets/messages.mjs index fd28cc5..221e09c 100644 --- a/docs/assets/messages.mjs +++ b/docs/assets/messages.mjs @@ -3199,4 +3199,18 @@ export default [ "Befehl kopiert. Füge ihn in Terminal ein und drücke die Eingabetaste.", "Comando copiado. Pégalo en Terminal y pulsa Intro.", ], + [ + "Download plan", + "Baixar plano", + "Télécharger le plan", + "Plan herunterladen", + "Descargar plan", + ], + [ + "This browser blocked copying. The command is selected: press ⌘C.", + "Este navegador bloqueou a cópia. O comando está selecionado: pressione ⌘C.", + "Ce navigateur a bloqué la copie. La commande est sélectionnée : appuyez sur ⌘C.", + "Dieser Browser hat das Kopieren blockiert. Der Befehl ist markiert: Drücke ⌘C.", + "Este navegador ha bloqueado la copia. El comando está seleccionado: pulsa ⌘C.", + ], ]; diff --git a/docs/assets/source-picker.mjs b/docs/assets/source-picker.mjs index 9225128..811ff84 100644 --- a/docs/assets/source-picker.mjs +++ b/docs/assets/source-picker.mjs @@ -64,17 +64,18 @@ export function createSourcePicker( }; function positionList() { const bounds = trigger.getBoundingClientRect(); + // The floating summary limits space only while it is shown: when hidden it + // measures 0 × 0 at the top, which once sent lists above the viewport. const summary = document.querySelector(".selection-column"); + const summaryBounds = summary?.getBoundingClientRect(); const bottom = - summary && getComputedStyle(summary).position === "fixed" - ? Math.min( - window.innerHeight - 16, - summary.getBoundingClientRect().top - 12, - ) + summaryBounds?.height && getComputedStyle(summary).position === "fixed" + ? Math.min(window.innerHeight - 16, summaryBounds.top - 12) : window.innerHeight - 16; const below = bottom - bounds.bottom; const above = bounds.top - 96; - const opensAbove = below < list.scrollHeight + 8 && above > below; + const opensAbove = + below < list.scrollHeight + 8 && above > Math.max(below, 90); list.dataset.side = opensAbove ? "above" : "below"; list.style.maxHeight = `${Math.max(90, (opensAbove ? above : below) - 12)}px`; } diff --git a/docs/assets/style.css b/docs/assets/style.css index c5cfa36..00344d5 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -34,7 +34,15 @@ --mint: #7ee8c7; --sky: #7fb5ff; --lilac: #c5a6ff; - --title-gradient: linear-gradient(115deg, #95efce, #91c5ff 49%, #c5a6ff); + --title-1: #95efce; + --title-2: #91c5ff; + --title-3: #c5a6ff; + --title-gradient: linear-gradient( + 115deg, + var(--title-1), + var(--title-2) 49%, + var(--title-3) + ); --accent-gradient: linear-gradient(110deg, #9ef3db, #94caff 56%, #c9b1ff); --rim: rgb(206 230 255 / 28%); --sheen: rgb(211 238 255 / 12%); @@ -64,7 +72,9 @@ html[data-theme="light"] { --green: #286540; --warn: #765018; --warn-bg: #fff5df; - --title-gradient: linear-gradient(115deg, #16795f, #255cc0 49%, #703db7); + --title-1: #16795f; + --title-2: #255cc0; + --title-3: #703db7; --rim: rgb(255 255 255 / 90%); --sheen: rgb(255 255 255 / 70%); --shadow: 0 18px 54px rgb(42 68 109 / 13%); @@ -440,16 +450,37 @@ input:disabled { position: relative; display: flex; align-items: center; - justify-content: center; - gap: 9px; - min-height: 42px; - padding: 6px 14px; border: 1px solid transparent; border-radius: var(--radius-panel); color: var(--muted); font-size: 12px; white-space: nowrap; flex: 1; + transition: + border-color var(--duration-fast) var(--ease-smooth-out), + color var(--duration-fast) var(--ease-smooth-out); +} +/* Each step is a real button, so it is reachable by pointer, touch and keyboard. */ +.step-link { + display: flex; + align-items: center; + justify-content: center; + gap: 9px; + width: 100%; + min-height: 42px; + padding: 6px 14px; + border: 0; + border-radius: inherit; + background: none; + font-weight: inherit; + white-space: inherit; +} +.step-link:focus-visible { + outline-offset: 3px; +} +.stepper li:not(:has(> [aria-current])):has(> .step-link:enabled):hover { + border-color: var(--border); + color: var(--ink); } .stepper li + li::before { content: ""; @@ -472,7 +503,7 @@ input:disabled { color: var(--muted); background: var(--surface-soft); } -.stepper li[aria-current] { +.stepper li:has(> [aria-current]) { color: var(--ink); font-weight: 600; border-color: var(--border); @@ -484,7 +515,7 @@ input:disabled { ); box-shadow: inset 0 1px 0 var(--sheen); } -.stepper li[aria-current] .step-number { +.stepper li:has(> [aria-current]) .step-number { background: var(--accent-gradient); border-color: transparent; color: #102a37; @@ -1529,6 +1560,20 @@ html[data-theme="light"] .catalog-panel { align-items: center; text-decoration: none; } +.copy-buffer { + position: fixed; + top: 0; + left: 0; + width: 1px; + height: 1px; + opacity: 0; + pointer-events: none; +} +.copy-status:not(:empty) { + margin-top: var(--space-2); + font-size: 12px; + color: var(--warn); +} .handoff-steps .command-meta { margin-top: var(--space-2); font-size: 12px; @@ -2177,16 +2222,18 @@ dialog::backdrop { margin-bottom: 16px; } .stepper li { - flex-direction: column; - gap: 5px; font-size: 9px; - padding: 7px 4px; - min-height: 66px; white-space: normal; text-align: center; border-radius: 19px; line-height: 1.35; } + .step-link { + flex-direction: column; + gap: 5px; + padding: 7px 4px; + min-height: 66px; + } .stepper li + li::before { display: none; } @@ -2957,9 +3004,10 @@ body:has(#choose-view[hidden]) #floating-summary-slot { min-width: 44px; width: 44px; height: 44px; - padding: 7px; + padding: 0; border-radius: 50%; gap: 0; + justify-content: center; } #language-trigger > svg { display: none; diff --git a/docs/index.html b/docs/index.html index 08e6e3a..e25993f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -100,16 +100,32 @@

    -
  1. - 1Choose & customise +
  2. +
  3. - 2Review your setup +
  4. - 3Guided installation +
diff --git a/tests/browser/interface.spec.mjs b/tests/browser/interface.spec.mjs new file mode 100644 index 0000000..5b9e824 --- /dev/null +++ b/tests/browser/interface.spec.mjs @@ -0,0 +1,190 @@ +import { test, expect } from "@playwright/test"; + +const waitForCatalogue = async (page) => + expect( + page.getByRole("radio", { name: "Essentials", exact: true }), + ).toBeVisible(); +const step = (page, name) => + page.locator(".stepper").getByRole("button", { name }); +const brew = + "brew install --formula mas; brew install --cask google-chrome appcleaner 1password vlc"; + +async function openHomebrewCommand(page) { + await page.getByRole("button", { name: "Review setup", exact: true }).click(); + await page + .getByRole("radio", { name: "Homebrew command", exact: true }) + .check(); + await page + .getByRole("button", { name: "Show Homebrew command", exact: true }) + .click(); +} + +test("Copy falls back when the clipboard API is refused, then selects the command for ⌘C", async ({ + page, +}) => { + // Embedded browsers can deny the async clipboard permission outright. + await page.addInitScript(() => { + window.copied = []; + window.selectionCopyWorks = true; + Object.defineProperty(navigator, "clipboard", { + value: { + writeText: () => + Promise.reject(new DOMException("Denied", "NotAllowedError")), + }, + }); + const execCommand = document.execCommand.bind(document); + document.execCommand = (command, ...rest) => { + if (command !== "copy") return execCommand(command, ...rest); + window.copied.push(document.activeElement?.value ?? ""); + return window.selectionCopyWorks; + }; + }); + await page.goto("/"); + await waitForCatalogue(page); + await openHomebrewCommand(page); + await page.locator("#copy-brew-command").focus(); + await page.keyboard.press("Enter"); + await expect(page.locator("#copy-brew-command")).toHaveText("Copied"); + await expect(page.locator("#copy-brew-command")).toBeFocused(); + expect(await page.evaluate(() => window.copied)).toEqual([brew]); + + await page.evaluate(() => { + window.selectionCopyWorks = false; + }); + await page.locator("#copy-app-store-command").click(); + await expect(page.locator("#copy-app-store-command")).toHaveText("Copy"); + await expect( + page.getByRole("status").filter({ hasText: "press ⌘C" }), + ).toBeVisible(); + expect(await page.evaluate(() => getSelection().toString())).toBe( + "mas get 425424353", + ); + await expect(page.locator("#app-error")).toBeHidden(); +}); + +test("the language picker centres its flag, names languages only and opens below on every view", async ({ + page, +}) => { + // At compact widths the summary floats; on later views it is hidden. + await page.setViewportSize({ width: 923, height: 932 }); + await page.goto("/"); + await waitForCatalogue(page); + const offset = await page.evaluate(() => { + const circle = document + .querySelector("#language-trigger") + .getBoundingClientRect(); + const flag = document + .querySelector("#language-trigger .language-flag") + .getBoundingClientRect(); + return [ + circle.x + circle.width / 2 - (flag.x + flag.width / 2), + circle.y + circle.height / 2 - (flag.y + flag.height / 2), + ]; + }); + for (const delta of offset) expect(Math.abs(delta)).toBeLessThan(0.51); + + const list = page.locator("#language-options"); + for (const view of ["choose", "review", "command"]) { + if (view === "review") + await page + .getByRole("button", { name: "Review setup", exact: true }) + .click(); + if (view === "command") { + await page + .getByRole("radio", { name: "Homebrew command", exact: true }) + .check(); + await page + .getByRole("button", { name: "Show Homebrew command", exact: true }) + .click(); + } + await page.locator("#language-trigger").click(); + await expect(list).toHaveAttribute("data-side", "below"); + await expect(list.getByRole("option")).toHaveText([ + "English", + "Português", + "Français", + "Deutsch", + "Español", + ]); + await expect + .poll(async () => { + const box = await list.boundingBox(); + return box.y >= 0 && box.y + box.height <= 932; + }) + .toBe(true); + await page.keyboard.press("Escape"); + await expect(list).not.toBeVisible(); + } + await page.locator("#language-trigger").click(); + await list.getByRole("option", { name: "Português", exact: true }).click(); + await expect(page.locator("html")).toHaveAttribute("lang", "pt-BR"); +}); + +test("stepper steps navigate between choices, review and the chosen route", async ({ + page, +}) => { + await page.goto("/"); + await waitForCatalogue(page); + await expect(step(page, /Choose & customise/)).toHaveAttribute( + "aria-current", + "step", + ); + await step(page, /Review your setup/).click(); + await expect(page.locator("#review-view")).toBeVisible(); + await expect(step(page, /Review your setup/)).toHaveAttribute( + "aria-current", + "step", + ); + + // The guided handoff opens without downloading; its button offers the plan. + let downloads = 0; + page.on("download", () => downloads++); + await step(page, /Guided installation/).click(); + await expect( + page.getByRole("heading", { name: "A small handoff to your Mac." }), + ).toBeVisible(); + await expect(page.locator("#download-again")).toHaveText("Download plan"); + expect(downloads).toBe(0); + + await step(page, /Review your setup/).focus(); + await page.keyboard.press("Enter"); + await expect(page.locator("#review-view")).toBeVisible(); + await page + .getByRole("radio", { name: "Homebrew command", exact: true }) + .check(); + await step(page, /Homebrew command/).click(); + await expect(page.locator("#command-view")).toBeVisible(); + await step(page, /Choose & customise/).click(); + await expect(page.locator("#choose-view")).toBeVisible(); + await expect(step(page, /Choose & customise/)).toHaveAttribute( + "aria-current", + "step", + ); +}); + +test("the headline gradient glides on hover and back, and stays still when motion is reduced", async ({ + page, +}) => { + await page.goto("/"); + await waitForCatalogue(page); + const title = page.locator("#page-title .gradient-text"); + const stop = () => + title.evaluate((node) => + getComputedStyle(node).getPropertyValue("--title-stop-1").trim(), + ); + const rest = await stop(); + await title.hover(); + await page.waitForTimeout(300); + const between = await stop(); + await page.waitForTimeout(1200); + const hovered = await stop(); + expect(hovered).not.toBe(rest); + expect([rest, hovered]).not.toContain(between); + await page.mouse.move(5, 5); + await expect.poll(stop, { timeout: 3000 }).toBe(rest); + + await page.emulateMedia({ reducedMotion: "reduce" }); + await title.hover(); + await page.waitForTimeout(300); + expect(await stop()).toBe(rest); +}); diff --git a/tests/browser/languages.spec.mjs b/tests/browser/languages.spec.mjs index 5533532..0591015 100644 --- a/tests/browser/languages.spec.mjs +++ b/tests/browser/languages.spec.mjs @@ -22,7 +22,7 @@ test("five languages keep choices and translate new renders at compact widths", }; for (const [name, id, heading, review] of [ [ - "Português (Brasil)", + "Português", "pt-BR", "Deixe este Mac com a sua cara.", "Revisar configuração", @@ -34,13 +34,8 @@ test("five languages keep choices and translate new renders at compact widths", "Mach diesen Mac zu deinem.", "Einrichtung überprüfen", ], - [ - "Español (España)", - "es-ES", - "Haz este Mac tuyo.", - "Revisar configuración", - ], - ["English (UK)", "en-GB", "Make this Mac yours.", "Review setup"], + ["Español", "es-ES", "Haz este Mac tuyo.", "Revisar configuración"], + ["English", "en-GB", "Make this Mac yours.", "Review setup"], ]) { await choose(name, id); await expect(page.locator("#page-title")).toHaveText(heading); @@ -93,7 +88,7 @@ test("language picker supports keyboard selection, translated search and Safety await page.keyboard.press("ArrowDown"); await page.keyboard.press("End"); await expect( - page.getByRole("option", { name: "Español (España)", exact: true }), + page.getByRole("option", { name: "Español", exact: true }), ).toBeFocused(); await page.keyboard.press("Enter"); await expect(page.locator("html")).toHaveAttribute("lang", "es-ES"); @@ -101,7 +96,7 @@ test("language picker supports keyboard selection, translated search and Safety await page.keyboard.press("Escape"); await expect(page.locator("#language-options")).not.toBeVisible(); await expect(page.locator("#language-trigger")).toBeFocused(); - await choose("Português (Brasil)", "pt-BR"); + await choose("Português", "pt-BR"); await expect( page.getByRole("button", { name: "Selecionar tudo em Desenvolvimento", @@ -115,11 +110,11 @@ test("language picker supports keyboard selection, translated search and Safety await expect( page.getByRole("checkbox", { name: "Docker Desktop", exact: true }), ).toBeVisible(); - await choose("English (UK)", "en-GB"); + await choose("English", "en-GB"); await expect( page.getByRole("checkbox", { name: "Docker Desktop", exact: true }), ).toHaveCount(0); - await choose("Português (Brasil)", "pt-BR"); + await choose("Português", "pt-BR"); await expect( page.getByRole("checkbox", { name: "Docker Desktop", exact: true }), ).toBeVisible(); @@ -160,11 +155,11 @@ test("language picker supports keyboard selection, translated search and Safety // Audit each locale independently so five full catalogue scans do not consume // the interaction journey's budget. Assertions and per-test deadlines stay intact. for (const [name, id] of [ - ["Português (Brasil)", "pt-BR"], + ["Português", "pt-BR"], ["Français", "fr-FR"], ["Deutsch", "de-DE"], - ["Español (España)", "es-ES"], - ["English (UK)", "en-GB"], + ["Español", "es-ES"], + ["English", "en-GB"], ]) { test(`${id} catalogue meets automated WCAG checks`, async ({ page }) => { await page.setViewportSize({ width: 932, height: 932 }); diff --git a/tests/browser/setup.spec.mjs b/tests/browser/setup.spec.mjs index 819e5ef..438c7b5 100644 --- a/tests/browser/setup.spec.mjs +++ b/tests/browser/setup.spec.mjs @@ -100,6 +100,11 @@ test("public plan download imports into the real companion and runs an isolated await page .getByRole("button", { name: "Start dry-run preview", exact: true }) .click(); + // Earlier steps stay locked while the installer runs. + const chooseStep = page + .locator(".stepper") + .getByRole("button", { name: /Choose & customise/ }); + await expect(chooseStep).toBeDisabled(); await expect( page .getByRole("region", { name: "Guided installation" }) @@ -107,6 +112,7 @@ test("public plan download imports into the real companion and runs an isolated exact: true, }), ).toBeVisible({ timeout: 40000 }); + await expect(chooseStep).toBeEnabled(); await expect( page.getByRole("heading", { name: "Figma MCP", exact: true }), ).toBeVisible(); @@ -356,9 +362,7 @@ test("the Homebrew command view fits a phone, passes WCAG checks and translates" } const command = await page.locator("#brew-command").textContent(); await page.locator("#language-trigger").click(); - await page - .getByRole("option", { name: "Português (Brasil)", exact: true }) - .click(); + await page.getByRole("option", { name: "Português", exact: true }).click(); await expect( page.getByRole("heading", { name: "Seu comando do Homebrew." }), ).toBeVisible();