fix(e2e): update fairDrawWalletCredit test for WalletCard's corrected no-balance-yet policy
This commit is contained in:
1 parent
6461b783b0
commit
c9a0b466d6
1 file changed
+14
-8
@@ -9,7 +9,8 @@
|
||||
// the one source of entropy `RevealDraw`'s production path uses; the real
|
||||
// commit/reveal/verify/drawOutcome functions all still run for real). The
|
||||
// WalletCard's compact balance chip (visible on the mini-app route itself,
|
||||
// no navigation/reload) is asserted to update live from "0" to the real
|
||||
// no navigation/reload) is asserted to update live from "No balance yet"
|
||||
// (the honest starting state for a fresh identity) to the real
|
||||
// FAIR_DRAW_PRIZE_AMOUNT, then a client-side-only navigation to "/" (same
|
||||
// SPA, no page reload - the WalletCard <section> stays mounted the whole
|
||||
// time per AppRoutes.test.tsx's own DOM-identity guarantee) reveals the
|
||||
@@ -17,8 +18,9 @@
|
||||
//
|
||||
// FAILURE/non-winner: the same deterministic override instead forces a
|
||||
// DIFFERENT participant ("Resident D") to win. The device's own wallet
|
||||
// (WalletCard) must stay at "0 / No transactions yet" - a losing
|
||||
// participant's wallet is never touched.
|
||||
// (WalletCard) must stay at "No balance yet / No transactions yet" - a
|
||||
// losing participant's wallet is never touched.
|
||||
|
||||
import { chromium } from "playwright";
|
||||
import { createServer as createViteServer } from "vite";
|
||||
import * as ed from "@noble/ed25519";
|
||||
@@ -218,8 +220,10 @@ async function runNonWinnerPath(browser) {
|
||||
);
|
||||
const initialBalance = await page.getByTestId("wallet-balance").innerText();
|
||||
evidence.steps.initialBalanceOnHome = { initialBalance };
|
||||
if (initialBalance !== "0") {
|
||||
throw new Error(`non-winner: expected a fresh identity's starting balance to read "0", got "${initialBalance}"`);
|
||||
if (initialBalance !== "No balance yet") {
|
||||
throw new Error(
|
||||
`non-winner: expected a fresh identity's starting balance to read "No balance yet" (WalletCard never fabricates a "0" for an account the ledger has not seen), got "${initialBalance}"`,
|
||||
);
|
||||
}
|
||||
|
||||
const { winnerText, badgeState } = await runDraw(page);
|
||||
@@ -239,10 +243,12 @@ async function runNonWinnerPath(browser) {
|
||||
const balanceAfterLoss = await page.getByTestId("wallet-balance").innerText();
|
||||
evidence.steps.ownWalletUnaffectedOnFairDrawRoute = {
|
||||
balanceAfterLoss,
|
||||
stillZero: balanceAfterLoss === "0",
|
||||
stillNoBalanceYet: balanceAfterLoss === "No balance yet",
|
||||
};
|
||||
if (balanceAfterLoss !== "0") {
|
||||
throw new Error(`non-winner: expected your own wallet to stay "0" after losing, got "${balanceAfterLoss}"`);
|
||||
if (balanceAfterLoss !== "No balance yet") {
|
||||
throw new Error(
|
||||
`non-winner: expected your own wallet to stay "No balance yet" after losing (no wallet.issue event ever touched this account), got "${balanceAfterLoss}"`,
|
||||
);
|
||||
}
|
||||
|
||||
await page.getByRole("link", { name: "Back to home" }).click();
|
||||
|
||||
Reference in new issue
Block a user