Context window e2e (#324)
This commit is contained in:
27
e2e-tests/context_window.spec.ts
Normal file
27
e2e-tests/context_window.spec.ts
Normal 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
1
e2e-tests/fixtures/1.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
1
e2e-tests/fixtures/2.md
Normal file
1
e2e-tests/fixtures/2.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
2
|
||||||
1
e2e-tests/fixtures/3.md
Normal file
1
e2e-tests/fixtures/3.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3
|
||||||
1
e2e-tests/fixtures/4.md
Normal file
1
e2e-tests/fixtures/4.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
4
|
||||||
1
e2e-tests/fixtures/5.md
Normal file
1
e2e-tests/fixtures/5.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
5
|
||||||
1
e2e-tests/fixtures/6.md
Normal file
1
e2e-tests/fixtures/6.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
6
|
||||||
@@ -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") {
|
||||||
|
|||||||
@@ -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
|
||||||
1313
e2e-tests/snapshots/context_window.spec.ts_context-window-1.txt
Normal file
1313
e2e-tests/snapshots/context_window.spec.ts_context-window-1.txt
Normal file
File diff suppressed because it is too large
Load Diff
1321
e2e-tests/snapshots/context_window.spec.ts_context-window-2.txt
Normal file
1321
e2e-tests/snapshots/context_window.spec.ts_context-window-2.txt
Normal file
File diff suppressed because it is too large
Load Diff
1321
e2e-tests/snapshots/context_window.spec.ts_context-window-3.txt
Normal file
1321
e2e-tests/snapshots/context_window.spec.ts_context-window-3.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||||
|
}
|
||||||
1337
e2e-tests/snapshots/context_window.spec.ts_context-window-5.txt
Normal file
1337
e2e-tests/snapshots/context_window.spec.ts_context-window-5.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -27,5 +27,6 @@
|
|||||||
"@/*": ["./src/*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src", "e2e-tests"],
|
||||||
|
"exclude": ["e2e-tests/fixtures"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user