forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
6114a2295f
commit
69809f7228
593 files changed
+903643
-40774
No files matched your search
@@ -1,15 +1,31 @@
|
||||
const { DEFAULT_TEST_DUNGEON_TITLE, openSelectedDungeonRoles } = require('./playtest-defaults.cjs');
|
||||
const { DEFAULT_TEST_DUNGEON_TITLE, DEFAULT_TEST_DUNGEON_CATEGORY, openSelectedDungeonRoles } = require('./playtest-defaults.cjs');
|
||||
const { chromium } = require('C:/Users/phenom/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
const output = path.resolve('artifacts/playtest/graphics-options');
|
||||
const outputArgument = process.argv.indexOf('--output-dir');
|
||||
if (outputArgument !== -1 && !process.argv[outputArgument + 1]) {
|
||||
throw new Error('--output-dir requires a directory path.');
|
||||
}
|
||||
const output = path.resolve(outputArgument === -1
|
||||
? path.join('artifacts/playtest/graphics-options', `run-${Date.now()}`)
|
||||
: process.argv[outputArgument + 1]);
|
||||
const distArgument = process.argv.find(value => value.startsWith('--dist='));
|
||||
const distRoot = path.resolve(distArgument ? distArgument.slice('--dist='.length) : 'dist');
|
||||
const distIndexPath = path.join(distRoot, 'index.html');
|
||||
const distIndexHtml = fs.readFileSync(distIndexPath, 'utf8');
|
||||
const productionBundle = {
|
||||
status: 'frozen-existing-dist; build-validation-recorded-separately',
|
||||
indexHtmlModifiedAt: fs.statSync(distIndexPath).mtime.toISOString(),
|
||||
entryFiles: [...distIndexHtml.matchAll(/(?:src|href)="([^"]+\.(?:js|css))"/g)]
|
||||
.map((match) => path.basename(match[1])),
|
||||
};
|
||||
const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'healer-man-graphics-'));
|
||||
const staticDir = fs.mkdtempSync(path.join(os.tmpdir(), 'healer-man-graphics-dist-'));
|
||||
fs.mkdirSync(output, { recursive: true });
|
||||
fs.cpSync(path.resolve('dist'), staticDir, { recursive: true });
|
||||
fs.cpSync(distRoot, staticDir, { recursive: true });
|
||||
|
||||
async function enterDungeon(page, category, name) {
|
||||
await page.getByRole('button', { name: /^Dungeons/ }).click();
|
||||
@@ -20,8 +36,11 @@ async function enterDungeon(page, category, name) {
|
||||
await page.locator('.scene-shell').waitFor();
|
||||
await page.locator('.loading-screen').waitFor({ state: 'visible', timeout: 180_000 });
|
||||
await page.locator('.loading-screen').waitFor({ state: 'hidden', timeout: 180_000 });
|
||||
await page.locator('.dungeon-boss-intro').waitFor({ state: 'visible', timeout: 180_000 });
|
||||
const selectedBosses = await page.locator('.dungeon-boss-intro .dungeon-boss-card__body h3').allInnerTexts();
|
||||
await page.locator('.dungeon-boss-intro').waitFor({ state: 'hidden', timeout: 180_000 });
|
||||
await page.waitForTimeout(1000);
|
||||
return selectedBosses;
|
||||
}
|
||||
|
||||
async function canvasScale(page) {
|
||||
@@ -39,6 +58,10 @@ async function canvasScale(page) {
|
||||
const errors = [];
|
||||
page.on('pageerror', (error) => errors.push(error.message));
|
||||
try {
|
||||
const manifestArgument = process.argv.find(value => value.startsWith('--manifest='));
|
||||
if (manifestArgument) await page.route('**/content/manifest.json', route => route.fulfill({
|
||||
body: fs.readFileSync(path.resolve(manifestArgument.slice('--manifest='.length))), contentType: 'application/json',
|
||||
}));
|
||||
await page.goto('http://127.0.0.1:4198', { waitUntil: 'domcontentloaded' });
|
||||
await page.getByRole('button', { name: /Play offline/ }).click();
|
||||
await page.getByRole('button', { name: /Create character/ }).click();
|
||||
@@ -48,7 +71,9 @@ async function canvasScale(page) {
|
||||
await page.getByRole('button', { name: /Continue|Enter world/ }).first().evaluate((button) => button.click());
|
||||
await page.locator('.main-menu-screen').waitFor();
|
||||
|
||||
await enterDungeon(page, 'WoW', DEFAULT_TEST_DUNGEON_TITLE);
|
||||
const selectedStockadeBosses = await enterDungeon(page, DEFAULT_TEST_DUNGEON_CATEGORY, DEFAULT_TEST_DUNGEON_TITLE);
|
||||
assert.equal(selectedStockadeBosses.length, 1, 'Cellblock Rush should select exactly one boss.');
|
||||
const selectedStockadeBoss = selectedStockadeBosses[0];
|
||||
const defaultScale = await canvasScale(page);
|
||||
await page.screenshot({ path: path.join(output, 'wow-default.png') });
|
||||
await page.keyboard.press('Escape');
|
||||
@@ -82,7 +107,16 @@ async function canvasScale(page) {
|
||||
assert.ok(await canvasScale(page) >= 1.9);
|
||||
await page.screenshot({ path: path.join(output, 'rom-high.png') });
|
||||
assert.deepEqual(errors, []);
|
||||
const results = { defaultScale, highScale, romScale: await canvasScale(page), errors };
|
||||
const results = {
|
||||
outputDirectory: output,
|
||||
productionBundle,
|
||||
dungeon: DEFAULT_TEST_DUNGEON_TITLE,
|
||||
selectedBoss: selectedStockadeBoss,
|
||||
defaultScale,
|
||||
highScale,
|
||||
romScale: await canvasScale(page),
|
||||
errors,
|
||||
};
|
||||
fs.writeFileSync(path.join(output, 'results.json'), `${JSON.stringify(results, null, 2)}\n`);
|
||||
console.log(JSON.stringify(results));
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user