Unverified 提交 a36f6e1c authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

Fix E2E tests (#2520)

#skip-bb <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2520" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
上级 3cbcc6f0
...@@ -32,6 +32,6 @@ testSkipIfWindows( ...@@ -32,6 +32,6 @@ testSkipIfWindows(
await po.sendPrompt("[dump] hi"); await po.sendPrompt("[dump] hi");
await po.snapshotServerDump("all-messages"); await po.snapshotServerDump("all-messages");
// Snapshot the messages to capture the compaction summary + second response // Snapshot the messages to capture the compaction summary + second response
await po.snapshotMessages(); await po.snapshotMessages({ replaceDumpPath: true });
}, },
); );
...@@ -592,11 +592,9 @@ export class PageObject { ...@@ -592,11 +592,9 @@ export class PageObject {
replaceDumpPath = false, replaceDumpPath = false,
timeout, timeout,
}: { replaceDumpPath?: boolean; timeout?: number } = {}) { }: { replaceDumpPath?: boolean; timeout?: number } = {}) {
// Always scrub compaction backup paths — they contain system-specific // NOTE: once you have called this, you can NOT manipulate the UI anymore or React will break.
// temp directories and timestamps that change between runs. if (replaceDumpPath) {
// Also conditionally scrub dyad-dump-path placeholders. await this.page.evaluate(() => {
await this.page.evaluate(
({ replaceDumpPath }) => {
const messagesList = document.querySelector( const messagesList = document.querySelector(
"[data-testid=messages-list]", "[data-testid=messages-list]",
); );
...@@ -609,15 +607,13 @@ export class PageObject { ...@@ -609,15 +607,13 @@ export class PageObject {
/\.dyad\/chats\/\d+\/compaction-[^\s<"]+\.md/g, /\.dyad\/chats\/\d+\/compaction-[^\s<"]+\.md/g,
"[[compaction-backup-path]]", "[[compaction-backup-path]]",
); );
if (replaceDumpPath) {
messagesList.innerHTML = messagesList.innerHTML.replace( messagesList.innerHTML = messagesList.innerHTML.replace(
/\[\[dyad-dump-path=([^\]]+)\]\]/g, /\[\[dyad-dump-path=([^\]]+)\]\]/g,
"[[dyad-dump-path=*]]", "[[dyad-dump-path=*]]",
); );
} });
}, }
{ replaceDumpPath },
);
await expect(this.page.getByTestId("messages-list")).toMatchAriaSnapshot({ await expect(this.page.getByTestId("messages-list")).toMatchAriaSnapshot({
timeout, timeout,
}); });
......
...@@ -2,11 +2,17 @@ ...@@ -2,11 +2,17 @@
- paragraph: OK, I'm going to do some writing now... - paragraph: OK, I'm going to do some writing now...
- img - img
- text: Index.tsx - text: Index.tsx
- button "Edit":
- img
- img - img
- text: "src/pages/Index.tsx Summary: write-description" - text: "src/pages/Index.tsx Summary: write-description"
- paragraph: And it's done! - paragraph: And it's done!
- button "Copy":
- img
- img
- text: test-model
- img - img
- text: Approved - text: less than a minute ago
- button "Undo": - button "Undo":
- img - img
- button "Retry": - button "Retry":
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
- button "Copy Request ID": - button "Copy Request ID":
- img - img
- paragraph: "[dump] hi" - paragraph: "[dump] hi"
- paragraph: /\[\[dyad-dump-path=\/Users\/will\/Documents\/GitHub\/dyad-zero\/testing\/fake-llm-server\/dist\/generated\/\d+\.json\]\]/ - paragraph: "[[dyad-dump-path=*]]"
- button "Copy": - button "Copy":
- img - img
- img - img
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论