Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
c227a08d
Unverified
提交
c227a08d
authored
6月 03, 2025
作者:
Will Chen
提交者:
GitHub
6月 03, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Gateway e2e (#323)
上级
fc1ebe9e
全部展开
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
48 行增加
和
12 行删除
+48
-12
attach_image.spec.ts
e2e-tests/attach_image.spec.ts
+8
-3
engine.spec.ts
e2e-tests/engine.spec.ts
+18
-0
gateway-simple.md
e2e-tests/fixtures/gateway/gateway-simple.md
+1
-0
test_helper.ts
e2e-tests/helpers/test_helper.ts
+4
-2
attach_image.spec.ts_attach-image
e2e-tests/snapshots/attach_image.spec.ts_attach-image
+0
-0
dump_messages.spec.ts_dump-messages-1.txt
...tests/snapshots/dump_messages.spec.ts_dump-messages-1.txt
+0
-0
engine.spec.ts_auto-should-send-message-to-gateway-1.aria.yml
...ne.spec.ts_auto-should-send-message-to-gateway-1.aria.yml
+5
-0
engine.spec.ts_auto-should-send-message-to-gateway-1.txt
.../engine.spec.ts_auto-should-send-message-to-gateway-1.txt
+0
-0
engine.spec.ts_send-message-to-engine-1.txt
...sts/snapshots/engine.spec.ts_send-message-to-engine-1.txt
+0
-0
engine.spec.ts_send-message-to-gateway-1.aria.yml
...apshots/engine.spec.ts_send-message-to-gateway-1.aria.yml
+5
-0
engine.spec.ts_send-message-to-gateway-1.txt
...ts/snapshots/engine.spec.ts_send-message-to-gateway-1.txt
+0
-0
engine.spec.ts_server-dump.txt
e2e-tests/snapshots/engine.spec.ts_server-dump.txt
+0
-0
import.spec.ts_import-app-with-AI-rules-1.txt
...s/snapshots/import.spec.ts_import-app-with-AI-rules-1.txt
+0
-0
index.ts
testing/fake-llm-server/index.ts
+7
-7
没有找到文件。
e2e-tests/attach_image.spec.ts
浏览文件 @
c227a08d
import
{
test
}
from
"./helpers/test_helper"
;
import
*
as
fs
from
"fs"
;
// It's hard to read the snapshots, but they should be identical across
// all test cases in this file, so we use the same snapshot name to ensure
// the outputs are identical.
const
SNAPSHOT_NAME
=
"attach-image"
;
// attach image is implemented in two separate components
// - HomeChatInput
// - ChatInput
...
...
@@ -13,7 +18,7 @@ test("attach image - home chat", async ({ po }) => {
.
locator
(
"input[type='file']"
)
.
setInputFiles
(
"e2e-tests/fixtures/images/logo.png"
);
await
po
.
sendPrompt
(
"[dump]"
);
await
po
.
snapshotServerDump
(
"last-message"
);
await
po
.
snapshotServerDump
(
"last-message"
,
{
name
:
SNAPSHOT_NAME
}
);
await
po
.
snapshotMessages
({
replaceDumpPath
:
true
});
});
...
...
@@ -27,7 +32,7 @@ test("attach image - chat", async ({ po }) => {
.
locator
(
"input[type='file']"
)
.
setInputFiles
(
"e2e-tests/fixtures/images/logo.png"
);
await
po
.
sendPrompt
(
"[dump]"
);
await
po
.
snapshotServerDump
(
"last-message"
);
await
po
.
snapshotServerDump
(
"last-message"
,
{
name
:
SNAPSHOT_NAME
}
);
await
po
.
snapshotMessages
({
replaceDumpPath
:
true
});
});
...
...
@@ -65,6 +70,6 @@ test("attach image via drag - chat", async ({ po }) => {
// submit and verify
await
po
.
sendPrompt
(
"[dump]"
);
// Note: this should match EXACTLY the server dump from the previous test.
await
po
.
snapshotServerDump
(
"last-message"
);
await
po
.
snapshotServerDump
(
"last-message"
,
{
name
:
SNAPSHOT_NAME
}
);
await
po
.
snapshotMessages
({
replaceDumpPath
:
true
});
});
e2e-tests/engine.spec.ts
浏览文件 @
c227a08d
...
...
@@ -10,3 +10,21 @@ test("send message to engine", async ({ po }) => {
await
po
.
snapshotServerDump
(
"request"
);
await
po
.
snapshotMessages
({
replaceDumpPath
:
true
});
});
test
(
"send message to gateway"
,
async
({
po
})
=>
{
await
po
.
setUpDyadPro
();
await
po
.
selectModel
({
provider
:
"Google"
,
model
:
"Gemini 2.5 Flash"
});
await
po
.
sendPrompt
(
"[dump] tc=gateway-simple"
);
await
po
.
snapshotServerDump
(
"request"
);
await
po
.
snapshotMessages
({
replaceDumpPath
:
true
});
});
// auto (defaults to Gemini 2.5 Flash)
test
(
"auto should send message to gateway"
,
async
({
po
})
=>
{
await
po
.
setUpDyadPro
();
await
po
.
sendPrompt
(
"[dump] tc=gateway-simple"
);
await
po
.
snapshotServerDump
(
"request"
);
await
po
.
snapshotMessages
({
replaceDumpPath
:
true
});
});
e2e-tests/fixtures/gateway/gateway-simple.md
0 → 100644
浏览文件 @
c227a08d
Simple-response-from-gateway
e2e-tests/helpers/test_helper.ts
浏览文件 @
c227a08d
...
...
@@ -141,6 +141,7 @@ class PageObject {
async
snapshotServerDump
(
type
:
"all-messages"
|
"last-message"
|
"request"
=
"all-messages"
,
{
name
=
""
}:
{
name
?:
string
}
=
{},
)
{
// Get the text content of the messages list
const
messagesListText
=
await
this
.
page
...
...
@@ -164,14 +165,14 @@ class PageObject {
// Perform snapshot comparison
const
parsedDump
=
JSON
.
parse
(
dumpContent
);
if
(
type
===
"request"
)
{
expect
(
dumpContent
).
toMatchSnapshot
(
"server-dump-request.json"
);
expect
(
dumpContent
).
toMatchSnapshot
(
name
);
return
;
}
expect
(
prettifyDump
(
parsedDump
[
"body"
][
"messages"
],
{
onlyLastMessage
:
type
===
"last-message"
,
}),
).
toMatchSnapshot
(
"server-dump.txt"
);
).
toMatchSnapshot
(
name
);
}
async
waitForChatCompletion
()
{
...
...
@@ -473,6 +474,7 @@ export const test = base.extend<{
process
.
env
.
LM_STUDIO_BASE_URL_FOR_TESTING
=
"http://localhost:3500/lmstudio"
;
process
.
env
.
DYAD_LOCAL_ENGINE
=
"http://localhost:3500/engine/v1"
;
process
.
env
.
DYAD_GATEWAY_URL
=
"http://localhost:3500/gateway/v1"
;
process
.
env
.
E2E_TEST_BUILD
=
"true"
;
// This is just a hack to avoid the AI setup screen.
process
.
env
.
OPENAI_API_KEY
=
"sk-test"
;
...
...
e2e-tests/snapshots/attach_image.spec.ts_
server-dump.txt
→
e2e-tests/snapshots/attach_image.spec.ts_
attach-image
浏览文件 @
c227a08d
File moved
e2e-tests/snapshots/dump_messages.spec.ts_
server-dump
.txt
→
e2e-tests/snapshots/dump_messages.spec.ts_
dump-messages-1
.txt
浏览文件 @
c227a08d
File moved
e2e-tests/snapshots/engine.spec.ts_auto-should-send-message-to-gateway-1.aria.yml
0 → 100644
浏览文件 @
c227a08d
-
paragraph
:
"
[dump]
tc=gateway-simple"
-
paragraph
:
"
[[dyad-dump-path=*]]"
-
button "Retry"
:
-
img
\ No newline at end of file
e2e-tests/snapshots/engine.spec.ts_auto-should-send-message-to-gateway-1.txt
0 → 100644
浏览文件 @
c227a08d
差异被折叠。
点击展开。
e2e-tests/snapshots/engine.spec.ts_se
rver-dump-request.json
→
e2e-tests/snapshots/engine.spec.ts_se
nd-message-to-engine-1.txt
浏览文件 @
c227a08d
File moved
e2e-tests/snapshots/engine.spec.ts_send-message-to-gateway-1.aria.yml
0 → 100644
浏览文件 @
c227a08d
-
paragraph
:
"
[dump]
tc=gateway-simple"
-
paragraph
:
"
[[dyad-dump-path=*]]"
-
button "Retry"
:
-
img
\ No newline at end of file
e2e-tests/snapshots/engine.spec.ts_send-message-to-gateway-1.txt
0 → 100644
浏览文件 @
c227a08d
差异被折叠。
点击展开。
e2e-tests/snapshots/engine.spec.ts_server-dump.txt
deleted
100644 → 0
浏览文件 @
fc1ebe9e
差异被折叠。
点击展开。
e2e-tests/snapshots/import.spec.ts_
server-dump
.txt
→
e2e-tests/snapshots/import.spec.ts_
import-app-with-AI-rules-1
.txt
浏览文件 @
c227a08d
File moved
testing/fake-llm-server/index.ts
浏览文件 @
c227a08d
...
...
@@ -180,14 +180,14 @@ app.get("/lmstudio/api/v0/models", (req, res) => {
res
.
json
(
lmStudioModels
);
});
app
.
post
(
"/lmstudio/v1/chat/completions"
,
createChatCompletionHandler
(
"lmstudio"
)
,
);
app
.
post
(
"/engine/v1/chat/completions"
,
createChatCompletionHandler
(
"engine"
)
);
[
"lmstudio"
,
"gateway"
,
"engine"
].
forEach
((
provider
)
=>
{
app
.
post
(
`/
${
provider
}
/v1/chat/completions`
,
createChatCompletionHandler
(
provider
),
);
}
);
//
Handle POST requests to /v1/chat/completions
//
Default test provider handler:
app
.
post
(
"/v1/chat/completions"
,
createChatCompletionHandler
(
"."
));
// Start the server
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论