Keep the expedition view in sync with other players and only send alerts players still want

- The expeditions page rereads its view on its own: every 10 seconds while a
  group is shown, every 20 seconds otherwise, on tab return and at the next
  recruitment deadline; late responses no longer overwrite a newer action. A
  failed load offers "Réessayer" and a failed refresh keeps the last view.
- The periodic alert pass first departs groups whose recruitment ended, so
  their return is announced even if nobody visits the site.
- Queued alerts are checked again at sending time: a player who opted out or
  alerts switched off by the administration drop the message for good.
- The engraving confirmation sticks to the bottom of its window, the workshop
  lists commons by spare count, the guild expeditions card shows the Great
  Void, and stale help texts and comments are fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-18 15:24:39 +01:00
parent 30413de036
commit 84b0d69b1f
13 changed files with 174 additions and 24 deletions

View file

@ -1857,6 +1857,8 @@ 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);
const clockFile = join(tmpdir(), "sokkog-cards-e2e-clock.json");
const setServerClock = (offsetMs) => writeFile(clockFile, JSON.stringify({ offsetMs }));
await setServerClock(0);
@ -1971,9 +1973,30 @@ test("an administrator opens expeditions and a player leaves alone, follows the
await expect(groupCard).toContainText("ouvert par vous");
await expect(groupCard.locator(".nebula-expedition-group-free")).toHaveCount(3);
await expect(groupCard.getByRole("textbox", { name: /^Lien d’invitation/ })).toHaveValue(/#\/cards\/expeditions\/[\w-]+$/);
// Un second écran sur la même page suit le groupe sans être rechargé : il voit l'annulation, puis un nouveau groupe et son départ.
// Son premier chargement échoue : l'erreur propose « Réessayer », qui rétablit la page.
const watcher = await partnerContext.newPage();
let failures = 1;
await watcher.route("**/api/cards/expeditions", (route) => (route.request().method() === "GET" && failures-- > 0
? route.fulfill({ status: 503, contentType: "application/json", body: JSON.stringify({ error: { code: "UNAVAILABLE", message: "Service indisponible." } }) })
: route.continue()));
await watcher.goto("/#/cards/expeditions");
await expect(watcher.getByRole("alert")).toContainText("Service indisponible.");
await watcher.getByRole("button", { name: "Réessayer", exact: true }).click();
const watched = watcher.getByRole("region", { name: "Votre expédition en préparation" });
await expect(watched).toBeVisible();
await groupCard.getByRole("button", { name: "Annuler l’expédition", exact: true }).click();
await expect(mine).toHaveCount(0);
await expect(partner.getByRole("region", { name: "1. Destination du jour" })).toBeVisible();
await expect(watched).toHaveCount(0, { timeout: 15_000 });
await partner.getByRole("region", { name: "2. Votre carte" }).getByRole("button", { name: "Choisir une carte", exact: true }).click();
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 });
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);
await watcher.close();
// Pont des Veilleurs, en boutique : 3 poussières pour 1 Éclat ; la fiche de carte montre le niveau, la Puissance et l'expérience gagnée au retour.
// Le Sac du Veilleur n'apparaît que s'il contient des objets.