mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
* feat(daemon): add 'plan' session mode and update related functionality - Introduced a new session mode 'plan' alongside existing 'design' and 'chat' modes, allowing for editable document creation. - Updated various functions and interfaces to accommodate the new session mode, including normalization and usage in commands. - Enhanced markdown rendering capabilities by integrating micromark and its GFM extension for improved markdown processing. - Added new input types for question forms, expanding the range of user interactions. - Updated UI components to reflect changes in session modes and ensure proper handling of next steps based on the current mode. * feat(chat): integrate SessionModeToggle into ChatComposer and HomeHero - Added SessionModeToggle component to both ChatComposer and HomeHero for improved session management. - Updated HomeHero styles to accommodate the new mode switcher layout. - Adjusted countdown timer in QuestionsPanel to extend the skip countdown from 120 seconds to 10 minutes, enhancing user experience. - Added tests to ensure the countdown functionality works as expected. * feat(FileViewer): implement synchronized scrolling for Markdown editor and preview - Added functionality to synchronize scrolling between the Markdown editor and preview panes. - Introduced new types and utility functions for managing scroll behavior. - Enhanced the MarkdownViewer component to handle scroll events and maintain scroll position across different modes. - Updated the component's state management to accommodate the new scrolling features. * feat(excalidraw): integrate Excalidraw into the project - Added @excalidraw/excalidraw as a dependency in package.json. - Updated vitest configuration to include an alias for Excalidraw. - Imported Excalidraw CSS in the layout component for styling. - Modified AssistantMessage component to handle optional projectId. - Enhanced FileOpsSummary to display delete operations. - Implemented new Excalidraw scene management in SketchEditor and FileWorkspace components. - Updated MarkdownViewer to support file mentions and improved file handling. - Refactored various components to accommodate Excalidraw integration and ensure compatibility with existing features. * feat(files): improve sketch and file handoff flows * test: align post-merge expectations * chore(nix): refresh pnpm deps hash * fix(workspace): stabilize sketch persistence and ci checks * fix(workspace): address review blockers in editable files * fix(workspace): persist cleared sketch scenes * test(workspace): type sketch editor mock scene * fix(workspace): serialize sketch autosaves * fix(workspace): keep sketch save revisions current * test(e2e): stabilize project workspace smoke flows * fix(analytics): preserve plan mode for BYOK runs * test(e2e): stabilize new project rail interactions * fix(files): stop bash delete parsing at shell operators * test(e2e): stabilize ui cold-start suites * fix(viewer): preserve absolute markdown image sources * feat(workspace): preload sketches and enhance markdown save options - Added functionality to preload persisted sketches before opening the tab. - Introduced new MarkdownSaveOptions type to manage save behavior. - Updated saveMarkdownText to handle options for refreshing files and showing saving state. - Enhanced FileViewer to maintain focus and selection during metadata refresh. - Implemented a Toast component for user feedback on save and export actions. * fix(web): stabilize markdown and sketch editor polish * fix(web): finish sketch editor merge resolution * chore(nix): refresh pnpm deps hash * fix(plan): bypass discovery and stabilize markdown sync * fix(web): simplify scene retrieval in SketchEditor component * feat(web): enhance markdown viewer with auto-save functionality - Implemented passive auto-save status in the MarkdownViewer component, replacing the manual Save button with an auto-save indicator. - Introduced new hooks and state management for tracking auto-save events and displaying the last saved time. - Added support for synchronized scrolling between the markdown editor and preview. - Created a new markdown-scroll-sync module to handle scroll synchronization logic. - Updated localization files to include new strings for auto-save messages. - Added a SketchEnginePrewarm component to optimize Excalidraw loading times. * feat(web): enhance session mode toggle with cost indicators - Added cost tiers for each session mode in the SessionModeToggle component, providing users with a visual representation of usage costs. - Introduced a new ModeCostTag component to display cost information alongside session mode labels. - Updated localization files to include new keys for cost labels and notes. - Enhanced styling for cost indicators to improve user experience and clarity. - Refactored EntryShell to open the new project modal instead of creating a blank project directly from the rail. - Implemented a utility function in markdown-scroll-sync to check for vertical progression in block offsets. * feat(web): add max height adjustment for session mode description card - Introduced maxHeight prop to the ModeDescriptionCard component to control the height of the description card based on available space. - Implemented useLayoutEffect in SessionModeToggle to dynamically calculate and set the maximum height of the description card, ensuring it does not overlap with the project tab bar. - Updated tests to verify that session modes display their expected usage/cost correctly in the UI. - Enhanced localization files to include new cost-related strings for various languages. * feat(web): implement goBack function for improved navigation and update auto-open logic - Added a new `goBack` function to handle in-app navigation, allowing users to return to the previous route instead of a hardcoded destination. - Updated the `navigate` function to maintain history state for better back navigation. - Refactored auto-open logic to prioritize produced artifacts, allowing markdown files to be opened alongside HTML files. - Updated tests to cover new navigation behavior and artifact selection logic. - Enhanced localization files to include new descriptions for workspace actions. * refactor(web): remove create design system functionality and update design files panel actions - Removed the `onCreateDesignSystem` prop and associated button from the DesignFilesPanel component. - Updated the empty state actions to include a button for creating a new document via the `onPaste` function. - Adjusted tests to reflect the removal of the design system creation action and ensure the new document button is functional. - Enhanced the MarkdownViewer component by adding a placeholder for the text area and removing the header bar for a cleaner interface. - Updated localization files to include a new placeholder string for the markdown editor. * fix(web): restore markdown placeholder translations * refactor(web): streamline MarkdownViewer and enhance localization - Removed unnecessary state management and reload functionality from the MarkdownViewer component for improved performance. - Added a placeholder text for the markdown editor in multiple localization files to enhance user guidance. - Updated styles for the save state indicator in the viewer to improve visual clarity and alignment. - Adjusted tests to reflect changes in the MarkdownViewer and ensure proper functionality. * fix(web): adjust SketchEditor button size and remove shortcut hints - Reduced the icon size in the SketchEditor component from 13 to 12 for better alignment. - Updated the removeSketchMermaidShortcutHints function to also remove the submit shortcut hints from the dialog, enhancing the user interface by decluttering unnecessary elements. - Adjusted tests to verify the absence of shortcut hints in the modal after updates. * fix(web): address plan mode follow-up polish * fix(web): align ci expectations after merge * test(e2e): stabilize project workspace helpers * test(e2e): scale settings visual timeout * fix(prompts): lock ElevenLabs voice picker choices * test(e2e): pin project workspace P0 worker * test(e2e): use rail new project entry * test(e2e): relax app restoration startup waits * fix(web): limit markdown pipe escaping to tables --------- Co-authored-by: open-design-bot[bot] <282769551+open-design-bot[bot]@users.noreply.github.com> Co-authored-by: Amy <1184569493@qq.com>
208 lines
8.7 KiB
TypeScript
208 lines
8.7 KiB
TypeScript
import { expect, test } from '@/playwright/suite';
|
|
import { openNewProjectModal } from '@/playwright/rail';
|
|
import { T } from '@/timeouts';
|
|
import {
|
|
captureVisual,
|
|
captureVisualTarget,
|
|
configureVisualPage,
|
|
gotoVisualHome,
|
|
scrollVisualLocatorIntoStableView,
|
|
VISUAL_AMR_AGENT,
|
|
VISUAL_CLI_AGENTS,
|
|
waitForVisualFonts,
|
|
waitForVisualProjects,
|
|
} from '@/playwright/visual';
|
|
|
|
test('[P2] captures the onboarding cloud sign-in surface', async ({ page }) => {
|
|
test.setTimeout(T.xlong);
|
|
|
|
await configureVisualPage(page, {
|
|
projects: [],
|
|
agents: [VISUAL_AMR_AGENT, ...VISUAL_CLI_AGENTS],
|
|
config: {
|
|
onboardingCompleted: false,
|
|
},
|
|
});
|
|
|
|
await page.goto('/onboarding', { waitUntil: 'domcontentloaded' });
|
|
await page.getByText('Loading Open Design…').waitFor({ state: 'hidden', timeout: T.long });
|
|
// The connect step opens on the cloud sign-in landing. Local CLI and BYOK
|
|
// remain available as secondary paths from the same first screen.
|
|
await expect(
|
|
page.getByRole('heading', { name: /Sign in to Open Design|登录 Open Design/i }),
|
|
).toBeVisible({ timeout: T.medium });
|
|
await expect(
|
|
page.getByRole('button', { name: /Sign in to Open Design|登录 Open Design/i }),
|
|
).toBeVisible();
|
|
await expect(
|
|
page.getByRole('button', { name: /Local coding agent|本地 Coding Agent/i }),
|
|
).toBeVisible();
|
|
await expect(
|
|
page.getByRole('button', { name: /Bring your own key|自己的模型 Key/i }),
|
|
).toBeVisible();
|
|
await waitForVisualFonts(page);
|
|
|
|
await captureVisual(page, 'visual-onboarding-cloud');
|
|
});
|
|
|
|
test('[P2] captures the visual home harness', async ({ page }) => {
|
|
await configureVisualPage(page, { projects: [] });
|
|
await gotoVisualHome(page);
|
|
|
|
await expect(page.getByTestId('home-hero')).toBeVisible();
|
|
await expect(page.getByTestId('home-hero-input')).toBeVisible();
|
|
await waitForVisualProjects(page, []);
|
|
|
|
await captureVisual(page, 'visual-home');
|
|
});
|
|
|
|
test('[P2] captures the home plugin catalog surface', async ({ page }) => {
|
|
test.setTimeout(90_000);
|
|
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
// The redesigned entry shell keeps every view mounted (only the active one
|
|
// is visible) so tab switches don't reload thumbnails. That means
|
|
// `plugins-home-section` exists in both the home and plugins views, so
|
|
// scope the lookup to the home view to keep these strict-mode locators
|
|
// unambiguous.
|
|
const home = page.getByTestId('entry-view-home');
|
|
await expect(page.getByTestId('recent-projects-strip')).toBeVisible();
|
|
const community = home.getByTestId('plugins-home-section');
|
|
await expect(community).toBeVisible();
|
|
await scrollVisualLocatorIntoStableView(page, community);
|
|
await expect(home.locator('article.plugins-home__card--gallery').first()).toBeVisible();
|
|
await expect(home.getByTestId('plugins-home-search')).toBeVisible();
|
|
|
|
await captureVisual(page, 'visual-home-catalog');
|
|
});
|
|
|
|
test('[P2] captures the home plugin filtered surface', async ({ page }) => {
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
const home = page.getByTestId('entry-view-home');
|
|
await home.getByTestId('plugins-home-pill-category-deck').click();
|
|
await expect(home.locator('article.plugins-home__card[data-plugin-id="visual-deck-writer"]')).toBeVisible();
|
|
|
|
await captureVisual(page, 'visual-home-plugin-filter');
|
|
});
|
|
|
|
test('[P2] captures the home plugin detail surface', async ({ page }) => {
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
const home = page.getByTestId('entry-view-home');
|
|
await home.getByTestId('plugins-home-pill-category-deck').click();
|
|
const card = home.locator('article.plugins-home__card[data-plugin-id="visual-deck-writer"]');
|
|
await expect(card).toBeVisible();
|
|
await card.hover();
|
|
await home.getByTestId('plugins-home-details-visual-deck-writer').click({ force: true });
|
|
await expect(page.getByRole('dialog', { name: /Deck Writer preview/i })).toBeVisible();
|
|
await expect(page.getByTestId('plugin-details-use-visual-deck-writer')).toBeVisible();
|
|
await expect(page.locator('.ds-modal-stage-iframe-scaler iframe')).toBeVisible();
|
|
|
|
await captureVisual(page, 'visual-plugin-details');
|
|
});
|
|
|
|
test('[P2] captures the plugin detail share menu surface', async ({ page }) => {
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
const home = page.getByTestId('entry-view-home');
|
|
await home.getByTestId('plugins-home-pill-category-deck').click();
|
|
const card = home.locator('article.plugins-home__card[data-plugin-id="visual-deck-writer"]');
|
|
await expect(card).toBeVisible();
|
|
await card.hover();
|
|
await home.getByTestId('plugins-home-details-visual-deck-writer').click({ force: true });
|
|
await expect(page.getByRole('dialog', { name: /Deck Writer preview/i })).toBeVisible();
|
|
const trigger = page.locator('.template-share-trigger');
|
|
await trigger.click();
|
|
const popover = page.locator('.template-share-popover[role="menu"]');
|
|
await expect(popover).toBeVisible();
|
|
|
|
await captureVisual(page, 'visual-plugin-share-menu');
|
|
await captureVisualTarget(page, 'visual-plugin-share-menu-popover', [trigger, popover]);
|
|
});
|
|
|
|
test('[P2] captures the home context picker surface', async ({ page }) => {
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
await page.getByTestId('home-hero-input').fill('@visual');
|
|
const input = page.getByTestId('home-hero-input');
|
|
const picker = page.getByTestId('home-hero-plugin-picker');
|
|
await expect(picker).toBeVisible();
|
|
await expect(page.getByRole('option', { name: /Prototype Starter/i })).toBeVisible();
|
|
|
|
await captureVisual(page, 'visual-home-context-picker');
|
|
await captureVisualTarget(page, 'visual-home-context-picker-popover', [input, picker]);
|
|
});
|
|
|
|
test('[P2] captures the home staged attachment surface', async ({ page }) => {
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
await page.getByTestId('home-hero-file-input').setInputFiles({
|
|
name: 'visual-brief.txt',
|
|
mimeType: 'text/plain',
|
|
buffer: Buffer.from('Visual regression fixture for staged home attachments.\n', 'utf8'),
|
|
});
|
|
await expect(page.getByTestId('home-hero-staged-files')).toContainText('visual-brief.txt');
|
|
|
|
await captureVisual(page, 'visual-home-staged-attachment');
|
|
});
|
|
|
|
test('[P2] captures the home plugin use staged surface', async ({ page }) => {
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
const home = page.getByTestId('entry-view-home');
|
|
await home.getByTestId('plugins-home-details-visual-prototype-starter').click({ force: true });
|
|
await expect(page.getByRole('dialog', { name: /Prototype Starter details/i })).toBeVisible();
|
|
await page.getByTestId('plugin-details-use-visual-prototype-starter').click();
|
|
await expect(page.getByTestId('home-hero-active-plugin')).toContainText('Prototype Starter');
|
|
await expect(page.getByTestId('home-hero-input')).toBeVisible();
|
|
|
|
await captureVisual(page, 'visual-home-plugin-use-staged');
|
|
});
|
|
|
|
test('[P2] captures the home plugin use with query surface', async ({ page }) => {
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
const home = page.getByTestId('entry-view-home');
|
|
await home.getByTestId('plugins-home-pill-category-deck').click();
|
|
const card = home.locator('article.plugins-home__card[data-plugin-id="visual-deck-writer"]');
|
|
await expect(card).toBeVisible();
|
|
// Community gallery tiles carry no inline Use actions — use-with-query
|
|
// lives behind the detail modal's split Use button.
|
|
await home.getByTestId('plugins-home-details-visual-deck-writer').click({ force: true });
|
|
// Deck Writer ships a previewEntry, so its detail surface is the
|
|
// PreviewModal (aria-label "Deck Writer preview"), not the scenario
|
|
// detail's "... details" dialog. Match on the plugin name only.
|
|
await expect(page.getByRole('dialog', { name: /Deck Writer/i })).toBeVisible();
|
|
const trigger = page.getByTestId('plugin-details-use-visual-deck-writer-menu');
|
|
await trigger.click();
|
|
const menu = page.locator('.ds-modal-primary-action-popover[role="menu"]');
|
|
await expect(menu).toBeVisible();
|
|
await captureVisualTarget(page, 'visual-plugin-use-menu-popover', [trigger, menu]);
|
|
await page.getByTestId('plugin-details-use-with-query-visual-deck-writer').click();
|
|
// use-with-query now seeds the rendered preset text (placeholders filled in),
|
|
// not the raw `{{...}}` query — matching the example-prompt card path.
|
|
await expect(page.getByTestId('home-hero-input')).toContainText('Draft a topic deck.');
|
|
|
|
await captureVisual(page, 'visual-home-plugin-use-with-query');
|
|
});
|
|
|
|
test('[P2] captures the new project modal surface', async ({ page }) => {
|
|
await configureVisualPage(page);
|
|
await gotoVisualHome(page);
|
|
|
|
await openNewProjectModal(page);
|
|
await expect(page.getByTestId('new-project-name')).toBeVisible();
|
|
|
|
await captureVisual(page, 'visual-new-project-modal');
|
|
});
|