@cosmicdrift/kumiko-testing 0.355.0 → 0.357.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/changes.json +6 -0
- package/src/e2e/define-app-e2e-config.ts +41 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.357.0",
|
|
4
4
|
"description": "Test template for Kumiko apps: per-flow seedTenant, app test stack, canonical test preloads, bunfig generator and integration runner.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"kumiko-testing": "./bin/kumiko-testing.ts"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
83
|
-
"@cosmicdrift/kumiko-dev-server": "0.
|
|
84
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
82
|
+
"@cosmicdrift/kumiko-bundled-features": "0.357.0",
|
|
83
|
+
"@cosmicdrift/kumiko-dev-server": "0.357.0",
|
|
84
|
+
"@cosmicdrift/kumiko-framework": "0.357.0",
|
|
85
85
|
"zod": "^4.4.3"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.357.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "defineAppE2eConfig accepts permissions, launchOptions, a custom server command and Bun preloads",
|
|
6
|
+
"detail": "Apps that need browser permissions (camera, microphone), Chromium launch flags such as fake media devices, or a preloaded module for the e2e server no longer have to hand-roll their Playwright config. permissions and launchOptions land in the shared use block. preload (one path or a list) is prefixed to serverEntry as bun run --preload flags; serverCommand replaces the whole server start command and cannot be combined with serverEntry or preload."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.354.0",
|
|
4
10
|
"type": "improvement",
|
|
@@ -7,6 +7,7 @@ import { isRealProviderRun } from "@cosmicdrift/kumiko-framework/testing/real-pr
|
|
|
7
7
|
import {
|
|
8
8
|
defineConfig,
|
|
9
9
|
devices,
|
|
10
|
+
type LaunchOptions,
|
|
10
11
|
type PlaywrightTestConfig,
|
|
11
12
|
type PlaywrightTestOptions,
|
|
12
13
|
type PlaywrightWorkerOptions,
|
|
@@ -83,15 +84,47 @@ export type E2eProject = Omit<Project, (typeof TEMPLATE_OWNED_PROJECT_KEYS)[numb
|
|
|
83
84
|
readonly use?: Omit<ProjectUse, (typeof TEMPLATE_OWNED_USE_KEYS)[number]>;
|
|
84
85
|
};
|
|
85
86
|
|
|
87
|
+
type ServerStart =
|
|
88
|
+
| {
|
|
89
|
+
readonly serverEntry?: string;
|
|
90
|
+
readonly preload?: string | readonly string[];
|
|
91
|
+
readonly serverCommand?: never;
|
|
92
|
+
}
|
|
93
|
+
| {
|
|
94
|
+
readonly serverCommand: string;
|
|
95
|
+
readonly serverEntry?: never;
|
|
96
|
+
readonly preload?: never;
|
|
97
|
+
};
|
|
98
|
+
|
|
86
99
|
export type AppE2eConfigInput = {
|
|
87
100
|
readonly port: number;
|
|
88
101
|
readonly env?: Readonly<Record<string, string>>;
|
|
89
102
|
readonly locale?: string;
|
|
90
103
|
readonly projects?: readonly E2eProject[];
|
|
91
|
-
readonly serverEntry?: string;
|
|
92
104
|
readonly testDir?: string;
|
|
93
105
|
readonly testMatch?: string | RegExp | readonly (string | RegExp)[];
|
|
94
|
-
|
|
106
|
+
readonly permissions?: readonly string[];
|
|
107
|
+
readonly launchOptions?: LaunchOptions;
|
|
108
|
+
} & ServerStart;
|
|
109
|
+
|
|
110
|
+
function serverStartCommand(input: {
|
|
111
|
+
readonly serverCommand?: string;
|
|
112
|
+
readonly serverEntry?: string;
|
|
113
|
+
readonly preload?: string | readonly string[];
|
|
114
|
+
}): string {
|
|
115
|
+
const { serverCommand, serverEntry = "e2e/server.ts", preload } = input;
|
|
116
|
+
if (serverCommand !== undefined) {
|
|
117
|
+
if (input.serverEntry !== undefined || preload !== undefined) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
"defineAppE2eConfig: serverCommand replaces serverEntry and preload; set only one",
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return serverCommand;
|
|
123
|
+
}
|
|
124
|
+
const preloads = preload === undefined ? [] : typeof preload === "string" ? [preload] : preload;
|
|
125
|
+
const preloadFlags = preloads.map((path) => `--preload ${path} `).join("");
|
|
126
|
+
return `bun run ${preloadFlags}${serverEntry}`;
|
|
127
|
+
}
|
|
95
128
|
|
|
96
129
|
function mutableTestMatch(
|
|
97
130
|
match: NonNullable<AppE2eConfigInput["testMatch"]>,
|
|
@@ -154,10 +187,12 @@ export function defineAppE2eConfig(input: AppE2eConfigInput): PlaywrightTestConf
|
|
|
154
187
|
env = {},
|
|
155
188
|
locale = "en",
|
|
156
189
|
projects = [],
|
|
157
|
-
serverEntry = "e2e/server.ts",
|
|
158
190
|
testDir = "./e2e",
|
|
159
191
|
testMatch,
|
|
192
|
+
permissions,
|
|
193
|
+
launchOptions,
|
|
160
194
|
} = input;
|
|
195
|
+
const serverCommand = serverStartCommand(input);
|
|
161
196
|
assertNoReservedEnv(env);
|
|
162
197
|
for (const project of projects) assertTemplateOwnedKeysUnset(project);
|
|
163
198
|
// A dedicated screenshots config (testDir: "./e2e/screenshots") has its
|
|
@@ -190,6 +225,8 @@ export function defineAppE2eConfig(input: AppE2eConfigInput): PlaywrightTestConf
|
|
|
190
225
|
screenshot: "only-on-failure",
|
|
191
226
|
actionTimeout: E2E_TIMEOUT_MS.action,
|
|
192
227
|
navigationTimeout: E2E_TIMEOUT_MS.navigation,
|
|
228
|
+
...(permissions !== undefined && { permissions: [...permissions] }),
|
|
229
|
+
...(launchOptions !== undefined && { launchOptions }),
|
|
193
230
|
},
|
|
194
231
|
projects: [
|
|
195
232
|
{
|
|
@@ -203,7 +240,7 @@ export function defineAppE2eConfig(input: AppE2eConfigInput): PlaywrightTestConf
|
|
|
203
240
|
...projects,
|
|
204
241
|
],
|
|
205
242
|
webServer: {
|
|
206
|
-
command:
|
|
243
|
+
command: serverCommand,
|
|
207
244
|
url: baseURL,
|
|
208
245
|
env: {
|
|
209
246
|
...infraEnvDefaults(),
|