test: harden exhaustive compatibility suites

This commit is contained in:
2026-07-30 16:19:30 +00:00
parent 4ebd3fd39b
commit a9dbb3fd4d
28 changed files with 454 additions and 97 deletions
+1 -1
View File
@@ -272,7 +272,7 @@ describe('auction router actor and permission boundaries', () => {
hostGeneralId: 88,
detail: { startBidAmount: 100, isReverse: false },
status: 'OPEN',
closeAt: new Date('2026-07-27T00:00:00Z'),
closeAt: new Date(Date.now() + 60 * 60_000),
},
];
}
+7 -1
View File
@@ -4,7 +4,13 @@ import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../../..');
const imageRoots = [resolve(repositoryRoot, '../image/game'), resolve(repositoryRoot, '../../image/game')];
const imageRoots = [
...(process.env.FRONTEND_PARITY_IMAGE_ROOT
? [resolve(process.env.FRONTEND_PARITY_IMAGE_ROOT, 'game')]
: []),
resolve(repositoryRoot, '../image/game'),
resolve(repositoryRoot, '../../image/game'),
];
type AuctionFixture = {
failResourceBid?: boolean;
@@ -4,7 +4,11 @@ import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../../..');
const imageRoots = [resolve(repositoryRoot, '../image'), resolve(repositoryRoot, '../../image')];
const imageRoots = [
...(process.env.FRONTEND_PARITY_IMAGE_ROOT ? [resolve(process.env.FRONTEND_PARITY_IMAGE_ROOT)] : []),
resolve(repositoryRoot, '../image'),
resolve(repositoryRoot, '../../image'),
];
const artifactRoot = process.env.BATTLE_SIM_ARTIFACT_DIR;
const response = (data: unknown) => ({ result: { data } });
+5 -1
View File
@@ -4,7 +4,11 @@ import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../../..');
const imageRoots = [resolve(repositoryRoot, '../image'), resolve(repositoryRoot, '../../image')];
const imageRoots = [
...(process.env.FRONTEND_PARITY_IMAGE_ROOT ? [resolve(process.env.FRONTEND_PARITY_IMAGE_ROOT)] : []),
resolve(repositoryRoot, '../image'),
resolve(repositoryRoot, '../../image'),
];
const artifactRoot = process.env.BOARD_ARTIFACT_DIR;
type Article = {
@@ -18,7 +18,7 @@ test('reserves an argument command in the real game API and reads it back from P
});
const passwordKey = await gateway.auth.passwordKey.query();
const login = await gateway.auth.login.mutate({
username: 'demo1',
username: 'demo2',
credential: {
keyId: passwordKey.keyId,
ciphertext: publicEncrypt(
@@ -27,7 +27,7 @@ test('reserves an argument command in the real game API and reads it back from P
padding: constants.RSA_PKCS1_OAEP_PADDING,
oaepHash: 'sha256',
},
Buffer.from('demo-pass-1', 'utf8')
Buffer.from('demo-pass-2', 'utf8')
).toString('base64'),
},
});
@@ -46,7 +46,9 @@ test('reserves an argument command in the real game API and reads it back from P
});
accessToken = (await game.auth.exchangeGatewayToken.mutate({ gatewayToken: issued.gameToken })).accessToken;
const context = await game.general.me.query();
if (!context) throw new Error('demo1 general is missing');
if (!context) throw new Error('demo2 general is missing');
if (!context.nation) throw new Error('demo2 nation is missing');
const nationName = context.nation.name;
const generalId = context.general.id;
const originalGeneralSnapshot = await game.turns.reserved.getGeneral.query({ generalId });
const original = (originalGeneralSnapshot.turns as unknown as PlainTurn[])[29];
@@ -95,8 +97,19 @@ test('reserves an argument command in the real game API and reads it back from P
const generalSelect = form.locator('select');
const generalValues = await generalSelect
.locator('option')
.evaluateAll((options) => options.map((option) => (option as HTMLOptionElement).value));
const targetGeneralId = Number(generalValues.find((value) => Number(value) !== generalId));
.evaluateAll((options) =>
options.map((option) => ({
value: (option as HTMLOptionElement).value,
label: option.textContent ?? '',
}))
);
const targetGeneralId = Number(
generalValues.find(
(option) =>
Number(option.value) !== generalId &&
option.label.includes(`(${nationName} ·`)
)?.value
);
expect(targetGeneralId).toBeGreaterThan(0);
await generalSelect.selectOption(String(targetGeneralId));
const nationSection = page.locator('.reserved-section').filter({ hasText: '국가 예턴' });
@@ -110,7 +123,7 @@ test('reserves an argument command in the real game API and reads it back from P
args: { isGold: false, amount: 1, destGeneralId: targetGeneralId },
});
await page.screenshot({
path: testInfo.outputPath('real-hwe-command-reserved.png'),
path: testInfo.outputPath('real-che-command-reserved.png'),
fullPage: true,
});
} finally {
+5 -1
View File
@@ -14,7 +14,11 @@ type FixtureState = {
const artifactRoot = process.env.OFFICE_PARITY_ARTIFACT_DIR ? resolve(process.env.OFFICE_PARITY_ARTIFACT_DIR) : null;
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../../..');
const imageRoots = [resolve(repositoryRoot, '../image'), resolve(repositoryRoot, '../../image')];
const imageRoots = [
...(process.env.FRONTEND_PARITY_IMAGE_ROOT ? [resolve(process.env.FRONTEND_PARITY_IMAGE_ROOT)] : []),
resolve(repositoryRoot, '../image'),
resolve(repositoryRoot, '../../image'),
];
const referenceAsset = async (relativePath: string): Promise<Buffer> => {
for (const root of imageRoots) {
try {
+5 -1
View File
@@ -14,7 +14,11 @@ const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../../.
const artifactRoot = process.env.NPC_POLICY_PARITY_ARTIFACT_DIR
? resolve(process.env.NPC_POLICY_PARITY_ARTIFACT_DIR)
: null;
const imageRoots = [resolve(repositoryRoot, '../image'), resolve(repositoryRoot, '../../image')];
const imageRoots = [
...(process.env.FRONTEND_PARITY_IMAGE_ROOT ? [resolve(process.env.FRONTEND_PARITY_IMAGE_ROOT)] : []),
resolve(repositoryRoot, '../image'),
resolve(repositoryRoot, '../../image'),
];
const referenceAsset = async (relativePath: string): Promise<Buffer> => {
for (const root of imageRoots) {
try {
+7 -1
View File
@@ -4,7 +4,13 @@ import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../../..');
const imageRoots = [resolve(repositoryRoot, '../image/game'), resolve(repositoryRoot, '../../image/game')];
const imageRoots = [
...(process.env.FRONTEND_PARITY_IMAGE_ROOT
? [resolve(process.env.FRONTEND_PARITY_IMAGE_ROOT, 'game')]
: []),
resolve(repositoryRoot, '../image/game'),
resolve(repositoryRoot, '../../image/game'),
];
const readReferenceImage = async (filename: string): Promise<Buffer> => {
for (const imageRoot of imageRoots) {