commit 19b83259d14721c1fb39dea543704696738799d2
parent 3cb0cca6a6c5cc6369a02a4d66460c9b9f6f29a3
Author: anon <anon@example.com>
Date: Sun, 8 Nov 2026 05:11:46 +0000
Repair browser test fixtures and record paused verification
Diffstat:
13 files changed, 54 insertions(+), 18 deletions(-)
diff --git a/server/browser_aimed_shot_test.go b/server/browser_aimed_shot_test.go
@@ -64,14 +64,19 @@ func TestBrowserAimedShot(t *testing.T) {
if err := world.flushWorld(); err != nil {
t.Fatal(err)
}
- // Keep ordinary attacks and recovery beyond this focused special-action check.
- player.rechargeUntil = time.Now().Add(5 * time.Minute)
- target.rechargeUntil, target.regenerationAt = player.rechargeUntil, player.rechargeUntil
+ // Keep target attacks and recovery beyond this focused special-action check.
+ target.rechargeUntil = time.Now().Add(5 * time.Minute)
+ target.regenerationAt = target.rechargeUntil
target.motion.roaming = false
targetID := target.id
shutdown := startTestService(t, world)
mux := http.NewServeMux()
mux.Handle("/", world.httpHandler())
+ // Suppress ordinary player attacks only after the real equipment action.
+ mux.HandleFunc("POST /test-hold-attacks", testPlayerHTTP(world, 2, func(world *server, w http.ResponseWriter, r *http.Request) {
+ world.characters[2].rechargeUntil = time.Now().Add(5 * time.Minute)
+ w.WriteHeader(http.StatusNoContent)
+ }))
mux.HandleFunc("GET /test-state", testPlayerHTTP(world, 2, func(world *server, w http.ResponseWriter, r *http.Request) {
player, target := world.characters[2], world.characters[targetID]
json.NewEncoder(w).Encode(map[string]any{"target": target.id, "health": target.health, "fighting": player.fighting,
diff --git a/server/browser_backpack_equipment_test.go b/server/browser_backpack_equipment_test.go
@@ -38,6 +38,7 @@ func TestBrowserBackpackEquipment(t *testing.T) {
}
}
player := world.characters[1]
+ observer := world.characters[2]
inventory := playerInventory{LastID: 32, Items: []ownedItem{
{ID: 1, Type: 51017, Template: 99228, Quality: 1, Slot: 64, Count: 1}},
Containers: map[uint32][]ownedItem{1: {
@@ -112,7 +113,7 @@ func TestBrowserBackpackEquipment(t *testing.T) {
slices.SortFunc(expected.Items, func(first, second ownedItem) int { return cmp.Compare(first.ID, second.ID) })
cold := newTestInventoryServer(t)
if !reflect.DeepEqual(cold.characters[1].inventory, expected) ||
- cold.nextItem != 32 || len(world.characters[2].inventory.Items) != 0 {
+ cold.nextItem != 32 || len(observer.inventory.Items) != 0 {
t.Fatal("direct contained equipment lost or duplicated ownership")
}
}
diff --git a/server/browser_basic_shop_nanos_test.go b/server/browser_basic_shop_nanos_test.go
@@ -86,6 +86,10 @@ func testBrowserBasicShopNanos(t *testing.T, fixtures []basicShopNanoFixture) {
if petLevel == 0 {
target.rechargeUntil = time.Now().Add(5 * time.Minute)
}
+ // Persist the fixture's cross-zone relocation before partitioning owners.
+ if err := world.flushWorld(); err != nil {
+ t.Fatal(err)
+ }
shutdown := startTestService(t, world)
mux := http.NewServeMux()
mux.Handle("/", world.httpHandler())
diff --git a/server/browser_basic_shop_weapons_test.go b/server/browser_basic_shop_weapons_test.go
@@ -75,6 +75,10 @@ func TestBrowserBasicShopWeapons(t *testing.T) {
targetID := target.id
target.motion.roaming = false
target.regenerationAt = time.Now().Add(5 * time.Minute)
+ // Persist the fixture's cross-zone relocation before partitioning owners.
+ if err := world.flushWorld(); err != nil {
+ t.Fatal(err)
+ }
shutdown := startTestService(t, world)
mux := http.NewServeMux()
mux.Handle("/", world.httpHandler())
diff --git a/server/browser_brawl_test.go b/server/browser_brawl_test.go
@@ -62,14 +62,19 @@ func TestBrowserBrawl(t *testing.T) {
if err := world.flushWorld(); err != nil {
t.Fatal(err)
}
- // Keep ordinary attacks and recovery beyond this focused special-action check.
- player.rechargeUntil = time.Now().Add(5 * time.Minute)
- target.rechargeUntil, target.regenerationAt = player.rechargeUntil, player.rechargeUntil
+ // Keep target attacks and recovery beyond this focused special-action check.
+ target.rechargeUntil = time.Now().Add(5 * time.Minute)
+ target.regenerationAt = target.rechargeUntil
target.motion.roaming = false
targetID := target.id
shutdown := startTestService(t, world)
mux := http.NewServeMux()
mux.Handle("/", world.httpHandler())
+ // Suppress ordinary player attacks only after the real equipment action.
+ mux.HandleFunc("POST /test-hold-attacks", testPlayerHTTP(world, 2, func(world *server, w http.ResponseWriter, r *http.Request) {
+ world.characters[2].rechargeUntil = time.Now().Add(5 * time.Minute)
+ w.WriteHeader(http.StatusNoContent)
+ }))
mux.HandleFunc("GET /test-state", testPlayerHTTP(world, 2, func(world *server, w http.ResponseWriter, r *http.Request) {
player, target := world.characters[2], world.characters[targetID]
json.NewEncoder(w).Encode(map[string]any{"target": target.id, "health": target.health, "fighting": player.fighting,
diff --git a/server/browser_burst_test.go b/server/browser_burst_test.go
@@ -61,14 +61,19 @@ func TestBrowserBurst(t *testing.T) {
if err := world.flushWorld(); err != nil {
t.Fatal(err)
}
- // Keep ordinary attacks and recovery beyond this focused special-action check.
- player.rechargeUntil = time.Now().Add(5 * time.Minute)
- target.rechargeUntil, target.regenerationAt = player.rechargeUntil, player.rechargeUntil
+ // Keep target attacks and recovery beyond this focused special-action check.
+ target.rechargeUntil = time.Now().Add(5 * time.Minute)
+ target.regenerationAt = target.rechargeUntil
target.motion.roaming = false
targetID := target.id
shutdown := startTestService(t, world)
mux := http.NewServeMux()
mux.Handle("/", world.httpHandler())
+ // Suppress ordinary player attacks only after the real equipment action.
+ mux.HandleFunc("POST /test-hold-attacks", testPlayerHTTP(world, 2, func(world *server, w http.ResponseWriter, r *http.Request) {
+ world.characters[2].rechargeUntil = time.Now().Add(5 * time.Minute)
+ w.WriteHeader(http.StatusNoContent)
+ }))
mux.HandleFunc("GET /test-state", testPlayerHTTP(world, 2, func(world *server, w http.ResponseWriter, r *http.Request) {
player, target := world.characters[2], world.characters[targetID]
json.NewEncoder(w).Encode(map[string]any{"target": target.id, "health": target.health, "fighting": player.fighting,
diff --git a/server/browser_depleted_backpack_split_test.go b/server/browser_depleted_backpack_split_test.go
@@ -33,7 +33,7 @@ func TestBrowserDepletedBackpackSplit(t *testing.T) {
if err := world.saveUser(peer); err != nil {
t.Fatal(err)
}
- world.clients[2] = &worldClient{id: 2, target: true, ready: true, conn: &combatTestConn{}}
+ world.clients[2] = &worldClient{id: 2, target: true, ready: true, conn: &combatTestConn{}, npcs: make(map[uint32]bool)}
inventory := playerInventory{LastID: 2, Items: []ownedItem{
{ID: 1, Type: 51017, Template: 99228, Quality: 1, Slot: 64, Count: 1}},
Containers: map[uint32][]ownedItem{1: {
diff --git a/tools/client/test_aimed_shot.mjs b/tools/client/test_aimed_shot.mjs
@@ -27,9 +27,11 @@ try {
const cell = game.state.grids.flatMap(grid => grid.cells).find(cell => cell.identity[0] === 104 && cell.identity[1] === 51 && !cell.dummy);
assert(cell, 'issued or stocked rifle is visible');
await game.click((cell.bounds[0]+cell.bounds[2])/2, (cell.bounds[1]+cell.bounds[3])/2, 'right');
- await waitServer('rifle equipped normally', state => state.inventory.Items.some(item => item.ID === 4 && item.Slot === 6));
+ await waitServer('rifle equipped normally', state => state.inventory.Items.some(item =>
+ item.ID === evidence.initial.inventory.Items[3].ID && item.Slot === 6));
await game.wait('native equipped weapon ready', state => game.local(state).weapons.some(weapon => weapon.slot === 6));
evidence.equipped = await server();
+ assert.equal((await page.request.post(url + '/test-hold-attacks')).status(), 204);
await page.keyboard.press('Control+2');
await game.wait('native command grid opens', state => state.grids.some(grid => grid.cells.some(cell => cell.identity[0] === 57008 && cell.identity[1] === 49575 && !cell.dummy)));
await game.save(output + '/commands');
diff --git a/tools/client/test_backyard_bank.mjs b/tools/client/test_backyard_bank.mjs
@@ -19,7 +19,8 @@ try {
await page.goto(url);
await game.ready();
if (phase === 'live' && index === 0) await game.walk(109.204704, 150.720703);
- if (!game.state.camera.firstPerson) await game.hold('F8', 'native first-person camera', snapshot => snapshot.camera.firstPerson);
+ if (!game.state.camera.firstPerson) await game.key('F8');
+ await game.wait('native first-person camera', snapshot => snapshot.camera.firstPerson);
await game.save(output + '/' + index + '/approach');
const [px, py] = await game.pick(51005, id);
await game.click(px, py, 'right');
@@ -52,7 +53,8 @@ try {
await page.reload();
await game.ready();
assert(game.local().inventory.some(item => item.id === index + 1 && item.slot === 48));
- if (!game.state.camera.firstPerson) await game.hold('F8', 'reconnected first-person camera', snapshot => snapshot.camera.firstPerson);
+ if (!game.state.camera.firstPerson) await game.key('F8');
+ await game.wait('reconnected first-person camera', snapshot => snapshot.camera.firstPerson);
const [x, y] = await game.pick(51005, id);
await game.click(x, y, 'right');
await game.wait('reconnected native bank open', snapshot => snapshot.regions.some(region =>
diff --git a/tools/client/test_basic_shop_nanos.mjs b/tools/client/test_basic_shop_nanos.mjs
@@ -31,8 +31,7 @@ try {
const open = async keyboard => {
await game.click(...await game.pick(51035, initial.machine), keyboard ? 'left' : 'right');
if (keyboard) await game.key('KeyE');
- await game.wait('original crystal catalog visible', () =>
- Array.from({length: initial.rows}, (_, index) => cell(111, index)).every(Boolean));
+ await game.wait('requested crystal visible in the catalog', () => cell(111, initial.row));
};
await open(false);
await game.save(output + '/catalog');
diff --git a/tools/client/test_brawl.mjs b/tools/client/test_brawl.mjs
@@ -28,10 +28,12 @@ try {
const cell = game.state.grids.flatMap(grid => grid.cells).find(cell => cell.identity[0] === 104 && cell.identity[1] === 51 && !cell.dummy);
assert(cell, 'stocked Sledgehammer is visible');
await game.click((cell.bounds[0]+cell.bounds[2])/2, (cell.bounds[1]+cell.bounds[3])/2, 'right');
- await waitServer('Sledgehammer equipped normally', state => state.inventory.Items.some(item => item.ID === 4 && item.Slot === 6));
+ await waitServer('Sledgehammer equipped normally', state => state.inventory.Items.some(item =>
+ item.ID === evidence.initial.inventory.Items[3].ID && item.Slot === 6));
await game.wait('native equipped weapon ready', state => game.local(state).weapons.some(weapon => weapon.slot === 6));
}
evidence.equipped = await server();
+ assert.equal((await page.request.post(url + '/test-hold-attacks')).status(), 204);
await game.key('Tab');
await game.wait('original Leet selected', state => state.selected[0] === 50000 && state.selected[1] === evidence.initial.target);
await game.key('KeyQ');
diff --git a/tools/client/test_burst.mjs b/tools/client/test_burst.mjs
@@ -28,9 +28,11 @@ try {
const cell = game.state.grids.flatMap(grid => grid.cells).find(cell => cell.identity[0] === 104 && cell.identity[1] === 51 && !cell.dummy);
assert(cell, 'issued or stocked SMG is visible');
await game.click((cell.bounds[0]+cell.bounds[2])/2, (cell.bounds[1]+cell.bounds[3])/2, 'right');
- await waitServer('SMG equipped normally', state => state.inventory.Items.some(item => item.ID === 4 && item.Slot === 6));
+ await waitServer('SMG equipped normally', state => state.inventory.Items.some(item =>
+ item.ID === evidence.initial.inventory.Items[3].ID && item.Slot === 6));
await game.wait('native equipped weapon ready', state => game.local(state).weapons.some(weapon => weapon.slot === 6));
evidence.equipped = await server();
+ assert.equal((await page.request.post(url + '/test-hold-attacks')).status(), 204);
await game.key('Tab');
await game.wait('original Leet selected', state => state.selected[0] === 50000 && state.selected[1] === evidence.initial.target);
await game.key('KeyQ');
diff --git a/tools/client/test_concrete_cushion.mjs b/tools/client/test_concrete_cushion.mjs
@@ -119,6 +119,11 @@ try {
await owner.wait('weapon panel closed', snapshot => !snapshot.regions.some(([left, top, right, bottom]) =>
left === 832 && top === 0 && right === 1024 && bottom === 360));
if (!owner.state.camera.firstPerson) await owner.key('F8');
+ // Combat follows the Leet's facing; turn back before picking the shop.
+ await owner.hold('KeyD', 'training machine in view', snapshot => {
+ const machine = snapshot.actors.find(actor => actor.type === 51035 && actor.id === 3221226422);
+ return machine?.screenPosition && machine.screenPosition[0] > 300 && machine.screenPosition[0] < 600;
+ });
const offered = await state();
for (let attempt = 0; attempt < 2; ++attempt) {
await owner.click(...await owner.pick(51035, 3221226422), 'right');