Fifteen shop components: PriceTag, Wallet, ShopItem, Cart, Receipt, Checkout, CurrencyConvert, SaleBadge, Quantity, PricingTiers, Coupon, DailyReward, BidTicker, TradeWindow and VendingMachine. Receipt prints dot by dot with feed holes and a torn edge; Coupon cuts real notches; SaleBadge is a sixteen-point starburst; VendingMachine sells A1 to D4 by code and drops the snack into its tray. Sums are checked against overflow, TradeWindow withdraws both confirms on any change to an offer, and a disabled Checkout veils its inert content. text.Odometer now counts digits as text, steps at 15 fps as S5 asks, draws exact digits at rest and lands rolls that floats would stall.
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package gallery
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestShopDemosLogTheirActions(t *testing.T) {
|
|
// Clicks that only focus a component may log nothing.
|
|
quiet := map[string]bool{"Potions": true, "KEYPAD": true}
|
|
for _, tc := range []struct {
|
|
path string
|
|
steps []string
|
|
}{
|
|
{"/c/437-wallet", []string{"FIND GOLD"}}, {"/c/438-shopitem", []string{"BUY POTION"}},
|
|
{"/c/439-cart", []string{"REMOVE ETHER"}}, {"/c/441-checkout", []string{"NEXT ▶"}},
|
|
{"/c/442-currencyconvert", []string{"CONVERT"}}, {"/c/444-quantity", []string{"Potions", "key:Right"}},
|
|
{"/c/445-pricingtiers", []string{"SILVER, 5 GEMS"}}, {"/c/446-coupon", []string{"COPY"}},
|
|
{"/c/447-dailyreward", []string{"CLAIM"}}, {"/c/449-tradewindow", []string{"CONFIRM", "BROM CONFIRMS"}},
|
|
{"/c/450-vendingmachine", []string{"INSERT COIN"}},
|
|
} {
|
|
a, tt := open(tc.path)
|
|
slug := tc.path[3:]
|
|
for _, step := range tc.steps {
|
|
before := len(a.logs[slug])
|
|
if k, ok := strings.CutPrefix(step, "key:"); ok {
|
|
tt.Key(0, letters[k])
|
|
} else {
|
|
click(t, tt, step)
|
|
}
|
|
if len(a.logs[slug]) <= before && !quiet[step] {
|
|
t.Errorf("%s: %s logged nothing: %q", slug, step, a.logs[slug])
|
|
}
|
|
}
|
|
}
|
|
}
|