fix(ui): 打包页「启用混淆」默认不勾选,旧分支/旧 Tag 需手动勾选才混淆
分支 build_policy.json 声明 force_obfuscation 时仍强制混淆,不受勾选影响。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
488c6416c2
commit
588287a838
@@ -52,7 +52,7 @@ describe('BuildView.vue', () => {
|
|||||||
expect(wrapper.text()).toContain('代码混淆')
|
expect(wrapper.text()).toContain('代码混淆')
|
||||||
expect(wrapper.text()).toContain('build_policy.json')
|
expect(wrapper.text()).toContain('build_policy.json')
|
||||||
expect(wrapper.find('#obfuscation').exists()).toBe(true)
|
expect(wrapper.find('#obfuscation').exists()).toBe(true)
|
||||||
expect(wrapper.find('#obfuscation').element.checked).toBe(true)
|
expect(wrapper.find('#obfuscation').element.checked).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('加载 apps 和 schemes', async () => {
|
it('加载 apps 和 schemes', async () => {
|
||||||
@@ -121,7 +121,7 @@ describe('BuildView.vue', () => {
|
|||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
expect(wrapper.vm.form.build_type).toBe('')
|
expect(wrapper.vm.form.build_type).toBe('')
|
||||||
expect(wrapper.vm.form.obfuscation).toBe(true)
|
expect(wrapper.vm.form.obfuscation).toBe(false)
|
||||||
expect(wrapper.vm.form.branch).toBe('main')
|
expect(wrapper.vm.form.branch).toBe('main')
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -158,14 +158,14 @@ describe('BuildView.vue', () => {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
}))
|
}))
|
||||||
const post = fetch.mock.calls.find(([url, opts]) => url === '/api/tasks' && opts?.method === 'POST')
|
const post = fetch.mock.calls.find(([url, opts]) => url === '/api/tasks' && opts?.method === 'POST')
|
||||||
expect(JSON.parse(post[1].body).obfuscation).toBe(true)
|
expect(JSON.parse(post[1].body).obfuscation).toBe(false)
|
||||||
expect(wrapper.text()).toContain('打包任务已创建,正在排队,请勿重复点击。')
|
expect(wrapper.text()).toContain('打包任务已创建,正在排队,请勿重复点击。')
|
||||||
expect(wrapper.vm.form.app_id).toBe('')
|
expect(wrapper.vm.form.app_id).toBe('')
|
||||||
expect(wrapper.vm.form.build_type).toBe('')
|
expect(wrapper.vm.form.build_type).toBe('')
|
||||||
expect(wrapper.vm.form.scheme_id).toBe('')
|
expect(wrapper.vm.form.scheme_id).toBe('')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('取消勾选混淆时提交 obfuscation=false(旧分支按勾选执行)', async () => {
|
it('勾选混淆时提交 obfuscation=true(旧分支按勾选执行)', async () => {
|
||||||
fetch.mockImplementation((url, opts) => {
|
fetch.mockImplementation((url, opts) => {
|
||||||
if (url === '/api/tasks' && opts?.method === 'POST') {
|
if (url === '/api/tasks' && opts?.method === 'POST') {
|
||||||
return Promise.resolve({ ok: true, json: () => Promise.resolve({ id: 'test-id', status: 'pending' }) })
|
return Promise.resolve({ ok: true, json: () => Promise.resolve({ id: 'test-id', status: 'pending' }) })
|
||||||
@@ -184,12 +184,13 @@ describe('BuildView.vue', () => {
|
|||||||
wrapper.vm.selectedServer = '测试环境'
|
wrapper.vm.selectedServer = '测试环境'
|
||||||
await wrapper.vm.$nextTick()
|
await wrapper.vm.$nextTick()
|
||||||
wrapper.vm.form.app_id = '1'
|
wrapper.vm.form.app_id = '1'
|
||||||
await wrapper.find('#obfuscation').setValue(false)
|
await wrapper.find('#obfuscation').setValue(true)
|
||||||
await wrapper.find('.btn-primary').trigger('click')
|
await wrapper.find('.btn-primary').trigger('click')
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
const post = fetch.mock.calls.find(([url, opts]) => url === '/api/tasks' && opts?.method === 'POST')
|
const post = fetch.mock.calls.find(([url, opts]) => url === '/api/tasks' && opts?.method === 'POST')
|
||||||
expect(JSON.parse(post[1].body).obfuscation).toBe(false)
|
expect(JSON.parse(post[1].body).obfuscation).toBe(true)
|
||||||
|
expect(wrapper.vm.form.obfuscation).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('未选择 App 时提示', async () => {
|
it('未选择 App 时提示', async () => {
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ const form = ref({
|
|||||||
build_type: '',
|
build_type: '',
|
||||||
scheme_id: '',
|
scheme_id: '',
|
||||||
exclude_symbols: false,
|
exclude_symbols: false,
|
||||||
obfuscation: true,
|
obfuscation: false,
|
||||||
branch: 'main',
|
branch: 'main',
|
||||||
})
|
})
|
||||||
const submitting = ref(false)
|
const submitting = ref(false)
|
||||||
@@ -401,7 +401,7 @@ const submitTask = async () => {
|
|||||||
build_type: '',
|
build_type: '',
|
||||||
scheme_id: '',
|
scheme_id: '',
|
||||||
exclude_symbols: false,
|
exclude_symbols: false,
|
||||||
obfuscation: Boolean(supportsObfuscation.value),
|
obfuscation: false,
|
||||||
branch: branches.value[0] || 'main',
|
branch: branches.value[0] || 'main',
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user