up
This commit is contained in:
+49
-4
@@ -257,10 +257,8 @@ app.whenReady().then(async () => {
|
||||
}
|
||||
}
|
||||
await checkDisplay(output)
|
||||
await evaluate(
|
||||
`Array.from(document.querySelectorAll('button')).find(b => b.textContent.includes('Пуск с начала')).click()`,
|
||||
)
|
||||
await poll(async () => (await state()).channels.main.status === 'playing', 'UI fixture play')
|
||||
await command({ action: 'play', channel: 'main' })
|
||||
await poll(async () => (await state()).channels.main.status === 'playing', 'fixture play')
|
||||
await command({ action: 'pause', channel: 'main' })
|
||||
await command({ action: 'resume', channel: 'main' })
|
||||
await command({ action: 'stop', channel: 'main' })
|
||||
@@ -275,6 +273,7 @@ app.whenReady().then(async () => {
|
||||
assert.deepEqual(range, { status: 206, size: 100 })
|
||||
await command({ action: 'pause', channel: 'main' })
|
||||
assert.equal(await evaluate('document.body.textContent.includes("Материалы показа")'), false)
|
||||
assert.equal(await evaluate('document.body.textContent.includes("Вступление и видео")'), false)
|
||||
await evaluate(`window.screenBridge.selectPackage(${JSON.stringify(offlinePackage.key)})`)
|
||||
await poll(async () => {
|
||||
const s = await state()
|
||||
@@ -403,6 +402,52 @@ app.whenReady().then(async () => {
|
||||
if (index === 0)
|
||||
assert.equal(await inspect('document.querySelector("img.cover").naturalWidth'), 320)
|
||||
else assert.equal(await inspect('document.querySelector("img.background").naturalWidth'), 320)
|
||||
if (index === 1 || index === 3) {
|
||||
const clickMedia = (label) =>
|
||||
evaluate(`(() => {
|
||||
const row = document.querySelector('[data-step-index="${index}"]')
|
||||
const button = Array.from(row.querySelectorAll('button')).find(b => b.textContent.trim() === ${JSON.stringify(label)})
|
||||
if (!button || button.disabled) throw new Error('Main control unavailable')
|
||||
button.click()
|
||||
})()`)
|
||||
await clickMedia('Запуск')
|
||||
await poll(
|
||||
async () => (await state()).channels.main.status === 'playing',
|
||||
'plan media plays',
|
||||
)
|
||||
await clickMedia('Пауза')
|
||||
await poll(
|
||||
async () => (await state()).channels.main.status === 'paused',
|
||||
'plan media paused',
|
||||
)
|
||||
await evaluate(`(() => {
|
||||
const input = document.querySelector('#position-main')
|
||||
input.focus(); input.value = '1'
|
||||
input.dispatchEvent(new InputEvent('input', { bubbles: true, inputType: 'insertText' }))
|
||||
input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }))
|
||||
input.blur()
|
||||
})()`)
|
||||
await clickMedia('Перемотать')
|
||||
await poll(
|
||||
async () => Math.abs((await state()).channels.main.position - 1) < 0.1,
|
||||
'plan media seek',
|
||||
)
|
||||
await evaluate(`(() => {
|
||||
const input = document.querySelector('#volume-main')
|
||||
input.focus(); input.value = '42'
|
||||
input.dispatchEvent(new InputEvent('input', { bubbles: true, inputType: 'insertText' }))
|
||||
input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }))
|
||||
input.blur()
|
||||
})()`)
|
||||
await poll(async () => (await state()).channels.main.volume === 42, 'plan media volume')
|
||||
assert.equal((await state()).channels.main.desired, 'paused')
|
||||
assert.equal((await state()).channels.music.desired, 'playing')
|
||||
await clickMedia('Стоп')
|
||||
await poll(
|
||||
async () => (await state()).channels.main.status === 'stopped',
|
||||
'plan media stopped',
|
||||
)
|
||||
}
|
||||
if (index === 2) assert.ok(await inspect('document.body.textContent.includes("Успехов")'))
|
||||
if (index === 4)
|
||||
assert.ok(await inspect('document.body.textContent.includes("Спасибо за игру!")'))
|
||||
|
||||
Reference in New Issue
Block a user