完成50%
This commit is contained in:
@@ -90,22 +90,82 @@ const run = async () => {
|
||||
await valueOf(send, "document.querySelector('.settings-action').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.settings-state--success'))", 'G11 valid save did not enter success state')
|
||||
await waitFor(send, "Boolean(document.querySelector('.settings-feedback'))", 'G11 valid save did not show feedback')
|
||||
if (!(await valueOf(send, "document.body.textContent.includes('尚未提交服务器')"))) throw new Error('G11 local settings preview claimed a server save')
|
||||
await open(socket, send, '/pages/genealogy/g11-genealogy-settings', '?state=success&genealogyId=1001', '.settings-state--success')
|
||||
await open(socket, send, '/pages/genealogy/g11-genealogy-settings', '?role=owner&state=form&genealogyId=1002', '.settings-state--no-permission')
|
||||
if (await valueOf(send, "Boolean(document.querySelector('.settings-form'))")) throw new Error('G11 trusted a forged owner role for a non-owner genealogy')
|
||||
|
||||
// 步骤二:G12 依次验证空内容、模拟保存失败和真实保存成功,三类结果不能只靠查询参数摆出。
|
||||
// 步骤二:G12 依次验证空内容、非法字符和本地保存成功,结果不能只靠查询参数摆出。
|
||||
await open(socket, send, '/pages/genealogy/g12-generation-poems', '?genealogyId=1001', '.poem-state--list')
|
||||
await open(socket, send, '/pages/genealogy/g12-generation-poems', '?genealogyId=1002', '.poem-state--list')
|
||||
if (await valueOf(send, "Boolean(document.querySelector('.header-action, .poem-list > .poem-action'))")) throw new Error('G12 member view exposed an owner maintenance entry')
|
||||
await open(socket, send, '/pages/genealogy/g12-generation-poems', '?role=owner&state=edit&genealogyId=1002', '.poem-state--no-permission')
|
||||
await open(socket, send, '/pages/genealogy/g12-generation-poems', '?state=list&genealogyId=2001', '.poem-state--no-permission')
|
||||
await open(socket, send, '/pages/genealogy/g12-generation-poems', '?state=empty&genealogyId=1001', '.poem-state--empty')
|
||||
await open(socket, send, '/pages/genealogy/g12-generation-poems', '?state=edit&genealogyId=1001', '.poem-state--edit')
|
||||
await setFieldValue(send, '.poem-field textarea', '临时草稿')
|
||||
await valueOf(send, "document.querySelector('.poem-editor__actions .poem-action:first-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.app-dialog-layer'))", 'G12 dirty cancel did not open the shared discard confirmation')
|
||||
await valueOf(send, "document.querySelector('.app-dialog__actions .app-button:first-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.poem-state--edit'))", 'G12 continuing edit did not keep the editor open')
|
||||
await valueOf(send, "document.querySelector('.poem-editor__actions .poem-action:first-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.app-dialog-layer'))", 'G12 second dirty cancel did not reopen confirmation')
|
||||
await valueOf(send, "document.querySelector('.app-dialog__actions .app-button:last-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.poem-state--list'))", 'G12 confirmed discard did not restore the editor origin')
|
||||
await open(socket, send, '/pages/genealogy/g12-generation-poems', '?state=edit&genealogyId=1001', '.poem-state--edit')
|
||||
await setFieldValue(send, '.poem-field textarea', '')
|
||||
await valueOf(send, "document.querySelector('.poem-editor__actions .poem-action:last-child').click()")
|
||||
await waitFor(send, "document.querySelector('.poem-field-error')?.textContent.includes('请录入字辈内容')", 'G12 empty poem did not show validation')
|
||||
await setFieldValue(send, '.poem-field textarea', '失败')
|
||||
await setFieldValue(send, '.poem-field textarea', '启'.repeat(501))
|
||||
await valueOf(send, "document.querySelector('.poem-editor__actions .poem-action:last-child').click()")
|
||||
await waitFor(send, "document.querySelector('.poem-field-error')?.textContent.includes('保存失败')", 'G12 simulated save failure did not render')
|
||||
await setFieldValue(send, '.poem-field textarea', '启宪敦本继世传芳')
|
||||
await waitFor(send, "document.querySelector('.poem-field-error')?.textContent.includes('最多录入 500 个世代')", 'G12 generation limit did not render')
|
||||
|
||||
// 步骤三:走完整的保留、停用和取消恢复接线,不能只证明纯函数会合并。
|
||||
await setFieldValue(send, '.poem-field textarea', '启 宗 敦')
|
||||
await valueOf(send, "document.querySelector('.poem-editor__actions .poem-action:last-child').click()")
|
||||
await waitFor(send, "document.querySelectorAll('.poem-row').length === 4", 'G12 disableMissing=false did not preserve the uncovered tail')
|
||||
if (await valueOf(send, "document.querySelector('.poem-row:last-child')?.classList.contains('poem-row--disabled')")) throw new Error('G12 disableMissing=false unexpectedly disabled the tail')
|
||||
if (!(await valueOf(send, "document.querySelector('.poem-row:last-child .poem-row__character')?.textContent.includes('本')"))) throw new Error('G12 disableMissing=false did not preserve the tail text')
|
||||
|
||||
await valueOf(send, "document.querySelector('.header-action').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.poem-state--edit'))", 'G12 maintenance action did not reopen the editor')
|
||||
await valueOf(send, "document.querySelector('.poem-policy__option').click()")
|
||||
await valueOf(send, "document.querySelector('.poem-editor__actions .poem-action:last-child').click()")
|
||||
await waitFor(send, "document.querySelector('.poem-row:last-child')?.classList.contains('poem-row--disabled')", 'G12 disableMissing=true did not disable the uncovered tail')
|
||||
if (!(await valueOf(send, "document.querySelector('.poem-row:last-child .poem-row__character')?.textContent.includes('本')"))) throw new Error('G12 disabled tail lost its historical text')
|
||||
if ((await valueOf(send, "document.querySelectorAll('.poem-row--current').length")) !== 1) throw new Error('G12 did not keep exactly one active current generation')
|
||||
if (await valueOf(send, "document.querySelector('.poem-row--current')?.classList.contains('poem-row--disabled')")) throw new Error('G12 marked a disabled generation as current')
|
||||
|
||||
await valueOf(send, "document.querySelector('.header-action').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.poem-state--edit'))", 'G12 did not reopen after disabling the tail')
|
||||
await setFieldValue(send, '.poem-field textarea', '临时草稿')
|
||||
await valueOf(send, "document.querySelector('.poem-policy__option').click()")
|
||||
await valueOf(send, "document.querySelector('.poem-editor__actions .poem-action:first-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.app-dialog-layer'))", 'G12 policy change did not trigger discard confirmation')
|
||||
await valueOf(send, "document.querySelector('.app-dialog__actions .app-button:last-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.poem-state--list'))", 'G12 confirmed policy discard did not leave the editor')
|
||||
await valueOf(send, "document.querySelector('.header-action').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.poem-state--edit'))", 'G12 did not reopen after policy discard')
|
||||
if (!(await valueOf(send, "document.querySelector('.poem-policy__option')?.textContent.includes('停用并保留记录')"))) throw new Error('G12 discard did not restore disableMissing=true')
|
||||
if ((await valueOf(send, "document.querySelector('.poem-field textarea')?.value")) !== '启 宗 敦') throw new Error('G12 discard did not restore the poem draft snapshot')
|
||||
|
||||
// 步骤四:500×50 个补充平面字符接近双重上限,验证 textarea、解析、保存与分批渲染。
|
||||
const maximumPoem = Array.from({ length: 500 }, () => '𠀀'.repeat(50)).join(' ')
|
||||
if (Array.from(maximumPoem).length !== 25499 || maximumPoem.length !== 50499) throw new Error('G12 maximum Unicode fixture is malformed')
|
||||
await setFieldValue(send, '.poem-field textarea', maximumPoem)
|
||||
await valueOf(send, "document.querySelector('.poem-editor__actions .poem-action:last-child').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.poem-state--list'))", 'G12 valid save did not return to the list')
|
||||
await waitFor(send, "Boolean(document.querySelector('.poem-feedback'))", 'G12 valid save did not show feedback')
|
||||
if (!(await valueOf(send, "document.querySelector('.poem-feedback')?.textContent.includes('本地字辈预览已更新')"))) throw new Error('G12 local save feedback is not explicit')
|
||||
if ((await valueOf(send, "document.querySelectorAll('.poem-row').length")) !== 50) throw new Error('G12 did not render the 500-generation list in 50-row batches')
|
||||
if (!(await valueOf(send, "document.querySelector('.poem-load-more')?.textContent.includes('剩余 450 代')"))) throw new Error('G12 first batch did not expose the remaining generation count')
|
||||
for (let batch = 1; batch < 10; batch += 1) {
|
||||
await valueOf(send, "document.querySelector('.poem-load-more')?.click()")
|
||||
await sleep(30)
|
||||
}
|
||||
await waitFor(send, "document.querySelectorAll('.poem-row').length === 500 && !document.querySelector('.poem-load-more')", 'G12 did not make the final generation reachable')
|
||||
if (!(await valueOf(send, "[...document.querySelectorAll('.poem-row__number')].at(-1)?.textContent.includes('第 500 世')"))) throw new Error('G12 final generation is not reachable')
|
||||
if (!(await valueOf(send, "document.documentElement.scrollWidth <= innerWidth && [...document.querySelectorAll('.poem-row__character')].every((item) => item.scrollWidth <= item.clientWidth)"))) throw new Error('G12 legal supplementary 50-character generation text overflowed its row')
|
||||
process.stdout.write('G11-G12-SETTINGS-POEMS-RUNTIME-SMOKE PASS\n')
|
||||
} finally {
|
||||
socket.close()
|
||||
|
||||
Reference in New Issue
Block a user