接口开始5%
This commit is contained in:
@@ -50,6 +50,17 @@ const open = async (send, route, query, selector) => {
|
||||
await waitFor(send, `Boolean(document.querySelector(${JSON.stringify(selector)}))`, `${route}${query} did not render`)
|
||||
}
|
||||
|
||||
const fillJoinForm = (send, realName, relation) => valueOf(send, `(() => {
|
||||
const inputs = Array.from(document.querySelectorAll('.join-field input'))
|
||||
if (inputs.length < 2) return false
|
||||
const values = [${JSON.stringify(realName)}, ${JSON.stringify(relation)}]
|
||||
inputs.forEach((input, index) => {
|
||||
input.value = values[index]
|
||||
input.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
})
|
||||
return true
|
||||
})()`)
|
||||
|
||||
const run = async () => {
|
||||
const { socket, send, exceptions } = await connect()
|
||||
try {
|
||||
@@ -57,30 +68,24 @@ const run = async () => {
|
||||
await send('Runtime.enable')
|
||||
await open(send, '/pages/genealogy/g08-join-application', '?genealogyId=1002', '.join-state--form')
|
||||
await waitFor(send, "document.querySelectorAll('.join-field input').length >= 2", 'G08 real input controls did not render')
|
||||
const prepared = await valueOf(send, `(() => {
|
||||
const inputs = Array.from(document.querySelectorAll('.join-field input'))
|
||||
if (inputs.length < 2) return false
|
||||
inputs[0].value = '汤明远'
|
||||
inputs[0].dispatchEvent(new Event('input', { bubbles: true }))
|
||||
inputs[1].value = '汤正华堂侄'
|
||||
inputs[1].dispatchEvent(new Event('input', { bubbles: true }))
|
||||
document.querySelector('.join-action')?.click()
|
||||
return true
|
||||
})()`)
|
||||
const prepared = await fillJoinForm(send, '汤明远', '某某某堂侄')
|
||||
if (!prepared) throw new Error('G08 form controls could not be prepared')
|
||||
await valueOf(send, "document.querySelector('.join-action')?.click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.join-state--success'))", 'G08 real form submission did not reach the same-page success state')
|
||||
|
||||
// 步骤一:失败输入必须经过真实提交态进入错误结果,并能返回原表单重试。
|
||||
await open(send, '/pages/genealogy/g08-join-application', '?source=search&genealogyId=1002', '.join-state--form')
|
||||
if (!await fillJoinForm(send, '失败', '某某某堂侄')) throw new Error('G08 failure controls could not be prepared')
|
||||
await valueOf(send, "document.querySelector('.join-action').click()")
|
||||
await waitFor(send, "document.querySelector('.join-action')?.textContent.includes('正在提交')", 'G08 did not expose its submitting state')
|
||||
await waitFor(send, "Boolean(document.querySelector('.join-state--error'))", 'G08 simulated submission failure did not render')
|
||||
await valueOf(send, "document.querySelector('.join-result .join-action').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.join-state--form'))", 'G08 failure retry did not restore the form')
|
||||
|
||||
await open(send, '/pages/genealogy/g08-join-application', '?source=invite&genealogyId=2001', '.join-state--form')
|
||||
await valueOf(send, "document.querySelector('.join-action').click()")
|
||||
await waitFor(send, "document.querySelectorAll('.join-field-error').length === 2", 'G08 invite source did not show two inline required errors')
|
||||
const invitePrepared = await valueOf(send, `(() => {
|
||||
const inputs = Array.from(document.querySelectorAll('.join-field input'))
|
||||
inputs[0].value = '汤明远'
|
||||
inputs[0].dispatchEvent(new Event('input', { bubbles: true }))
|
||||
inputs[1].value = '汤正华堂侄'
|
||||
inputs[1].dispatchEvent(new Event('input', { bubbles: true }))
|
||||
return true
|
||||
})()`)
|
||||
const invitePrepared = await fillJoinForm(send, '汤明远', '某某某堂侄')
|
||||
if (!invitePrepared) throw new Error('G08 invite controls could not be prepared')
|
||||
await sleep(100)
|
||||
await valueOf(send, "document.querySelector('.join-action').click()")
|
||||
@@ -111,7 +116,7 @@ const run = async () => {
|
||||
await waitFor(send, "location.href.includes('/pages/genealogy/g08-join-application?source=search&previous=rejected&genealogyId=')", 'G09 rejected action did not reopen G08 search source')
|
||||
await open(send, '/pages/genealogy/g09-my-applications', '?state=empty', '.application-state--empty')
|
||||
await open(send, '/pages/genealogy/g10-application-review', '?genealogyId=1001', '.review-state--list')
|
||||
await valueOf(send, "document.querySelectorAll('.review-action')[1].click()")
|
||||
await valueOf(send, "document.querySelector('.review-actions .app-button:nth-child(2)').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.app-dialog-layer'))", 'G10 approve action did not open custom confirmation')
|
||||
await valueOf(send, "document.querySelector('.app-dialog__actions .app-button:last-child').click()")
|
||||
await waitFor(send, "document.querySelector('.application-card__status')?.textContent.includes('已通过')", 'G10 approval did not update the card')
|
||||
@@ -119,6 +124,25 @@ const run = async () => {
|
||||
await valueOf(send, "document.querySelector('.header-action').click()")
|
||||
await waitFor(send, "document.querySelector('.app-dialog__title')?.textContent.includes('审核说明')", 'G10 help did not use the custom dialog')
|
||||
await valueOf(send, "document.querySelector('.app-dialog__actions .app-button').click()")
|
||||
|
||||
// 步骤二:拒绝必须先聚焦关联错误,再在填写原因后完成,不能沿用旧截图助手的空原因假路径。
|
||||
await open(send, '/pages/genealogy/g10-application-review', '?genealogyId=1001', '.review-state--list')
|
||||
await valueOf(send, "document.querySelector('.review-actions .app-button:first-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.rejection-field textarea'))", 'G10 reject action did not open its reason field')
|
||||
await valueOf(send, "document.querySelector('.app-dialog__actions .app-button:last-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('#g10-rejection-error'))", 'G10 empty rejection reason did not show the associated error')
|
||||
await waitFor(send, "document.activeElement === document.querySelector('.rejection-field textarea') || Boolean(document.activeElement?.closest('#g10-rejection-reason'))", 'G10 rejection validation did not focus the reason field')
|
||||
const reasonPrepared = await valueOf(send, `(() => {
|
||||
const textarea = document.querySelector('.rejection-field textarea')
|
||||
if (!textarea) return false
|
||||
textarea.value = '请补充可核验的亲属关系材料'
|
||||
textarea.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
return true
|
||||
})()`)
|
||||
if (!reasonPrepared) throw new Error('G10 rejection reason could not be prepared')
|
||||
await valueOf(send, "document.querySelector('.app-dialog__actions .app-button:last-child').click()")
|
||||
await waitFor(send, "document.querySelector('.application-card__status')?.textContent.includes('已拒绝')", 'G10 rejection did not update the card')
|
||||
await waitFor(send, "Boolean(document.querySelector('.review-feedback'))", 'G10 rejection did not show custom feedback')
|
||||
await open(send, '/pages/genealogy/g10-application-review', '?state=empty&genealogyId=1001', '.review-state--empty')
|
||||
await open(send, '/pages/genealogy/g10-application-review', '?state=no-permission&genealogyId=1001', '.review-state--no-permission')
|
||||
if (exceptions.length) throw new Error(`G08-G10 raised browser exceptions: ${exceptions.join('; ')}`)
|
||||
|
||||
Reference in New Issue
Block a user