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

Context window e2e (#324)

上级 b8f74902
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();
});
......@@ -151,7 +151,7 @@ class PageObject {
// Find the dump path using regex
const dumpPathMatch = messagesListText?.match(
/\[\[dyad-dump-path=([^\]]+)\]\]/,
/.*\[\[dyad-dump-path=([^\]]+)\]\]/,
);
if (!dumpPathMatch) {
......@@ -161,8 +161,9 @@ class PageObject {
const dumpFilePath = dumpPathMatch[1];
// 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
const parsedDump = JSON.parse(dumpContent);
if (type === "request") {
......
- 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
\ No newline at end of file
{
"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
}
\ No newline at end of file
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论