Release Healer Man 0.1.47
This commit is contained in:
1 parent
9ff574ac0b
commit
2162039b49
24 files changed
+486
-55
No files matched your search
@@ -1,5 +1,6 @@
|
||||
const { chromium } = require('C:/Users/phenom/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
|
||||
const assert = require('node:assert/strict');
|
||||
const crypto = require('node:crypto');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
@@ -18,10 +19,22 @@ fs.rmSync(databaseDirectory, { recursive: true, force: true });
|
||||
const browser = await chromium.launch({ channel: 'msedge', headless: true });
|
||||
const context = await browser.newContext({ viewport: { width: 1600, height: 1000 }, acceptDownloads: true });
|
||||
const page = await context.newPage();
|
||||
const cameraModuleUrls = fs.readdirSync('dist/assets')
|
||||
.filter((file) => /^(?:index|GameRuntime)-.*\.js$/.test(file))
|
||||
.map((file) => `/assets/${file}`);
|
||||
await page.addInitScript((moduleUrls) => {
|
||||
window.readSpectatorCameraState = async () => {
|
||||
const values = (await Promise.all(moduleUrls.map((url) => import(url)))).flatMap(Object.values);
|
||||
const game = values.find((value) => value?.getState && 'cameraYaw' in value.getState() && 'activeDungeonId' in value.getState());
|
||||
if (!game) throw new Error('Game camera store export was not found.');
|
||||
return { yaw: game.getState().cameraYaw, pointerLocked: document.pointerLockElement !== null };
|
||||
};
|
||||
}, cameraModuleUrls);
|
||||
page.setDefaultTimeout(90000);
|
||||
const errors = [];
|
||||
page.on('pageerror', (error) => errors.push(error.message));
|
||||
const capture = (name) => page.screenshot({ path: path.join(directory, `${name}.png`), fullPage: true });
|
||||
const canvasHash = async () => crypto.createHash('sha256').update(await page.locator('canvas').screenshot()).digest('hex');
|
||||
|
||||
try {
|
||||
await page.goto('http://127.0.0.1:4189', { waitUntil: 'domcontentloaded' });
|
||||
@@ -55,21 +68,66 @@ fs.rmSync(databaseDirectory, { recursive: true, force: true });
|
||||
await page.getByRole('button', { name: 'Step' }).click();
|
||||
await page.waitForTimeout(200);
|
||||
assert.notEqual(await page.locator('.dungeon-sim-hud__header > time').innerText(), pausedTime, 'single-step advances simulation time');
|
||||
await page.getByRole('button', { name: 'Follow camera' }).click();
|
||||
await page.getByRole('button', { name: 'Free-fly camera' }).waitFor();
|
||||
await capture('03-paused-free-fly');
|
||||
const memberPicker = page.getByLabel('Spectate party member');
|
||||
const memberButtons = memberPicker.locator('div > button');
|
||||
assert.equal(await memberButtons.count(), 5, 'all five simulated party members are spectatable');
|
||||
const chosenName = await memberButtons.nth(2).locator('strong').innerText();
|
||||
await memberButtons.nth(2).click();
|
||||
assert.equal(await memberButtons.nth(2).getAttribute('aria-pressed'), 'true');
|
||||
await page.waitForTimeout(300);
|
||||
await capture('03-follow-selected-member');
|
||||
|
||||
await page.getByRole('button', { name: 'Free camera' }).click();
|
||||
assert.equal(await page.getByRole('button', { name: 'Free camera' }).getAttribute('aria-pressed'), 'true');
|
||||
const beforeFlight = await canvasHash();
|
||||
await page.keyboard.down('w');
|
||||
await page.keyboard.down('e');
|
||||
await page.waitForTimeout(700);
|
||||
await page.keyboard.up('e');
|
||||
await page.keyboard.up('w');
|
||||
await page.waitForTimeout(150);
|
||||
const afterFlight = await canvasHash();
|
||||
assert.notEqual(afterFlight, beforeFlight, 'W/E free-camera input changes the rendered viewpoint');
|
||||
const canvasBounds = await page.locator('canvas').boundingBox();
|
||||
assert(canvasBounds, 'simulation canvas is visible');
|
||||
const lookStart = { x: canvasBounds.x + canvasBounds.width * 0.5, y: canvasBounds.y + canvasBounds.height * 0.55 };
|
||||
const beforeLook = await page.evaluate(() => window.readSpectatorCameraState());
|
||||
await page.mouse.move(lookStart.x, lookStart.y);
|
||||
await page.mouse.down({ button: 'right' });
|
||||
await page.mouse.move(lookStart.x + 140, lookStart.y - 45, { steps: 10 });
|
||||
await page.waitForTimeout(250);
|
||||
const duringLook = await page.evaluate(() => window.readSpectatorCameraState());
|
||||
assert.notEqual(duringLook.yaw, beforeLook.yaw, 'right-drag rotates the free camera');
|
||||
assert.equal(duringLook.pointerLocked, false, 'right-drag does not request Pointer Lock');
|
||||
await page.mouse.up({ button: 'right' });
|
||||
const releasedLook = await page.evaluate(() => window.readSpectatorCameraState());
|
||||
await page.mouse.move(lookStart.x - 120, lookStart.y + 50, { steps: 8 });
|
||||
await page.waitForTimeout(250);
|
||||
assert.equal(
|
||||
(await page.evaluate(() => window.readSpectatorCameraState())).yaw,
|
||||
releasedLook.yaw,
|
||||
'mouse movement after right-button release does not rotate the camera',
|
||||
);
|
||||
await capture('04-paused-free-camera-moved');
|
||||
|
||||
await memberButtons.nth(4).click();
|
||||
assert.equal(await page.getByRole('button', { name: 'Follow member' }).getAttribute('aria-pressed'), 'true');
|
||||
assert.match(await memberPicker.locator('header strong').innerText(), /\S/);
|
||||
assert.notEqual(await memberPicker.locator('header strong').innerText(), chosenName);
|
||||
await page.waitForTimeout(300);
|
||||
await capture('05-follow-another-member');
|
||||
|
||||
await page.getByRole('button', { name: '4×' }).click();
|
||||
await page.getByRole('button', { name: 'Play' }).click();
|
||||
await page.waitForTimeout(1200);
|
||||
await page.getByRole('button', { name: 'Stop & save' }).click();
|
||||
await page.getByRole('button', { name: 'Return to GM Tools' }).waitFor();
|
||||
await capture('04-finished-report');
|
||||
await capture('06-finished-report');
|
||||
await page.getByRole('button', { name: 'Return to GM Tools' }).click();
|
||||
await page.getByRole('heading', { name: 'Dungeon route simulations' }).waitFor();
|
||||
await page.locator('.dungeon-sim-admin__catalog select').nth(0).selectOption('wailing-caverns');
|
||||
await page.getByText(/1 runs for this route/).waitFor();
|
||||
await capture('05-saved-replay');
|
||||
await capture('07-saved-replay');
|
||||
|
||||
await page.getByRole('button', { name: 'Watch' }).first().click();
|
||||
await page.getByText('Recorded replay').waitFor();
|
||||
@@ -77,7 +135,7 @@ fs.rmSync(databaseDirectory, { recursive: true, force: true });
|
||||
await page.waitForTimeout(6000);
|
||||
await page.getByRole('button', { name: 'Play' }).click();
|
||||
await page.waitForTimeout(800);
|
||||
await capture('06-replay-controls');
|
||||
await capture('08-replay-controls');
|
||||
await page.getByRole('button', { name: 'Pause' }).click();
|
||||
const pausedReplayTime = await page.locator('.dungeon-sim-hud__header > time').innerText();
|
||||
await page.waitForTimeout(500);
|
||||
@@ -85,7 +143,7 @@ fs.rmSync(databaseDirectory, { recursive: true, force: true });
|
||||
await page.getByRole('button', { name: '4×' }).click();
|
||||
await page.getByRole('button', { name: 'Play' }).click();
|
||||
await page.waitForTimeout(600);
|
||||
await capture('07-replay-4x');
|
||||
await capture('09-replay-4x');
|
||||
|
||||
assert.deepEqual(errors, [], `No browser page errors: ${errors.join('; ')}`);
|
||||
console.log('Dungeon simulation browser smoke test passed.');
|
||||
|
||||
Reference in new issue
Block a user