up
This commit is contained in:
@@ -250,7 +250,7 @@ module.exports = async function onlineSmoke({
|
||||
await poll(
|
||||
() =>
|
||||
evaluate(
|
||||
`Array.from(document.querySelectorAll('.n-base-selection')).some(e => e.textContent.includes('Выберите игру для подготовки'))`,
|
||||
`Array.from(document.querySelectorAll('.n-base-selection')).some(e => e.textContent.includes('Выберите игру'))`,
|
||||
),
|
||||
'server game selector',
|
||||
)
|
||||
@@ -267,6 +267,32 @@ module.exports = async function onlineSmoke({
|
||||
),
|
||||
['Сервер', 'Игра', 'Экран', 'План экранов', 'План музыки'],
|
||||
)
|
||||
assert.equal(
|
||||
await evaluate(`document.querySelectorAll('details').length`),
|
||||
0,
|
||||
'no developer metrics',
|
||||
)
|
||||
assert.equal(
|
||||
await evaluate(
|
||||
`document.body.textContent.includes('Автоматический сон') || document.body.textContent.includes('HDMI')`,
|
||||
),
|
||||
false,
|
||||
'no permanent technical instructions',
|
||||
)
|
||||
for (const label of [
|
||||
'Проверить изменения',
|
||||
'Обновить снимок результатов',
|
||||
'Подключить выбранную игру',
|
||||
'Подключить управление этой игрой',
|
||||
'Повторить с начала',
|
||||
])
|
||||
assert.equal(
|
||||
await evaluate(
|
||||
`Array.from(document.querySelectorAll('button')).some(b => b.textContent.trim() === ${JSON.stringify(label)})`,
|
||||
),
|
||||
false,
|
||||
'removed button: ' + label,
|
||||
)
|
||||
varyGames = true
|
||||
for (let refresh = 0; refresh < 5; refresh++) {
|
||||
await poll(
|
||||
@@ -312,13 +338,13 @@ module.exports = async function onlineSmoke({
|
||||
await poll(
|
||||
() =>
|
||||
evaluate(`(() => {
|
||||
const select = Array.from(document.querySelectorAll('.n-base-selection')).find(e => e.textContent.includes('Выберите игру для подготовки'))
|
||||
const select = Array.from(document.querySelectorAll('.n-base-selection')).find(e => e.textContent.includes('Выберите игру'))
|
||||
return !!select && !select.classList.contains('n-base-selection--disabled') && !document.body.textContent.includes('Список игр пока пуст')
|
||||
})()`),
|
||||
'updated game list rendered',
|
||||
)
|
||||
await evaluate(
|
||||
`Array.from(document.querySelectorAll('.n-base-selection')).find(e => e.textContent.includes('Выберите игру для подготовки')).click()`,
|
||||
`Array.from(document.querySelectorAll('.n-base-selection')).find(e => e.textContent.includes('Выберите игру')).click()`,
|
||||
)
|
||||
await poll(
|
||||
() =>
|
||||
@@ -361,7 +387,19 @@ module.exports = async function onlineSmoke({
|
||||
'anywhere',
|
||||
)
|
||||
invalidStory = false
|
||||
await act({ action: 'connect', gameId: 6 })
|
||||
await poll(
|
||||
() =>
|
||||
evaluate(`(() => {
|
||||
const button = Array.from(document.querySelectorAll('button')).find(b => b.textContent.trim() === 'Подключить')
|
||||
if (!button || button.disabled) return false
|
||||
button.click(); return true
|
||||
})()`),
|
||||
'single connect button',
|
||||
)
|
||||
await poll(
|
||||
async () => !!(await evaluate('window.screenBridge.onlineState()')).screenId,
|
||||
'selected game connected',
|
||||
)
|
||||
const packages = await evaluate('window.screenBridge.packages()')
|
||||
const pkg = packages.find((p) => p.name === 'HTTP smoke')
|
||||
assert.ok(pkg)
|
||||
@@ -444,7 +482,10 @@ module.exports = async function onlineSmoke({
|
||||
async () => (await state()).channels.main.status === 'playing',
|
||||
'new command after incident',
|
||||
)
|
||||
await act({ action: 'results' })
|
||||
remoteMode = 6
|
||||
currentCommand = 0
|
||||
version++
|
||||
await poll(async () => !!(await state()).results, 'results refresh automatically')
|
||||
assert.equal((await state()).results.teams[0].name, 'Детективы')
|
||||
assert.equal(JSON.stringify(await state()).includes('PRIVATE'), false)
|
||||
for (const method of [
|
||||
@@ -592,6 +633,10 @@ module.exports = async function onlineSmoke({
|
||||
await poll(async () => (await state()).timer.status === 'running', 'plan timer start')
|
||||
await clickPlan('Пауза')
|
||||
await poll(async () => (await state()).timer.status === 'paused', 'plan timer pause')
|
||||
await clickPlan('Продолжить')
|
||||
await poll(async () => (await state()).timer.status === 'running', 'plan timer resumes')
|
||||
await clickPlan('Сбросить')
|
||||
await poll(async () => (await state()).timer.status === 'stopped', 'plan timer resets')
|
||||
await clickPlan('Редактировать')
|
||||
await evaluate(`document.querySelector('[aria-label="Поднять шаг 3"]').click()`)
|
||||
await clickPlan('Сохранить план')
|
||||
@@ -664,7 +709,10 @@ module.exports = async function onlineSmoke({
|
||||
'delete confirmation ' + title,
|
||||
)
|
||||
}
|
||||
await clickMusic('Обновить плейлисты')
|
||||
await poll(
|
||||
async () => (await evaluate('window.screenBridge.onlineState()')).playlists.length > 0,
|
||||
'library loaded automatically',
|
||||
)
|
||||
await setInput('#new-playlist-name', 'Создан из приложения')
|
||||
await clickMusic('Создать плейлист')
|
||||
await poll(() => library.some((p) => p.name === 'Создан из приложения'), 'playlist created')
|
||||
@@ -740,9 +788,50 @@ module.exports = async function onlineSmoke({
|
||||
assert.equal(afterOrder.desired, 'playing')
|
||||
assert.ok(afterOrder.position >= beforeOrder.position)
|
||||
console.log('SCREEN_MUSIC_PLAN_SMOKE_PASS')
|
||||
await act({ action: 'disconnect' })
|
||||
await poll(
|
||||
() =>
|
||||
evaluate(`(() => {
|
||||
const select = document.querySelector('.connection-content .n-base-selection')
|
||||
select?.dispatchEvent(new MouseEvent('mouseenter'))
|
||||
const clear = select?.querySelector('.n-base-clear__clear')
|
||||
if (!clear) return false
|
||||
clear.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }))
|
||||
clear.click(); return true
|
||||
})()`),
|
||||
'clear game selection',
|
||||
)
|
||||
await poll(
|
||||
() =>
|
||||
evaluate(
|
||||
`document.querySelector('.connection-content .n-base-selection')?.textContent.includes('Выберите игру')`,
|
||||
),
|
||||
'server selection cleared',
|
||||
)
|
||||
await poll(
|
||||
() =>
|
||||
evaluate(`(() => {
|
||||
const button = Array.from(document.querySelectorAll('button')).find(b => b.textContent.trim() === 'Подключить')
|
||||
if (!button || button.disabled) return false
|
||||
button.click(); return true
|
||||
})()`),
|
||||
'connect current prepared game',
|
||||
)
|
||||
await poll(
|
||||
async () => (await evaluate('window.screenBridge.onlineState()')).connection === 'connected',
|
||||
'current game reconnected',
|
||||
)
|
||||
assert.equal((await state()).catalog.name, 'HTTP smoke')
|
||||
|
||||
await act({ action: 'logout' })
|
||||
assert.equal((await evaluate('window.screenBridge.onlineState()')).authenticated, false)
|
||||
await poll(
|
||||
() =>
|
||||
evaluate(
|
||||
`document.querySelector('[data-testid="control-game"]')?.textContent.includes('HTTP smoke')`,
|
||||
),
|
||||
'current local game stays visible after logout',
|
||||
)
|
||||
console.log('SCREEN_ONLINE_SMOKE_PASS', JSON.stringify({ polls, requests: requests.length }))
|
||||
} finally {
|
||||
server.closeAllConnections()
|
||||
|
||||
Reference in New Issue
Block a user