Skip to content

Commit acd8f53

Browse files
committed
adjust metadata types
1 parent 4a96a1b commit acd8f53

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

testing/e2e/playwright.config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import * as crypto from 'node:crypto';
12
import * as path from 'node:path';
23

34
import { parseNumber, range, unwrap } from '@douglasneuroinformatics/libjs';
45
import { defineConfig, devices } from '@playwright/test';
56
import type { Project } from '@playwright/test';
67

7-
import type { BrowserTarget, ProjectMetadata } from './src/helpers/types';
8+
import type { BrowserName, ProjectMetadata } from './src/helpers/types';
89

910
const apiPort = parseNumber(process.env.API_DEV_SERVER_PORT);
1011
const gatewayPort = parseNumber(process.env.GATEWAY_DEV_SERVER_PORT);
@@ -20,7 +21,7 @@ if (Number.isNaN(apiPort)) {
2021

2122
const baseURL = `http://localhost:${webPort}`;
2223

23-
const browsers: { target: BrowserTarget; use: Project['use'] }[] = [
24+
const browsers: { target: BrowserName; use: Project['use'] }[] = [
2425
{ target: 'Desktop Chrome', use: { ...devices['Desktop Chrome'], channel: 'chromium', headless: true } },
2526
{ target: 'Desktop Firefox', use: { ...devices['Desktop Firefox'], headless: true } }
2627
] as const;
@@ -51,7 +52,10 @@ export default defineConfig({
5152
return {
5253
dependencies: i === 1 ? ['Global Setup'] : [`${i - 1}.x - ${browser.target}`],
5354
metadata: {
54-
browserTarget: browser.target
55+
browser: {
56+
id: crypto.createHash('sha256').update(browser.target).digest('hex'),
57+
name: browser.target
58+
}
5559
} satisfies ProjectMetadata,
5660
name: `${i}.x - ${browser.target}`,
5761
testMatch: `**/${i}.*.spec.ts`,

testing/e2e/src/helpers/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare global {
1616
}
1717
}
1818

19-
export type BrowserTarget = 'Desktop Chrome' | 'Desktop Firefox';
19+
export type BrowserName = 'Desktop Chrome' | 'Desktop Firefox';
2020

2121
export type ExtractParams<TPath extends string> = Split<TPath, '/'>[number] extends infer TUnion
2222
? TUnion extends `$${infer TParam}`
@@ -33,7 +33,10 @@ export type NavigateVariadicArgs<TPath extends RouteTo> = IfNever<
3333
export type NavigateArgs<TPath extends RouteTo> = [to: TPath, ...NavigateVariadicArgs<TPath>];
3434

3535
export type ProjectMetadata = {
36-
browserTarget: BrowserTarget;
36+
browser: {
37+
id: string;
38+
name: BrowserName;
39+
};
3740
};
3841

3942
// export type RouteTo = import('../../../../apps/web/src/route-tree.ts').FileRouteTypes['to'];
@@ -47,5 +50,5 @@ export type RouteParams<TPath extends RouteTo> = {
4750
: never;
4851

4952
export type TestDataMap<T> = {
50-
[K in BrowserTarget]: T;
53+
[K in BrowserName]: T;
5154
};

0 commit comments

Comments
 (0)