// #82: the GM token form starts at the viewport centre, not the old 400,400. The scene is the // seeded 4096x4096 one, so the initial 1000x700 GM view centres on 2048,2048. import test from 'node:test' import assert from 'node:assert/strict' import { launchBrowser, newPage, signIn, waitForVisible, withStack } from './stack.mjs' test('GM token create defaults X/Y to the viewport centre', { timeout: 120000 }, async () => { await withStack(async ({ origin, gmKey }) => { const browser = await launchBrowser() try { const { page } = await newPage(browser) await page.goto(`${origin}/`) await waitForVisible(page, '#signin') await signIn(page, gmKey) await waitForVisible(page, '#stage canvas') await page.click('#gm-token-create-section > summary') await page.waitForFunction(() => { const x = document.querySelector('#token-x') const y = document.querySelector('#token-y') return x?.value === '2048' && y?.value === '2048' }, undefined, { timeout: 20000 }) assert.equal(await page.inputValue('#token-x'), '2048') assert.equal(await page.inputValue('#token-y'), '2048') } finally { await browser.close() } }) })