퀴즈 중 새로고침해도 이어서: 같은 계정이 돌아오면 노래가 나오는 중엔 catchup(서버 시작 시각·위치)으로 소리 끈 채 맞춰 두고 '참가 (소리 켜기)' 누르는 순간 같은 위치에서 재생(다른 사람은 안 멈춤), 준비 중엔 prepare를 다시 보내 그 사람을 기다림(예전엔 문제가 멈출 수 있었음). 지금 문제 정답도 인정. 방장은 끊겨도 15초 유지 후 넘김. 늦게 시작한 play는 지금 위치부터
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Part A uses the fake player (localStorage mq:fakePlayer) so 30 questions run in about a minute without YouTube:
|
||||
* start, synced play, answers by chat (정답 줄 + 5줄 블록 on every screen), scores, past questions, buffering pause for
|
||||
* everyone, skip / hint / replay votes with Ctrl+K / Ctrl+I / Ctrl+R, a broken video swapped, typing indicator,
|
||||
* reconnect mid-game, results with YouTube links, 이어풀기, 다시 하기, phone / dark screens, the last one out closes the room.
|
||||
* reconnect mid-game, refresh while the music runs (catch up in sync), results with YouTube links, 이어풀기, 다시 하기, phone / dark screens, the last one out closes the room.
|
||||
* Part B plays real YouTube Topic videos in two browsers: sound on after the entry click, same start, 3s clip stop.
|
||||
* Run: bun run build && bun e2e/game.e2e.ts (needs /usr/bin/google-chrome; Part B needs internet, skip with E2E_NO_YT=1)
|
||||
*/
|
||||
@@ -213,7 +213,7 @@ try {
|
||||
await answer(6, b);
|
||||
});
|
||||
|
||||
await step('A: 7~30번 — 돌아가며 정답, 15번에 영희 새로고침(다시 소리 켜기 → 다음 문제부터 참가)', async () => {
|
||||
await step('A: 7~30번 — 돌아가며 정답, 15번에 영희 새로고침(다시 소리 켜기 → 그 문제부터 이어서)', async () => {
|
||||
for (let n = 7; n <= 30; n++) {
|
||||
const who = all[n % 3]!;
|
||||
if (n === 15) {
|
||||
@@ -313,6 +313,43 @@ try {
|
||||
await a.getByRole('heading', { name: '🏁 게임 결과' }).waitFor();
|
||||
});
|
||||
|
||||
await step('A: 노래 나오는 중 새로고침 → 소리 켜기 누르면 다른 사람과 같은 위치에서 이어 재생, 다른 사람은 안 멈춤, 바로 정답 가능', async () => {
|
||||
await a.getByRole('button', { name: '↺ 다시 하기' }).click();
|
||||
await a.locator('.pool-banner').waitFor();
|
||||
await a.getByRole('radiogroup', { name: '모드' }).getByRole('radio', { name: /듣고맞추기/ }).click();
|
||||
await a.getByRole('radiogroup', { name: '듣고맞출시간' }).getByRole('radio', { name: '끝까지' }).click();
|
||||
await a.getByRole('radiogroup', { name: '듣고맞출시간' }).getByRole('radio', { name: '끝까지', checked: true }).waitFor();
|
||||
await a.getByRole('button', { name: '게임 시작' }).click();
|
||||
const fewer = a.getByRole('button', { name: '그대로 시작' });
|
||||
if (await fewer.isVisible({ timeout: 1000 }).catch(() => false)) await fewer.click();
|
||||
await Promise.all(all.map((p) => playing(p, 1)));
|
||||
await a.waitForTimeout(1500);
|
||||
const pauses = await a.evaluate(() => document.querySelectorAll('.chat-sys').length);
|
||||
await c.reload();
|
||||
await c.locator('.gbar .q', { hasText: /^문제 1 / }).waitFor({ timeout: 10000 });
|
||||
// a fresh page may not play sound before a click: it waits muted for "참가 (소리 켜기)", the others keep playing
|
||||
await c.getByRole('button', { name: '🔊 참가 (소리 켜기)' }).click({ timeout: 10000 });
|
||||
await c.locator('.stage .lp.spin').waitFor({ timeout: 5000 });
|
||||
await c.waitForTimeout(1200); // past one drift check
|
||||
const [pa, pc, vidA, vidC] = await Promise.all([
|
||||
a.evaluate(() => (window as any).mqPlayer.pos() as number),
|
||||
c.evaluate(() => (window as any).mqPlayer.pos() as number),
|
||||
video(a),
|
||||
video(c),
|
||||
]);
|
||||
console.log(` 새로고침 뒤 위치 방장 ${pa.toFixed(3)} / 영희 ${pc.toFixed(3)}`);
|
||||
expect(vidA === vidC, `다른 곡: ${vidA} / ${vidC}`);
|
||||
expect(pa > 2.5 && Math.abs(pa - pc) < 0.4, `재생 위치가 다름: 방장 ${pa.toFixed(2)}s, 영희 ${pc.toFixed(2)}s`);
|
||||
expect((await a.locator('.stage .lp.spin').count()) > 0, '방장 쪽 음악이 멈춤');
|
||||
expect(!(await a.getByText(/잠시 멈춤/).count()), '다른 사람 화면이 잠시 멈춤');
|
||||
expect((await a.evaluate(() => document.querySelectorAll('.chat-sys').length)) === pauses, '새로고침했는데 시스템 줄이 생김');
|
||||
await answer(1, c);
|
||||
await a.locator('.sb', { hasText: '영희' }).locator('.sc', { hasText: '1' }).waitFor();
|
||||
await a.getByRole('button', { name: '⏹ 끝내기' }).click();
|
||||
await a.getByRole('button', { name: '끝내기', exact: true }).click();
|
||||
await a.getByRole('heading', { name: '🏁 게임 결과' }).waitFor();
|
||||
});
|
||||
|
||||
await step('A: 모두 "← 방 목록"으로 나가면 방이 바로 사라짐', async () => {
|
||||
for (const p of all) {
|
||||
await p.getByRole('link', { name: '← 방 목록' }).click();
|
||||
@@ -366,6 +403,35 @@ try {
|
||||
await x.context().close();
|
||||
await y.context().close();
|
||||
});
|
||||
|
||||
await step('B: 실제 유튜브 — 노래 나오는 중 새로고침 → 소리 켜기 → 다른 사람과 같은 위치에서 소리 나게 이어 재생', async () => {
|
||||
const x = await guestPage('유튜브방장2', { fake: false });
|
||||
const y = await guestPage('유튜브손님2', { fake: false });
|
||||
const rc = await makeRoom(x, { count: 10, level: 9, listenSec: 0, startAt: 'highlight' });
|
||||
await y.goto(`${ORIGIN}/r/${rc}`);
|
||||
await y.locator('.pool-banner').waitFor();
|
||||
for (const p of [x, y]) await p.getByRole('button', { name: '참가 (소리 켜기)' }).click();
|
||||
await x.getByText('조건에 맞는 곡 3곡').waitFor({ timeout: 5000 });
|
||||
await x.getByRole('button', { name: '게임 시작' }).click();
|
||||
await x.getByRole('button', { name: '그대로 시작' }).click();
|
||||
await Promise.all([x, y].map((p) => playing(p, 1, 40000)));
|
||||
await x.waitForTimeout(3000);
|
||||
await y.reload();
|
||||
await y.getByRole('button', { name: '🔊 참가 (소리 켜기)' }).click({ timeout: 30000 });
|
||||
await y.locator('.stage .lp.spin').waitFor({ timeout: 15000 });
|
||||
await y.waitForTimeout(2500);
|
||||
const st = await Promise.all([x, y].map((p) => p.evaluate(() => ({ pos: (window as any).mqPlayer.pos(), muted: (window as any).mqPlayer.muted(), state: (window as any).mqPlayer.state(), v: (window as any).mqPlayer.video() }))));
|
||||
console.log(` 새로고침 뒤 위치 ${st.map((s) => s.pos.toFixed(3)).join(' / ')}`);
|
||||
expect(st[0]!.v === st[1]!.v, `다른 곡 ${JSON.stringify(st)}`);
|
||||
expect(st.every((s) => s.state === 1 && !s.muted), `재생 상태 ${JSON.stringify(st)}`);
|
||||
expect(Math.abs(st[0]!.pos - st[1]!.pos) < 0.4, `두 사람 위치 차이 ${JSON.stringify(st)}`);
|
||||
expect(!(await x.getByText(/잠시 멈춤/).count()), '방장 화면이 멈춤');
|
||||
await x.getByRole('button', { name: '⏹ 끝내기' }).click();
|
||||
await x.getByRole('button', { name: '끝내기', exact: true }).click();
|
||||
await x.getByRole('heading', { name: '🏁 게임 결과' }).waitFor();
|
||||
await x.context().close();
|
||||
await y.context().close();
|
||||
});
|
||||
}
|
||||
|
||||
expect(errors.length === 0, `페이지 오류: ${errors.join(' | ')}`);
|
||||
|
||||
Reference in New Issue
Block a user