aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit d3319b1290234296e0ccbc3d36e42eeed9260a5c
parent fd8e9e9dfe2b4fdc427f0b3b571ec6acac1b6c5f
Author: anon <anon@example.com>
Date:   Thu,  5 Nov 2026 08:52:24 +0000

Adopt the player in the admin browser fixture

Diffstat:
MTODO.md | 11+++++------
Mdocs/admin.md | 6+++---
Mserver/admin_browser_test.go | 2+-
Mtools/client/test_admin.mjs | 9++++++---
4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -130,12 +130,11 @@ rewriting this document does not close them. ## P1: bounded follow-up work -- [ ] **Repair the admin browser scenario's adopted-player fixture.** - `TestAdminBrowser` currently stops at its player Change password link because - its fixture is an unadopted visitor. Prepare an adopted player through the - current account flow and retain the password-change assertion. Completion: - the existing scenario reaches its final checks. This is P1 test maintenance; - the visitor restriction itself is intentional and must remain unchanged. +- [x] **Repair the admin browser scenario's adopted-player fixture.** + The fixture now claims its visitor through the current account endpoint and + keeps the rotated browser token. `TestAdminBrowser` passes through player + password changes, live game interactions and authenticated profile upload. + The restriction on changing unadopted visitors' passwords is unchanged. - [ ] **Use external assets by default; make single-executable bundling opt-in.** The assets directory currently occupies about 1.2 GB and is unconditionally embedded into the server/test build. Default development builds should read diff --git a/docs/admin.md b/docs/admin.md @@ -25,9 +25,9 @@ and HTTPS 8443 both returned 401 for unauthenticated administrative/profile writes, 403 for cross-origin profile writes, and 404 for the removed public upload route and tested debug paths. The real browser worker rejected a player-only session and uploaded successfully after administrator login under -`/share/test/`. Evidence is retained in `local/admin-profile/`. The broader -admin browser scenario currently needs an adopted-player fixture repair; -that separate failure occurs before its profiling check. +`/share/test/`. Evidence is retained in `local/admin-profile/`. The full admin +browser scenario also passes after preparing its player through account claiming, +including password changes and the final authenticated profile upload. General shows player, connection, instance, NPC and database-size counts, game time and weather. Query rate samples driver executions over two seconds, diff --git a/server/admin_browser_test.go b/server/admin_browser_test.go @@ -25,7 +25,7 @@ func TestAdminBrowser(t *testing.T) { world := newTestServer(t) world.baseURL = "/share/test/" player := world.newCharacter() - player.name = "Admin Browser" + player.name = "Visitor1" player.playfield = 705 player.position = [3]float32{960, 16.5, 510} player.rotation = [4]float32{0, 0.9238795, 0, -0.3826834} diff --git a/tools/client/test_admin.mjs b/tools/client/test_admin.mjs @@ -12,6 +12,10 @@ const browser = await chromium.launch({executablePath: '/usr/bin/chromium', let game; try { const context = await browser.newContext({viewport: {width: 1280, height: 900}, hasTouch: true}); + // Password management requires an adopted player and its rotated browser token. + await context.addCookies([{name: 'ao_client', value: 'admin-browser', url}]); + const claimed = await context.request.post(url + 'browser-account/claim', {form: {name: 'Adminbrowser', password: 'old-player-password'}}); + assert.equal(claimed.status(), 204, await claimed.text()); const page = await context.newPage(); const profileRequests = []; context.on('request', request => { @@ -52,9 +56,9 @@ try { await page.getByRole('button', {name: 'Log in', exact: true}).click(); await page.getByRole('heading', {name: 'General', exact: true}).waitFor(); await page.getByRole('link', {name: 'Players', exact: true}).click(); - assert.equal(await page.getByRole('link', {name: 'Admin Browser', exact: true}).count(), 1); + assert.equal(await page.getByRole('link', {name: 'Adminbrowser', exact: true}).count(), 1); assert.equal(await page.getByText('Create user', {exact: true}).count(), 0); - await page.getByRole('link', {name: 'Admin Browser', exact: true}).click(); + await page.getByRole('link', {name: 'Adminbrowser', exact: true}).click(); assert(page.url().endsWith('/admin/players/1')); assert.equal(await page.locator('canvas').count(), 0); assert((await page.getByRole('heading', {name: 'Character data'}).boundingBox()).y < 900); @@ -141,7 +145,6 @@ try { await page.getByRole('button', {name: 'Log in', exact: true}).click(); // Verify weather delivery in the real client, with live simulation refreshes. - await context.addCookies([{name: 'ao_client', value: 'admin-browser', url}]); const client = await context.newPage(); await client.setViewportSize({width: 1024, height: 768}); game = await GameTest.attach(client);