Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
b8f74902
Unverified
提交
b8f74902
authored
6月 04, 2025
作者:
Will Chen
提交者:
GitHub
6月 04, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stabilize E2E test by alphabetically sorting files for context (#321)
上级
c227a08d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
36 行增加
和
16 行删除
+36
-16
ci.yml
.github/workflows/ci.yml
+1
-1
dump_messages.spec.ts
e2e-tests/dump_messages.spec.ts
+2
-5
test_helper.ts
e2e-tests/helpers/test_helper.ts
+19
-5
dump_messages.spec.ts_dump-messages-1.txt
...tests/snapshots/dump_messages.spec.ts_dump-messages-1.txt
+5
-5
codebase.ts
src/utils/codebase.ts
+9
-0
没有找到文件。
.github/workflows/ci.yml
浏览文件 @
b8f74902
...
...
@@ -58,7 +58,7 @@ jobs:
-
name
:
E2E tests
# You can add debug logging to make it easier to see what's failing
# by adding "DEBUG=pw:browser" in front.
run
:
npm run e2e
run
:
DEBUG=pw:browser
npm run e2e
-
uses
:
actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08
# v4.6.0
if
:
failure()
with
:
...
...
e2e-tests/dump_messages.spec.ts
浏览文件 @
b8f74902
import
{
test
SkipIfWindows
}
from
"./helpers/test_helper"
;
import
{
test
}
from
"./helpers/test_helper"
;
// This is useful to make sure the messages are being sent correctly.
//
// Why skip on Windows? The file ordering is not stable between runs
// but unclear why.
testSkipIfWindows
(
"dump messages"
,
async
({
po
})
=>
{
test
(
"dump messages"
,
async
({
po
})
=>
{
await
po
.
setUp
();
await
po
.
sendPrompt
(
"[dump]"
);
await
po
.
snapshotServerDump
();
...
...
e2e-tests/helpers/test_helper.ts
浏览文件 @
b8f74902
...
...
@@ -4,6 +4,7 @@ import { ElectronApplication, _electron as electron } from "playwright";
import
fs
from
"fs"
;
import
path
from
"path"
;
import
os
from
"os"
;
import
{
execSync
}
from
"child_process"
;
const
showDebugLogs
=
process
.
env
.
DEBUG_LOGS
===
"true"
;
...
...
@@ -478,7 +479,11 @@ export const test = base.extend<{
process
.
env
.
E2E_TEST_BUILD
=
"true"
;
// This is just a hack to avoid the AI setup screen.
process
.
env
.
OPENAI_API_KEY
=
"sk-test"
;
const
USER_DATA_DIR
=
`/tmp/dyad-e2e-tests-
${
Date
.
now
()}
`
;
const
baseTmpDir
=
os
.
tmpdir
();
const
USER_DATA_DIR
=
path
.
join
(
baseTmpDir
,
`dyad-e2e-tests-
${
Date
.
now
()}
`
,
);
const
electronApp
=
await
electron
.
launch
({
args
:
[
appInfo
.
main
,
...
...
@@ -486,9 +491,11 @@ export const test = base.extend<{
`--user-data-dir=
${
USER_DATA_DIR
}
`
,
],
executablePath
:
appInfo
.
executable
,
recordVideo
:
{
dir
:
"test-results"
,
},
// Strong suspicion this is causing issues on Windows with tests hanging due to error:
// ffmpeg failed to write: Error [ERR_STREAM_WRITE_AFTER_END]: write after end
// recordVideo: {
// dir: "test-results",
// },
});
(
electronApp
as
any
).
$dyadUserDataDir
=
USER_DATA_DIR
;
...
...
@@ -527,7 +534,14 @@ export const test = base.extend<{
// because the electron app does NOT ever fully quit due to
// Windows' strict resource locking (e.g. file locking).
if
(
os
.
platform
()
===
"win32"
)
{
electronApp
.
process
().
kill
();
try
{
execSync
(
"taskkill /f /im dyad.exe"
);
}
catch
(
error
)
{
console
.
warn
(
"Failed to kill dyad.exe: (continuing with test cleanup)"
,
error
,
);
}
}
else
{
await
electronApp
.
close
();
}
...
...
e2e-tests/snapshots/dump_messages.spec.ts_dump-messages-1.txt
浏览文件 @
b8f74902
...
...
@@ -418,11 +418,6 @@ Available packages and libraries:
</dyad-file>
<dyad-file path="README.md">
# Welcome to your Dyad app
</dyad-file>
<dyad-file path="eslint.config.js">
// Contents omitted for brevity
</dyad-file>
...
...
@@ -454,6 +449,11 @@ export default {
</dyad-file>
<dyad-file path="README.md">
# Welcome to your Dyad app
</dyad-file>
<dyad-file path="src/App.css">
#root {
max-width: 1280px;
...
...
src/utils/codebase.ts
浏览文件 @
b8f74902
...
...
@@ -370,6 +370,15 @@ async function sortFilesByModificationTime(files: string[]): Promise<string[]> {
}),
);
if
(
process
.
env
.
E2E_TEST_BUILD
)
{
// Why? For some reason, file ordering is not stable on Windows.
// This is a workaround to ensure stable ordering, although
// ideally we'd like to sort it by modification time which is
// important for cache-ability.
return
fileStats
.
sort
((
a
,
b
)
=>
a
.
file
.
localeCompare
(
b
.
file
))
.
map
((
item
)
=>
item
.
file
);
}
// Sort by modification time (oldest first)
return
fileStats
.
sort
((
a
,
b
)
=>
a
.
mtime
-
b
.
mtime
).
map
((
item
)
=>
item
.
file
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论