Context window e2e (#324)

This commit is contained in:
Will Chen
2025-06-03 21:30:36 -07:00
committed by GitHub
parent b8f7490288
commit 7994b01aa8
15 changed files with 5360 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
import { test } from "./helpers/test_helper";
test("context window", async ({ po }) => {
await po.setUp();
await po.sendPrompt("tc=1");
await po.sendPrompt("tc=2");
await po.sendPrompt("[dump] tc=3");
await po.snapshotServerDump();
await po.sendPrompt("[dump] tc=4");
await po.snapshotServerDump();
await po.sendPrompt("[dump] tc=5");
await po.snapshotServerDump();
await po.goToSettingsTab();
await po.page
.getByRole("combobox", { name: "Maximum number of chat turns" })
.click();
await po.page.getByRole("option", { name: "Plus (5)" }).click();
// close combobox
// await po.page.keyboard.press("Escape");
await po.snapshotSettings();
await po.page.getByText("Go Back").click();
await po.sendPrompt("[dump] tc=6");
await po.snapshotServerDump();
});

1
e2e-tests/fixtures/1.md Normal file
View File

@@ -0,0 +1 @@
1

1
e2e-tests/fixtures/2.md Normal file
View File

@@ -0,0 +1 @@
2

1
e2e-tests/fixtures/3.md Normal file
View File

@@ -0,0 +1 @@
3

1
e2e-tests/fixtures/4.md Normal file
View File

@@ -0,0 +1 @@
4

1
e2e-tests/fixtures/5.md Normal file
View File

@@ -0,0 +1 @@
5

1
e2e-tests/fixtures/6.md Normal file
View File

@@ -0,0 +1 @@
6

View File

@@ -151,7 +151,7 @@ class PageObject {
// Find the dump path using regex // Find the dump path using regex
const dumpPathMatch = messagesListText?.match( const dumpPathMatch = messagesListText?.match(
/\[\[dyad-dump-path=([^\]]+)\]\]/, /.*\[\[dyad-dump-path=([^\]]+)\]\]/,
); );
if (!dumpPathMatch) { if (!dumpPathMatch) {
@@ -161,8 +161,9 @@ class PageObject {
const dumpFilePath = dumpPathMatch[1]; const dumpFilePath = dumpPathMatch[1];
// Read the JSON file // Read the JSON file
const dumpContent = fs.readFileSync(dumpFilePath, "utf-8"); const dumpContent: string = (
fs.readFileSync(dumpFilePath, "utf-8") as any
).replaceAll(/\[\[dyad-dump-path=([^\]]+)\]\]/g, "[[dyad-dump-path=*]]");
// Perform snapshot comparison // Perform snapshot comparison
const parsedDump = JSON.parse(dumpContent); const parsedDump = JSON.parse(dumpContent);
if (type === "request") { if (type === "request") {

View File

@@ -0,0 +1,12 @@
- paragraph: tc=1
- paragraph: "1"
- paragraph: tc=2
- paragraph: "2"
- paragraph: "[dump] tc=3"
- paragraph: /\[\[dyad-dump-path=\/Users\/will\/Documents\/GitHub\/dyad-zero\/testing\/fake-llm-server\/dist\/generated\/\d+\.json\]\]/
- paragraph: "[dump] tc=4"
- paragraph: /\[\[dyad-dump-path=\/Users\/will\/Documents\/GitHub\/dyad-zero\/testing\/fake-llm-server\/dist\/generated\/\d+\.json\]\]/
- paragraph: "[dump] tc=5"
- paragraph: /\[\[dyad-dump-path=\/Users\/will\/Documents\/GitHub\/dyad-zero\/testing\/fake-llm-server\/dist\/generated\/\d+\.json\]\]/
- button "Retry":
- img

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
{
"selectedModel": {
"name": "test-model",
"provider": "custom::testing",
"customModelId": 1
},
"providerSettings": {},
"telemetryConsent": "unset",
"telemetryUserId": "[UUID]",
"hasRunBefore": true,
"experiments": {},
"lastShownReleaseNotesVersion": "0.8.0",
"maxChatTurnsInContext": 5,
"enableProLazyEditsMode": true,
"enableProSmartFilesContextMode": true,
"isTestMode": true
}

File diff suppressed because it is too large Load Diff

View File

@@ -27,5 +27,6 @@
"@/*": ["./src/*"] "@/*": ["./src/*"]
} }
}, },
"include": ["src"] "include": ["src", "e2e-tests"],
"exclude": ["e2e-tests/fixtures"]
} }