修改完成
This commit is contained in:
@@ -37,13 +37,18 @@ const run = async () => {
|
||||
await waitFor(send, "Boolean(document.querySelector('.person-detail-state--edit'))", 'R02 did not enter edit')
|
||||
await send('Runtime.evaluate', { expression: `(() => { const input=document.querySelector('.person-field input'); input.value=''; input.dispatchEvent(new Event('input',{bubbles:true})); document.querySelector('.person-save-action')?.click() })()` })
|
||||
await waitFor(send, "Boolean(document.querySelector('.person-field-error'))", 'R02 validation did not render')
|
||||
for (const [index, value] of ['汤文正', '家谱管理员', '18'].entries()) {
|
||||
await send('Runtime.evaluate', { expression: `(() => { const input=document.querySelectorAll('.person-field input')[${index}]; const setter=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'value').set; setter.call(input,${JSON.stringify(value)}); input.dispatchEvent(new Event('input',{bubbles:true})) })()` })
|
||||
await waitFor(send, `document.querySelectorAll('.person-field input')[${index}]?.value === ${JSON.stringify(value)}`, `R02 edit field ${index} did not settle`)
|
||||
await sleep(150)
|
||||
}
|
||||
await send('Runtime.evaluate', { expression: "document.querySelector('.person-cancel-action')?.click()" })
|
||||
await waitFor(send, "Boolean(document.querySelector('.person-detail-state--detail'))", 'R02 did not cancel the invalid edit')
|
||||
await send('Runtime.evaluate', { expression: "document.querySelector('.person-edit-action')?.click()" })
|
||||
await waitFor(send, "Boolean(document.querySelector('.person-detail-state--edit'))", 'R02 did not re-enter edit after validation')
|
||||
await send('Runtime.evaluate', { expression: "document.querySelector('.person-save-action')?.click()" })
|
||||
await waitFor(send, "Boolean(document.querySelector('.person-detail-state--detail'))", 'R02 did not return to detail after save')
|
||||
await sleep(200)
|
||||
const saveState = await valueOf(send, `({
|
||||
detail: Boolean(document.querySelector('.person-detail-state--detail')),
|
||||
values: Array.from(document.querySelectorAll('.person-field input')).map((input) => input.value),
|
||||
errors: Array.from(document.querySelectorAll('.person-field-error')).map((error) => error.textContent.trim())
|
||||
})`)
|
||||
if (!saveState.detail) throw new Error(`R02 did not return to detail after save: ${JSON.stringify(saveState)}`)
|
||||
await waitFor(send, "Boolean(document.querySelector('.app-toast'))", 'R02 save feedback missing')
|
||||
await navigate('/pages/records/r02-person-detail?personId=1&state=privacy', '.person-detail-state--privacy')
|
||||
await navigate('/pages/records/r02-person-detail?personId=1&state=expired', '.person-detail-state--expired')
|
||||
|
||||
Reference in New Issue
Block a user