修改完成
This commit is contained in:
@@ -55,13 +55,16 @@ const navigate = async (send, url, selector) => {
|
||||
await waitFor(send, `Boolean(document.querySelector(${JSON.stringify(selector)}))`, `Page did not render ${selector}`)
|
||||
}
|
||||
|
||||
const setInputs = (values) => `(() => {
|
||||
const inputs = document.querySelectorAll('.auth-input input')
|
||||
;${JSON.stringify(values)}.forEach((value, index) => {
|
||||
inputs[index].value = value
|
||||
inputs[index].dispatchEvent(new Event('input', { bubbles: true }))
|
||||
})
|
||||
})()`
|
||||
const setInputs = async (send, values) => {
|
||||
for (const [index, value] of values.entries()) {
|
||||
await valueOf(send, `(() => {
|
||||
const input = document.querySelectorAll('.auth-input input')[${index}]
|
||||
input.value = ${JSON.stringify(value)}
|
||||
input.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
})()`)
|
||||
await sleep(30)
|
||||
}
|
||||
}
|
||||
|
||||
const run = async () => {
|
||||
const { socket, send, exceptions } = await connect()
|
||||
@@ -89,7 +92,7 @@ const run = async () => {
|
||||
|
||||
await valueOf(send, "document.querySelector('.get-code').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.field-error'))", 'A05 invalid phone did not show inline error')
|
||||
await valueOf(send, setInputs(['13800138000', '', '', '']))
|
||||
await setInputs(send, ['13800138000', '', '', ''])
|
||||
await valueOf(send, "document.querySelector('.get-code').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.feedback-toast'))", 'A05 code request did not use custom pending feedback')
|
||||
assert.strictEqual(await valueOf(send, "document.querySelector('.feedback-toast').textContent.trim()"), '滑动验证待接口接入', 'A05 code request showed the wrong pending feedback')
|
||||
@@ -99,7 +102,7 @@ const run = async () => {
|
||||
|
||||
await valueOf(send, "document.querySelector('.reset-submit').click()")
|
||||
await waitFor(send, "document.querySelectorAll('.field-error').length === 3", 'A05 incomplete submit did not show three remaining field errors')
|
||||
await valueOf(send, setInputs(['13800138000', '123456', 'new-password', 'different-password']))
|
||||
await setInputs(send, ['13800138000', '123456', 'new-password', 'different-password'])
|
||||
await sleep(100)
|
||||
await valueOf(send, "document.querySelector('.reset-submit').click()")
|
||||
await sleep(100)
|
||||
@@ -110,7 +113,7 @@ const run = async () => {
|
||||
})`)
|
||||
assert(mismatchState.errors.some((message) => message.includes('不一致')), `A05 mismatched passwords did not show inline error: ${JSON.stringify(mismatchState)}`)
|
||||
|
||||
await valueOf(send, setInputs(['13800138000', '123456', 'new-password', 'new-password']))
|
||||
await setInputs(send, ['13800138000', '123456', 'new-password', 'new-password'])
|
||||
await sleep(100)
|
||||
await valueOf(send, "document.querySelector('.reset-submit').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.success-layer'))", 'A05 valid submit did not show custom success result')
|
||||
|
||||
Reference in New Issue
Block a user