test(e2e): honor configured game base paths

This commit is contained in:
2026-07-31 18:08:04 +00:00
parent c3c1ddc0cf
commit 132baf21cc
13 changed files with 88 additions and 72 deletions
+5 -4
View File
@@ -1,7 +1,8 @@
import { expect, test, type Page, type Route } from '@playwright/test';
import { gameBasePath, gameProfile } from './gameTestPaths.js';
const response = (data: unknown) => ({ result: { data } });
const basePath = `/${(process.env.PLAYWRIGHT_GAME_BASE_PATH ?? 'che').replace(/^\/+|\/+$/g, '')}`;
const basePath = gameBasePath;
const operationNames = (route: Route) =>
decodeURIComponent(new URL(route.request().url()).pathname.split('/trpc/')[1] ?? '').split(',');
@@ -94,10 +95,10 @@ const findInput = (value: unknown): Record<string, unknown> => {
};
const installFixture = async (page: Page, state: FixtureState): Promise<void> => {
await page.addInitScript(() => {
await page.addInitScript((profile) => {
localStorage.setItem('sammo-game-token', 'ga_npc_possession');
localStorage.setItem('sammo-game-profile', 'che:default');
});
localStorage.setItem('sammo-game-profile', profile);
}, gameProfile);
await page.route('**/image/**', async (route) => {
await route.fulfill({
status: 200,