Files
moreminimore-vibe/e2e-tests/copy_chat.spec.ts
Kunthawat Greethong d22227bb13 feat: implement fuzzy search and replace functionality with Levenshtein distance
- Added `applySearchReplace` function to handle search and replace operations with fuzzy matching capabilities.
- Introduced tests for various scenarios including fuzzy matching with typos, exact matches, and handling whitespace differences.
- Created a parser for search/replace blocks to facilitate the new functionality.
- Updated prompts for search-replace operations to clarify usage and examples.
- Added utility functions for text normalization and language detection based on file extensions.
- Implemented a minimal stdio MCP server for local testing with tools for adding numbers and printing environment variables.
2025-12-05 11:28:57 +07:00

72 lines
2.1 KiB
TypeScript

import { test } from "./helpers/test_helper";
import { expect } from "@playwright/test";
test("copy message content - basic functionality", async ({ po }) => {
await po.setUp({ autoApprove: true });
await po.importApp("minimal");
await po.sendPrompt("[dump] Just say hello without creating any files");
await po.page
.context()
.grantPermissions(["clipboard-read", "clipboard-write"]);
const copyButton = po.page.getByTestId("copy-message-button").first();
await copyButton.click();
const clipboardContent = await po.page.evaluate(() =>
navigator.clipboard.readText(),
);
// Test that copy functionality works
expect(clipboardContent.length).toBeGreaterThan(0);
expect(clipboardContent).not.toContain("<dyad-");
});
test("copy message content - dyad-write conversion", async ({ po }) => {
await po.setUp({ autoApprove: true });
await po.importApp("minimal");
await po.sendPrompt(
"Create a simple React component in src/components/Button.tsx",
);
await po.page
.context()
.grantPermissions(["clipboard-read", "clipboard-write"]);
const copyButton = po.page.getByTestId("copy-message-button").first();
await copyButton.click();
const clipboardContent = await po.page.evaluate(() =>
navigator.clipboard.readText(),
);
// Should convert dyad-write to markdown format (flexible path matching)
expect(clipboardContent).toContain("### File:");
expect(clipboardContent).toContain("```");
expect(clipboardContent).not.toContain("<dyad-write");
});
test("copy button tooltip states", async ({ po }) => {
await po.setUp({ autoApprove: true });
await po.importApp("minimal");
await po.sendPrompt("Say hello");
const copyButton = po.page.getByTestId("copy-message-button").first();
// Check initial tooltip
await copyButton.hover();
const tooltip = po.page.locator('[role="tooltip"]');
await expect(tooltip).toHaveText("Copy");
// Copy and check "Copied!" state
await po.page
.context()
.grantPermissions(["clipboard-read", "clipboard-write"]);
await copyButton.click();
await copyButton.hover();
await expect(tooltip).toHaveText("Copied!");
});