fix: 完善打包历史与登录提示

This commit is contained in:
shenlei
2026-07-20 14:54:06 +09:00
parent c209ae423c
commit 3e3e4123d0
5 changed files with 31 additions and 16 deletions
+11
View File
@@ -65,6 +65,17 @@ describe('App.vue', () => {
expect(wrapper.find('.login-modal').exists()).toBe(true)
})
it('登录框不展示默认管理员账号密码', async () => {
const router = createMockRouter()
const wrapper = mount(App, {
global: { plugins: [router] },
})
await wrapper.find('.btn-login').trigger('click')
expect(wrapper.find('.login-modal').text()).not.toContain('默认账号')
expect(wrapper.find('.login-modal').text()).not.toContain('admin123')
})
it('登录成功后更新状态', async () => {
fetch.mockResolvedValueOnce({
ok: true,
+7 -7
View File
@@ -8,7 +8,7 @@ window.open = vi.fn()
const mockTasks = [
{ id: '1', app_name: 'App1', build_type: 'Ad_Hoc', scheme_name: 'sch1', status: 'completed', created_at: '2024-01-01T10:00:00', dsym_path: '/path/dsym', oss_url: 'https://oss.com/app1.ipa', qr_code_path: '/path/qr.png' },
{ id: '2', app_name: 'App2', build_type: 'App_Store', scheme_name: 'sch2', status: 'failed', created_at: '2024-01-02T10:00:00', error_message: '构建失败' },
{ id: '2', app_name: 'App2', build_type: 'App_Store', scheme_name: 'sch2', status: 'failed', created_at: '2024-01-02T10:00:00', error_message: '构建失败', error_category: 'compilation' },
{ id: '3', app_name: 'App3', build_type: 'Ad_Hoc', scheme_name: 'sch1', status: 'pending', created_at: '2024-01-03T10:00:00' },
]
@@ -47,7 +47,7 @@ describe('HistoryView.vue', () => {
await flushPromises()
const rows = wrapper.findAll('tbody tr')
expect(rows.length).toBe(2) // App2(failed) 默认隐藏
expect(rows.length).toBe(3)
})
it('显示任务信息', async () => {
@@ -58,23 +58,23 @@ describe('HistoryView.vue', () => {
await flushPromises()
expect(wrapper.text()).toContain('App1')
// App2 是 failed 状态,默认隐藏
expect(wrapper.text()).not.toContain('App2')
expect(wrapper.text()).toContain('App2')
expect(wrapper.text()).toContain('Ad_Hoc')
})
it('默认隐藏失败和已取消的任务', async () => {
it('默认显示失败任务及完整失败原因', async () => {
const router = createMockRouter()
const wrapper = mount(HistoryView, {
global: { plugins: [router] },
})
await flushPromises()
// 只显示 App1completed)和 App3pending),App2failed)被隐藏
const rows = wrapper.findAll('tbody tr')
expect(rows.length).toBe(2)
expect(rows.length).toBe(3)
expect(wrapper.text()).toContain('App1')
expect(wrapper.text()).toContain('App3')
expect(wrapper.text()).toContain('失败')
expect(wrapper.text()).toContain('编译错误')
expect(wrapper.text()).toContain('等待中')
})