diff --git a/e2e/design-v2-editor-targets.spec.ts b/e2e/design-v2-editor-targets.spec.ts new file mode 100644 index 00000000..7704c5a4 --- /dev/null +++ b/e2e/design-v2-editor-targets.spec.ts @@ -0,0 +1,67 @@ +import { test, expect } from '@playwright/test'; + +test.use({ + storageState: { + cookies: [], + origins: [ + { + origin: 'http://localhost:5173', + localStorage: [ + { name: 'hasVisited', value: 'true' }, + { name: 'isDesignV2Enabled', value: 'true' }, + ], + }, + ], + }, +}); + +test.describe('Design v2 editor targets', () => { + test('Deploy card provides all three editor options', async ({ page }) => { + await page.goto('/'); + + await expect(page.locator('.nd-rail')).toBeVisible({ + timeout: 30000, + }); + + // Enter the Design V2 workflow. + await page.locator('.nd-hero-actions button').first().click(); + + // Navigate directly to Deploy using the stepper. + const stepper = page.locator('.nd-stepper-cards'); + await expect(stepper).toBeVisible(); + + await stepper.getByRole('button', { name: /Deploy/ }).click(); + + // Verify the editor card and its three external links. + const card = page.getByRole('article', { + name: 'Open in an editor', + }); + + await expect(card).toBeVisible(); + + const targets = [ + { + label: 'VS Code for the Web', + href: 'https://vscode.dev/', + }, + { + label: 'Desktop VS Code', + href: 'https://code.visualstudio.com/download', + }, + { + label: 'Claude Code', + href: 'https://code.claude.com/docs/en/quickstart', + }, + ]; + + for (const target of targets) { + const link = card.getByRole('link', { + name: new RegExp(`^${target.label}`), + }); + + await expect(link).toBeVisible(); + await expect(link).toHaveAttribute('href', target.href); + await expect(link).toHaveAttribute('target', '_blank'); + } + }); +}); diff --git a/src/components/designV2/DeployView.tsx b/src/components/designV2/DeployView.tsx index 0f99b834..6aeedd68 100644 --- a/src/components/designV2/DeployView.tsx +++ b/src/components/designV2/DeployView.tsx @@ -219,18 +219,19 @@ export const DeployView = () => { {card.button} )} - {card.secondary && ( + {card.editorTargets?.map((target) => ( - )} + ))} ); diff --git a/src/components/designV2/constants.ts b/src/components/designV2/constants.ts index b7261904..de6f3cfc 100644 --- a/src/components/designV2/constants.ts +++ b/src/components/designV2/constants.ts @@ -22,6 +22,8 @@ export const URLS = { vscodeTutorial: "https://docs.accordproject.org/docs/tutorial-vscode/", apapDeploy: "https://docs.accordproject.org/docs/ref-apap/#deploy-a-template", vscodeDev: "https://vscode.dev/", + vscodeDownload: "https://code.visualstudio.com/download", + claudeCodeDocs: "https://code.claude.com/docs/en/quickstart", apapMcp: "https://docs.accordproject.org/docs/ref-apap/#mcp-support-experimental", templateLibrary: "https://templates.accordproject.org/", /** Where the "new design" banner sends people to report problems: the design v2 bug bash. */ @@ -502,7 +504,7 @@ export interface DeployCard { /** Which in-app action the button runs when there is no `href`. */ action?: "pdf" | "markdown" | "share" | "copy" | "archive" | "vscode"; /** A second, link-only button under the main one. */ - secondary?: { label: string; href: string }; + editorTargets?: readonly { label: string; href: string }[]; /** Toast shown when the action succeeds. */ done?: string; } @@ -579,18 +581,22 @@ export const DEPLOY = { done: "Template archive downloaded", }, { - title: "Open in vscode.dev", + title: "Open in an editor", icon: "vscode", description: - "Save the template as a folder on your computer and open it in VS Code for the Web to keep editing it there.", + "Save the template as a folder, then continue working with the editor or coding agent you prefer.", details: [ - "First save the folder, then open vscode.dev", - "There, choose File › Open Folder and pick the saved folder", - "Chrome or Edge — they can save folders", + "Save the folder, then choose one of the three editor options below", + "VS Code Web and desktop VS Code can open the saved folder", + "For Claude Code, install the CLI and run claude from the folder in a terminal", ], button: "1. Save as folder", action: "vscode", - secondary: { label: "2. Open vscode.dev", href: URLS.vscodeDev }, + editorTargets: [ + { label: "VS Code for the Web", href: URLS.vscodeDev }, + { label: "Desktop VS Code", href: URLS.vscodeDownload }, + { label: "Claude Code", href: URLS.claudeCodeDocs }, + ], }, { title: "Deploy to an APAP server", @@ -622,11 +628,11 @@ export const DEPLOY = { }, ] satisfies readonly DeployGroup[], failed: (title: string) => `${title} failed`, - /** Toasts for the vscode.dev card. */ + /** Toasts for the editor card. */ folderSaved: (folder: string) => - `Saved the template to “${folder}”. Now open vscode.dev, choose File › Open Folder and pick it.`, + `Saved the template to “${folder}”. Choose an editor below to continue.`, noFolderSupport: - "This browser can’t save folders, so the template was downloaded as a .cta (a zip). Unzip it, then open the folder in vscode.dev from Chrome or Edge, or in desktop VS Code.", + "This browser can’t save folders, so the template was downloaded as a .cta archive. Unzip it, then open the folder in VS Code Web or desktop VS Code, or open a terminal in it and run claude after installing Claude Code.", renderError: "The agreement doesn’t render with the current text, model and data — fix the error and try again.", } as const; diff --git a/src/tests/components/designV2/DeployView.test.tsx b/src/tests/components/designV2/DeployView.test.tsx index 806533e0..42fc72d7 100644 --- a/src/tests/components/designV2/DeployView.test.tsx +++ b/src/tests/components/designV2/DeployView.test.tsx @@ -290,7 +290,7 @@ describe('DeployView', () => { expect(writeText).not.toHaveBeenCalled(); }, 30_000); - describe('Open in vscode.dev', () => { + describe('Open in an editor', () => { const files: string[] = []; const dir = (name: string): DirectoryHandle => ({ name, @@ -331,13 +331,15 @@ describe('DeployView', () => { // Synchronously from the click, before the archive is built (user activation). expect(picker).toHaveBeenCalledTimes(1); await waitFor(() => expect(success).toHaveBeenCalled(), SLOW); - // vscode.dev is the card's own link, not a pop-up after the save. + // Editor targets are links, not pop-ups after the save. expect(open).not.toHaveBeenCalled(); success.mockRestore(); expect(files).toEqual(expect.arrayContaining([ 'Documents/my-template/package.json', 'Documents/my-template/text/grammar.tem.md', 'Documents/my-template/model/model.cto', + 'Documents/my-template/AGENTS.md', + 'Documents/my-template/.vscode/extensions.json', ])); }, 30_000); @@ -410,11 +412,19 @@ describe('DeployView', () => { error.mockRestore(); }, 30_000); - it('also links straight to vscode.dev', () => { + it('provides links to all three editor targets', () => { render(); - const link = within(screen.getByRole('article', { name: 'Open in vscode.dev' })).getByRole('link', { name: /^2\. Open vscode\.dev/ }); - expect(link).toHaveAttribute('href', URLS.vscodeDev); - expect(link).toHaveAttribute('target', '_blank'); + const card = within(screen.getByRole('article', { name: 'Open in an editor' })); + const targets = [ + { label: 'VS Code for the Web', href: URLS.vscodeDev }, + { label: 'Desktop VS Code', href: URLS.vscodeDownload }, + { label: 'Claude Code', href: URLS.claudeCodeDocs }, + ]; + for (const target of targets) { + const link = card.getByRole('link', { name: new RegExp(`^${target.label}`) }); + expect(link).toHaveAttribute('href', target.href); + expect(link).toHaveAttribute('target', '_blank'); + } }); });