This commit is contained in:
2026-10-18 23:18:25 +07:00
parent 8da494c424
commit fc326f46c8
10 changed files with 336 additions and 29 deletions
+30 -1
View File
@@ -219,6 +219,25 @@ app.whenReady().then(async () => {
(await evaluate('!!window.screenBridge && !!document.querySelector("main.control")')),
'control UI',
)
if (process.argv.includes('--clear-games')) {
await evaluate(`window.screenBridge.selectPackage(${JSON.stringify(offlinePackage.key)})`)
await poll(() => evaluate('!!document.querySelector("[data-testid=clear-games]:not([disabled])")'), 'clear games button')
const clickDialog = (label) => evaluate(`Array.from(document.querySelectorAll('.n-dialog__action button')).find(b => b.textContent.trim() === ${JSON.stringify(label)}).click()`)
await evaluate('document.querySelector("[data-testid=clear-games]").click()')
await poll(() => evaluate('!!document.querySelector(".n-dialog")'), 'clear games confirmation')
await clickDialog('Отмена')
assert.equal((await evaluate('window.screenBridge.packages()')).length, 1)
await poll(() => evaluate('!document.querySelector(".n-dialog")'), 'clear games cancelled')
await evaluate('document.querySelector("[data-testid=clear-games]").click()')
await poll(() => evaluate('!!document.querySelector(".n-dialog")'), 'clear games confirmation again')
await clickDialog('Удалить всё')
await poll(async () => (await evaluate('window.screenBridge.packages()')).length === 0, 'packages cleared')
await poll(() => evaluate('document.body.textContent.includes("Скачанных игр пока нет")'), 'empty local games UI')
assert.equal((await evaluate('window.screenBridge.state()')).catalog.key, null)
console.log('SCREEN_CLEAR_GAMES_PASS')
app.exit(0)
return
}
if (manual) {
await evaluate(`window.screenBridge.selectPackage(${JSON.stringify(offlinePackage.key)})`)
console.log(
@@ -293,7 +312,17 @@ app.whenReady().then(async () => {
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 assert.rejects(evaluate(`window.screenBridge.selectPackage(${JSON.stringify(offlinePackage.key)})`))
await evaluate('window.screenBridge.closeOutput()')
const localPackages = await evaluate('window.screenBridge.packages()')
assert.equal(localPackages[0].downloadedFiles, localPackages[0].totalFiles)
await poll(() => evaluate('!!document.querySelector("[data-testid=local-game-select] .n-base-selection")'), 'local game selector')
await evaluate('document.querySelector("[data-testid=local-game-select] .n-base-selection").click()')
await poll(() => evaluate('!!document.querySelector(".n-base-select-option")'), 'local game option')
await evaluate('document.querySelector(".n-base-select-option").click()')
await evaluate('document.querySelector("[data-testid=local-game-confirm]").click()')
await poll(async () => (await state()).catalog.key === offlinePackage.key, 'local game selected')
await evaluate(`window.screenBridge.show(${targetDisplay.id})`)
await poll(async () => {
const s = await state()
return (