Let players who join a group set up their card and say when they are ready
Joining a group froze the card's stats at once and locked its equipment, so a joining player could not equip anything. Joining now uses the same card frame as the preparation: card, equipment and "Améliorer la carte". Everything stays editable after joining, and the group counts the card as it is, until the player clicks "Prêt". That freezes the card's stats. "Modifier ma préparation" reopens it. The creator sees each member as "Prêt" or "En préparation", with a ready count, and can still leave at any time. A player who is not ready leaves with their card as it is at departure. A migration marks existing members as ready, since their stats were already frozen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
dac0bdd6a7
commit
c73a118ffb
16 changed files with 272 additions and 50 deletions
|
|
@ -1919,8 +1919,9 @@ test("a player finds the daily card with hints and copies the result", async ({
|
|||
|
||||
// Dernier parcours : il ouvre les Expéditions et décale l'horloge du serveur, deux réglages globaux qu'il remet en place à la fin.
|
||||
test("an administrator opens expeditions and a player leaves alone, follows the journey, then claims its loot", async ({ browser, page }) => {
|
||||
// Le suivi d'un groupe depuis un second écran attend les relectures périodiques de la vue (jusqu'à 20 s).
|
||||
test.setTimeout(120_000);
|
||||
// Le suivi d'un groupe depuis un second écran, puis par son créateur quand un joueur rejoint, attend les relectures périodiques de
|
||||
// la vue (jusqu'à 20 s chacune).
|
||||
test.setTimeout(180_000);
|
||||
const clockFile = join(tmpdir(), "sokkog-cards-e2e-clock.json");
|
||||
const setServerClock = (offsetMs) => writeFile(clockFile, JSON.stringify({ offsetMs }));
|
||||
await setServerClock(0);
|
||||
|
|
@ -2060,6 +2061,39 @@ test("an administrator opens expeditions and a player leaves alone, follows the
|
|||
await partner.getByRole("dialog", { name: "Choisir la carte envoyée" }).getByRole("button", { name: /^Choisir Loup des Aurores$/ }).click();
|
||||
await partner.getByRole("button", { name: "Ouvrir au groupe", exact: true }).click();
|
||||
await expect(watched).toBeVisible({ timeout: 30_000 });
|
||||
// Un autre joueur rejoint : il choisit sa carte dans le même cadre que la préparation, avec ses équipements, puis se dit prêt ; le
|
||||
// créateur voit son état passer de « En préparation » à « Prêt ».
|
||||
const { path: groupDatabasePath } = JSON.parse(await readFile(join(tmpdir(), "sokkog-cards-e2e-db.json"), "utf8"));
|
||||
const groupDatabase = new DatabaseSync(groupDatabasePath);
|
||||
groupDatabase.prepare(`INSERT INTO collection_cards(player_id, edition_id, quantity, acquired_at) SELECT id, 'crimson-moon-kitsune-standard', 1, 0 FROM players WHERE discord_id = 'dev-admin'
|
||||
ON CONFLICT(player_id, edition_id) DO NOTHING`).run();
|
||||
groupDatabase.close();
|
||||
await page.goto("/#/cards/expeditions");
|
||||
// Première visite de ce joueur : la Guilde lui offre d'abord sa carte de destination de départ.
|
||||
await page.getByRole("dialog").getByRole("button", { name: "Préparer mon expédition", exact: true }).click();
|
||||
const openGroups = page.getByRole("region", { name: "Rejoindre une expédition", exact: true });
|
||||
await openGroups.getByRole("button", { name: "Rejoindre", exact: true }).click();
|
||||
const joinLoadout = openGroups.getByRole("region", { name: "Votre carte pour cette expédition", exact: true });
|
||||
await expect(joinLoadout.getByRole("region", { name: "Équipements", exact: true })).toBeVisible();
|
||||
await expect(joinLoadout.getByRole("button", { name: "Rejoindre l’expédition", exact: true })).toBeDisabled();
|
||||
await joinLoadout.getByRole("button", { name: "Choisir une carte", exact: true }).click();
|
||||
await page.getByRole("dialog", { name: "Choisir la carte envoyée" }).getByRole("button", { name: /^Choisir Kitsune/ }).click();
|
||||
await expect(joinLoadout.getByRole("button", { name: "Améliorer la carte", exact: true })).toBeVisible();
|
||||
await joinLoadout.getByRole("button", { name: "Rejoindre l’expédition", exact: true }).click();
|
||||
await expect(page.getByRole("status").filter({ hasText: "Vous avez rejoint l’expédition" })).toBeVisible();
|
||||
const joinedGroup = page.getByRole("region", { name: "Votre expédition en préparation" });
|
||||
const ownLoadout = joinedGroup.getByRole("region", { name: "Votre carte pour cette expédition", exact: true });
|
||||
await expect(ownLoadout.getByRole("region", { name: "Équipements", exact: true })).toBeVisible();
|
||||
const creatorMembers = groupCard.getByRole("region", { name: "Membres du groupe", exact: true });
|
||||
await expect(creatorMembers).toContainText("En préparation", { timeout: 15_000 });
|
||||
await groupCard.screenshot({ path: join(tmpdir(), "sokkog-cards-group-preparing.png") });
|
||||
await ownLoadout.screenshot({ path: join(tmpdir(), "sokkog-cards-group-own-loadout.png") });
|
||||
await ownLoadout.getByRole("button", { name: "Prêt", exact: true }).click();
|
||||
await expect(page.getByRole("status").filter({ hasText: "Le groupe sait que vous êtes prêt." })).toBeVisible();
|
||||
await expect(ownLoadout).toContainText("Vous êtes prêt avec");
|
||||
await expect(ownLoadout.getByRole("region", { name: "Équipements", exact: true })).toHaveCount(0);
|
||||
await expect(creatorMembers).not.toContainText("En préparation", { timeout: 15_000 });
|
||||
await expect(groupCard).toContainText("Prêts : 2 sur 2.");
|
||||
await mine.getByRole("button", { name: "Partir maintenant", exact: true }).click();
|
||||
await expect(watcher.locator(".nebula-expedition-journey")).toBeVisible({ timeout: 15_000 });
|
||||
await expect(watched).toHaveCount(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue