feat(newgame): skip the take-a-seat prompt for a guest offline host

A guest host has no meaningful display name to seat, so the offline 'with friends' flow's
"do you take a seat?" prompt only produced a nameless seat. For a guest the prompt is skipped:
after the master PIN, the two empty player seats show directly. A durable host is still asked.
This commit is contained in:
Ilia Denisov
2026-07-15 02:17:13 +02:00
parent aa803260a1
commit 896b7f57a7
2 changed files with 8 additions and 4 deletions
+4 -3
View File
@@ -97,14 +97,15 @@ test.describe('native offline-first', () => {
await expectOfflineGuestLobby(page); await expectOfflineGuestLobby(page);
// New game -> the offline mode selector offers "with friends" (pass-and-play) to the local guest. // New game -> the offline mode selector offers "with friends" (pass-and-play) to the local guest.
// A minimal create: set the mandatory host (master) PIN, decline a seat, the sole offered variant // A minimal create: set the mandatory host (master) PIN. A guest host skips the "do you take a
// (Erudit — the profileless guest's default), two open seats. // seat?" prompt (no name to seat) and goes straight to the two open seats, so pick the sole
// offered variant (Erudit — the profileless guest's default) right after the PIN.
await page.locator('button.tab').nth(0).click(); await page.locator('button.tab').nth(0).click();
await page.getByRole('button', { name: /With friends|друзьями/i }).click(); await page.getByRole('button', { name: /With friends|друзьями/i }).click();
await page.locator('.hostpin .plink').click(); await page.locator('.hostpin .plink').click();
await typePin(page, '9999'); await typePin(page, '9999');
await typePin(page, '9999'); await typePin(page, '9999');
await page.getByRole('button', { name: /^(No|Нет)$/ }).click(); await expect(page.getByRole('button', { name: /^(No|Нет)$/ })).toHaveCount(0); // no seat prompt for a guest
await page.locator('.variant').click(); await page.locator('.variant').click();
await page.locator('.pname').nth(0).fill('Ann'); await page.locator('.pname').nth(0).fill('Ann');
await page.locator('.pname').nth(1).fill('Bob'); await page.locator('.pname').nth(1).fill('Bob');
+4 -1
View File
@@ -265,7 +265,10 @@
case 'host-set': case 'host-set':
if (r.kind === 'set') { if (r.kind === 'set') {
hostPin = r.lock; hostPin = r.lock;
askHostPlays = true; // A guest host has no meaningful display name to seat, so the "do you take a seat?"
// prompt would only produce a nameless seat — skip it and go straight to the (empty)
// player seats. A durable host is still asked.
if (!guest) askHostPlays = true;
} }
break; break;
case 'host-change': case 'host-change':