Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
1dde72e7
Unverified
提交
1dde72e7
authored
6月 03, 2025
作者:
Will Chen
提交者:
GitHub
6月 03, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete app E2E (#313)
Co-authored-by:
cubic-dev-ai[bot]
<
191113872+cubic-dev-ai[bot]@users.noreply.github.com
>
上级
667fc42a
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
47 行增加
和
2 行删除
+47
-2
delete_app.spec.ts
e2e-tests/delete_app.spec.ts
+28
-0
test_helper.ts
e2e-tests/helpers/test_helper.ts
+11
-0
AppList.tsx
src/components/AppList.tsx
+2
-1
app-details.tsx
src/pages/app-details.tsx
+6
-1
没有找到文件。
e2e-tests/delete_app.spec.ts
0 → 100644
浏览文件 @
1dde72e7
import
fs
from
"fs"
;
import
{
test
}
from
"./helpers/test_helper"
;
import
{
expect
}
from
"@playwright/test"
;
test
(
"delete app"
,
async
({
po
})
=>
{
await
po
.
setUp
();
await
po
.
sendPrompt
(
"hi"
);
const
appName
=
await
po
.
getCurrentAppName
();
if
(
!
appName
)
{
throw
new
Error
(
"App name not found"
);
}
const
appPath
=
await
po
.
getCurrentAppPath
();
await
po
.
getTitleBarAppNameButton
().
click
();
await
expect
(
po
.
getAppListItem
({
appName
})).
toBeVisible
();
// Delete app
await
po
.
clickAppDetailsMoreOptions
();
// Open delete dialog
await
po
.
page
.
getByRole
(
"button"
,
{
name
:
"Delete"
}).
click
();
// Confirm delete
await
po
.
page
.
getByRole
(
"button"
,
{
name
:
"Delete App"
}).
click
();
// Make sure the app is deleted
await
expect
(
async
()
=>
{
expect
(
await
po
.
getCurrentAppName
()).
toBe
(
"(no app selected)"
);
}).
toPass
();
expect
(
fs
.
existsSync
(
appPath
)).
toBe
(
false
);
expect
(
po
.
getAppListItem
({
appName
})).
not
.
toBeVisible
();
});
e2e-tests/helpers/test_helper.ts
浏览文件 @
1dde72e7
...
...
@@ -232,6 +232,10 @@ class PageObject {
return
this
.
page
.
getByTestId
(
"title-bar-app-name-button"
);
}
getAppListItem
({
appName
}:
{
appName
:
string
})
{
return
this
.
page
.
getByTestId
(
`app-list-item-
${
appName
}
`
);
}
async
getCurrentAppName
()
{
return
(
await
this
.
getTitleBarAppNameButton
().
textContent
())?.
replace
(
"App: "
,
...
...
@@ -246,6 +250,13 @@ class PageObject {
}
return
path
.
join
(
this
.
userDataDir
,
"dyad-apps"
,
currentAppName
);
}
async
clickAppListItem
({
appName
}:
{
appName
:
string
})
{
await
this
.
page
.
getByTestId
(
`app-list-item-
${
appName
}
`
).
click
();
}
async
clickAppDetailsMoreOptions
()
{
await
this
.
page
.
getByTestId
(
"app-details-more-options-button"
).
click
();
}
////////////////////////////////
// Settings related
...
...
src/components/AppList.tsx
浏览文件 @
1dde72e7
...
...
@@ -63,7 +63,7 @@ export function AppList({ show }: { show?: boolean }) {
)
:
apps
.
length
===
0
?
(
<
div
className=
"py-2 px-4 text-sm text-gray-500"
>
No apps found
</
div
>
)
:
(
<
SidebarMenu
className=
"space-y-1"
>
<
SidebarMenu
className=
"space-y-1"
data
-
testid=
"app-list"
>
{
apps
.
map
((
app
)
=>
(
<
SidebarMenuItem
key=
{
app
.
id
}
className=
"mb-1"
>
<
Button
...
...
@@ -74,6 +74,7 @@ export function AppList({ show }: { show?: boolean }) {
? "bg-sidebar-accent text-sidebar-accent-foreground"
: ""
}`
}
data
-
testid=
{
`app-list-item-${app.name}`
}
>
<
div
className=
"flex flex-col w-full"
>
<
span
className=
"truncate"
>
{
app
.
name
}
</
span
>
...
...
src/pages/app-details.tsx
浏览文件 @
1dde72e7
...
...
@@ -192,7 +192,12 @@ export default function AppDetailsPage() {
<
div
className=
"absolute top-2 right-2"
>
<
Popover
>
<
PopoverTrigger
asChild
>
<
Button
variant=
"ghost"
size=
"sm"
className=
"h-7 w-7 p-0"
>
<
Button
variant=
"ghost"
size=
"sm"
className=
"h-7 w-7 p-0"
data
-
testid=
"app-details-more-options-button"
>
<
MoreVertical
className=
"h-4 w-4"
/>
</
Button
>
</
PopoverTrigger
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论