完成50%

This commit is contained in:
2026-07-23 08:23:59 +08:00
parent 9b0ad62df4
commit f1edc6b533
218 changed files with 24318 additions and 5514 deletions
+45 -13
View File
@@ -2,15 +2,15 @@ const assert = require('assert')
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
const origin = process.argv[2] || 'http://localhost:5173'
const routes = [
['/pages/notification/n02-message-detail', '.notice-state--ready'],
['/pages/notification/n02-message-detail?id=review-1', '.notice-state--ready'],
['/pages/profile/m02-edit-profile', '.profile-state--ready'],
['/pages/profile/m03-security-settings', '.device-state--safe'],
['/pages/profile/m03-security-settings', '.device-state--limited'],
['/pages/profile/m04-change-password', '.password-state--ready'],
['/pages/profile/m05-change-phone', '.phone-state--ready'],
['/pages/profile/m06-help-center', '.help-page'],
['/pages/profile/m07-feedback', '.feedback-state--ready'],
['/pages/profile/m08-promotion', '.share-state--ready'],
['/pages/profile/m09-vip-orders', '.order-state--empty'],
['/pages/profile/m08-promotion', '.share-state--unavailable'],
['/pages/profile/m09-vip-orders', '.order-state--unavailable'],
['/pages/profile/m10-about-settings', '.about-page'],
]
@@ -62,15 +62,18 @@ const run = async () => {
}
}
await open('/pages/notification/n02-message-detail', '.notice-state--ready')
await open('/pages/notification/n02-message-detail?id=review-1', '.notice-state--ready')
await valueOf(send, `document.querySelector('.app-button').click()`)
await waitFor(send, `document.body.innerText.includes('已读')`, 'N02 did not update read state')
await open('/pages/notification/n02-message-detail?id=missing', '.notice-state--expired')
assert.strictEqual(await valueOf(send, `Boolean(document.querySelector('.action-stack'))`), false, 'N02 unknown notice exposed business actions')
await open('/pages/profile/m02-edit-profile', '.profile-state--ready')
await valueOf(send, `(() => { const input=document.querySelector('input'); input.value=''; input.dispatchEvent(new Event('input',{bubbles:true})); document.querySelector('.app-button').click(); return true })()`)
await waitFor(send, `Boolean(document.querySelector('.field-error'))`, 'M02 did not validate nickname')
await open('/pages/profile/m03-security-settings', '.device-state--safe')
await open('/pages/profile/m03-security-settings', '.device-state--limited')
await valueOf(send, `document.querySelector('.security-row').click()`)
await waitFor(send, `location.hash.includes('/pages/profile/m04-change-password')`, 'M03 password navigation failed')
@@ -88,19 +91,48 @@ const run = async () => {
await open('/pages/profile/m07-feedback', '.feedback-state--ready')
await valueOf(send, `document.querySelector('.app-button').click()`)
assert.strictEqual(await valueOf(send, `document.querySelectorAll('.field-error').length`), 2, 'M07 must report type and description errors')
assert.strictEqual(await valueOf(send, `document.querySelectorAll('.field-error').length`), 1, 'M07 must only require feedbackContent')
await valueOf(send, `(() => {
document.querySelector('.type-chip').click()
const content = document.querySelector('textarea')
content.value = 'runtime feedback'
content.dispatchEvent(new Event('input', { bubbles: true }))
const contact = document.querySelector('.contact-row input')
contact.value = 'runtime@example.com'
contact.dispatchEvent(new Event('input', { bubbles: true }))
document.querySelector('.page-content > .app-button').click()
return true
})()`)
await waitFor(send, `document.querySelector('.feedback-result--error')?.textContent.includes('本地预览模式')`, 'M07 must fail closed instead of faking feedback submission in mock mode')
await open('/pages/profile/m08-promotion', '.share-state--ready')
await valueOf(send, `document.querySelector('.app-button').click()`)
await waitFor(send, `Boolean(document.querySelector('.app-dialog'))`, 'M08 poster dialog missing')
await open('/pages/profile/m08-promotion', '.share-state--unavailable')
assert.strictEqual(await valueOf(send, `Boolean(document.querySelector('.copy-action, .invite-code'))`), false, 'M08 exposed an invitation code action')
assert.strictEqual(await valueOf(send, `document.body.innerText.includes('TN20260720')`), false, 'M08 exposed the retired fake invitation code')
await valueOf(send, `document.querySelector('.page-content > .app-button').click()`)
await waitFor(send, `document.querySelector('.app-dialog__title')?.textContent.includes('功能尚未接入')`, 'M08 unavailable explanation dialog missing')
await open('/pages/profile/m09-vip-orders', '.order-state--empty')
await valueOf(send, `document.querySelector('.app-button').click()`)
await waitFor(send, `Boolean(document.querySelector('.app-dialog'))`, 'M09 service dialog missing')
await open('/pages/profile/m09-vip-orders', '.order-state--unavailable')
assert.strictEqual(await valueOf(send, `Boolean(document.querySelector('.order-card'))`), false, 'M09 exposed an order card')
assert.strictEqual(await valueOf(send, `document.body.innerText.includes('O20260720001') || document.body.innerText.includes('¥0.00') || document.body.innerText.includes('演示记录')`), false, 'M09 exposed retired fake order data')
await valueOf(send, `document.querySelector('.page-content > .app-button').click()`)
await waitFor(send, `document.querySelector('.app-dialog__title')?.textContent.includes('付费服务尚未开放')`, 'M09 unavailable service dialog missing')
await open('/pages/profile/m10-about-settings', '.about-page')
await valueOf(send, `document.querySelector('.settings-row').click()`)
await waitFor(send, `Boolean(document.querySelector('.app-dialog'))`, 'M10 agreement dialog missing')
await valueOf(send, `document.querySelector('.app-dialog__actions .app-button').click()`)
await waitFor(send, `!document.querySelector('.app-dialog')`, 'M10 agreement dialog did not close')
await valueOf(send, `(() => {
uni.setStorageSync('jiapu_token', 'runtime-token')
uni.setStorageSync('jiapu_current_genealogy_id', '1001')
document.querySelector('.page-content > .app-button').click()
return true
})()`)
await waitFor(send, `document.querySelector('.app-dialog__title')?.textContent.includes('确认退出登录')`, 'M10 logout confirmation missing')
await valueOf(send, `document.querySelector('.app-dialog__actions .app-button:last-child').click()`)
await waitFor(send, `location.hash === '#/pages/auth/a01-entry' && Boolean(document.querySelector('.login-page'))`, 'M10 logout did not goRoot A01')
assert.strictEqual(await valueOf(send, `uni.getStorageSync('jiapu_token')`), '', 'M10 logout did not clear the session token')
assert.strictEqual(await valueOf(send, `uni.getStorageSync('jiapu_current_genealogy_id')`), '', 'M10 logout did not clear the genealogy context')
process.stdout.write('NM-BUSINESS-RUNTIME-SMOKE PASS\n')
} finally {
try { await send('Emulation.clearDeviceMetricsOverride') } catch (_) {}