@theaiplatform/miniapp-sdk 0.3.3 → 0.4.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/README.md +100 -1
- package/dist/bin/tap-miniapp-test.d.ts +1 -0
- package/dist/bin/tap-miniapp-test.js +1293 -0
- package/dist/index.d.ts +24 -0
- package/dist/internal/json-schema.d.ts +10 -0
- package/dist/internal/json-schema.js +53 -0
- package/dist/rspack/index.d.ts +72 -6
- package/dist/rspack/index.js +155 -31
- package/dist/sdk.d.ts +24 -0
- package/dist/surface.d.ts +14 -0
- package/dist/testing/rstest-config.d.ts +38 -0
- package/dist/testing/rstest-config.js +59 -0
- package/dist/testing/rstest.d.ts +513 -41
- package/dist/testing/rstest.js +1642 -150
- package/dist/testing/tap.test.schema.json +361 -0
- package/dist/ui/wasm.js +2 -1
- package/dist/ui.d.ts +14 -4
- package/dist/ui.js +2 -1
- package/dist/vscode-webview.d.ts +14 -0
- package/dist/web.d.ts +24 -0
- package/package.json +18 -4
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const DEFAULT_INCLUDE = Object.freeze([
|
|
2
|
+
'tests/e2e/**/*.test.ts',
|
|
3
|
+
'tests/e2e/**/*.test.tsx'
|
|
4
|
+
]);
|
|
5
|
+
const MAX_TEST_TIMEOUT_MS = 600000;
|
|
6
|
+
const LOCKED_CONFIG_ERROR_PREFIX = 'defineTapRstestConfig owns deterministic TAP runner setting';
|
|
7
|
+
function configError(setting, expected) {
|
|
8
|
+
return new Error(`${LOCKED_CONFIG_ERROR_PREFIX} "${setting}"; use ${expected}.`);
|
|
9
|
+
}
|
|
10
|
+
function assertDataObject(value, label) {
|
|
11
|
+
if (null === value || 'object' != typeof value || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype) throw new TypeError(`${label} must be a plain object.`);
|
|
12
|
+
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value)))if (descriptor.get || descriptor.set) throw new TypeError(`${label}.${key} must be a data property.`);
|
|
13
|
+
}
|
|
14
|
+
function assertLockedValue(options, setting, expected, expectedDescription) {
|
|
15
|
+
const value = options[setting];
|
|
16
|
+
if (void 0 !== value && value !== expected) throw configError(setting, expectedDescription);
|
|
17
|
+
}
|
|
18
|
+
function validateInclude(value) {
|
|
19
|
+
if (void 0 === value) return [
|
|
20
|
+
...DEFAULT_INCLUDE
|
|
21
|
+
];
|
|
22
|
+
if (!Array.isArray(value) || 0 === value.length) throw new TypeError('defineTapRstestConfig "include" must be a non-empty array of project-relative globs.');
|
|
23
|
+
return value.map((entry, index)=>{
|
|
24
|
+
if ('string' != typeof entry || 0 === entry.length || entry.length > 512 || entry.includes('\0') || entry.includes('\\') || entry.startsWith('/') || /^[a-zA-Z]:/u.test(entry) || entry.split('/').includes('..')) throw new TypeError(`defineTapRstestConfig "include[${index}]" must be a bounded, project-relative POSIX glob.`);
|
|
25
|
+
return entry;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function validateTestTimeout(value) {
|
|
29
|
+
if (void 0 !== value && ('number' != typeof value || !Number.isSafeInteger(value) || value < 1 || value > MAX_TEST_TIMEOUT_MS)) throw new TypeError(`defineTapRstestConfig "testTimeout" must be an integer from 1 through ${MAX_TEST_TIMEOUT_MS} milliseconds.`);
|
|
30
|
+
}
|
|
31
|
+
function defineTapRstestConfig(options = {}) {
|
|
32
|
+
assertDataObject(options, 'defineTapRstestConfig options');
|
|
33
|
+
assertLockedValue(options, 'isolate', false, '`isolate: false`');
|
|
34
|
+
assertLockedValue(options, 'maxConcurrency', 1, '`maxConcurrency: 1`');
|
|
35
|
+
assertLockedValue(options, 'passWithNoTests', false, '`passWithNoTests: false`');
|
|
36
|
+
assertLockedValue(options, 'retry', 0, '`retry: 0`');
|
|
37
|
+
assertLockedValue(options, 'testEnvironment', 'node', '`testEnvironment: "node"`');
|
|
38
|
+
validateTestTimeout(options.testTimeout);
|
|
39
|
+
const pool = options.pool;
|
|
40
|
+
if (void 0 !== pool) {
|
|
41
|
+
assertDataObject(pool, 'defineTapRstestConfig pool');
|
|
42
|
+
assertLockedValue(pool, 'maxWorkers', 1, '`pool.maxWorkers: 1`');
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...options,
|
|
46
|
+
include: validateInclude(options.include),
|
|
47
|
+
isolate: false,
|
|
48
|
+
maxConcurrency: 1,
|
|
49
|
+
passWithNoTests: false,
|
|
50
|
+
pool: {
|
|
51
|
+
...pool,
|
|
52
|
+
maxWorkers: 1
|
|
53
|
+
},
|
|
54
|
+
retry: 0,
|
|
55
|
+
testEnvironment: 'node',
|
|
56
|
+
testTimeout: options.testTimeout ?? 30000
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export { defineTapRstestConfig };
|
package/dist/testing/rstest.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import type { PlaywrightFixtures } from '@rstest/playwright';
|
|
|
10
10
|
import type { PlaywrightTest } from '@rstest/playwright';
|
|
11
11
|
import type { TestContext } from '@rstest/core';
|
|
12
12
|
import type { TestOptions } from '@rstest/core';
|
|
13
|
-
import { z } from 'zod';
|
|
14
13
|
|
|
15
14
|
export { afterAll }
|
|
16
15
|
|
|
@@ -20,48 +19,313 @@ export { beforeAll }
|
|
|
20
19
|
|
|
21
20
|
export declare const beforeEach: TapBeforeEachHook;
|
|
22
21
|
|
|
22
|
+
declare type DeepReadonly<T> = T extends (...arguments_: never[]) => unknown ? T : T extends readonly (infer Entry)[] ? readonly DeepReadonly<Entry>[] : T extends object ? {
|
|
23
|
+
readonly [Key in keyof T]: DeepReadonly<T[Key]>;
|
|
24
|
+
} : T;
|
|
25
|
+
|
|
23
26
|
export { describe }
|
|
24
27
|
|
|
25
28
|
export { expect }
|
|
26
29
|
|
|
30
|
+
declare type GeneratedFixtureChannelSeed = GeneratedFixtureSeed['channels'][number];
|
|
31
|
+
|
|
32
|
+
declare type GeneratedFixtureHttpHeaderInput = MiniappTestFixtureHttpHeaderInput;
|
|
33
|
+
|
|
34
|
+
declare type GeneratedFixtureHttpRequest = GeneratedFixtureHttpScript['request'];
|
|
35
|
+
|
|
36
|
+
declare type GeneratedFixtureHttpResponse = GeneratedFixtureHttpScript['response'];
|
|
37
|
+
|
|
38
|
+
declare type GeneratedFixtureHttpScript = MiniappTestFixtureHttpScript;
|
|
39
|
+
|
|
40
|
+
declare type GeneratedFixtureHttpScriptState = MiniappTestFixtureHttpScriptState;
|
|
41
|
+
|
|
42
|
+
declare type GeneratedFixtureLedger = MiniappTestFixtureLedger;
|
|
43
|
+
|
|
44
|
+
declare type GeneratedFixtureProjectSeed = GeneratedFixtureSeed['projects'][number];
|
|
45
|
+
|
|
46
|
+
declare type GeneratedFixtureSeed = MiniappTestFixtureSeed;
|
|
47
|
+
|
|
48
|
+
declare type GeneratedFixtureSnapshot = MiniappTestFixtureSnapshot;
|
|
49
|
+
|
|
50
|
+
declare type GeneratedLifecycleReceipt = MiniappTestResetFixtureControlReceipt | MiniappTestRemountSurfaceControlReceipt;
|
|
51
|
+
|
|
52
|
+
/** @capability miniapp-platform */
|
|
53
|
+
/** Private SDK snapshot: keeps the public adapter independent of workspace packages. */
|
|
54
|
+
declare type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
55
|
+
[key: string]: JsonValue;
|
|
56
|
+
};
|
|
57
|
+
|
|
27
58
|
declare type MergeContext<ExtraContext, FixturesContext> = {
|
|
28
59
|
[Key in keyof FixturesContext | keyof ExtraContext]: Key extends keyof FixturesContext ? FixturesContext[Key] : Key extends keyof ExtraContext ? ExtraContext[Key] : never;
|
|
29
60
|
};
|
|
30
61
|
|
|
62
|
+
declare type MiniappTestEmitHostEventControlReceipt = {
|
|
63
|
+
schemaVersion: 1;
|
|
64
|
+
requestId: string;
|
|
65
|
+
runId: string;
|
|
66
|
+
operation: 'emit-host-event';
|
|
67
|
+
delivered: number;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare type MiniappTestFixtureChannelSeed = {
|
|
71
|
+
roomId: string;
|
|
72
|
+
title: string;
|
|
73
|
+
archived?: boolean | undefined;
|
|
74
|
+
createdAt?: number | undefined;
|
|
75
|
+
updatedAt?: number | undefined;
|
|
76
|
+
messages: JsonValue[];
|
|
77
|
+
specialistIds: string[];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
declare type MiniappTestFixtureChannelState = {
|
|
81
|
+
roomId: string;
|
|
82
|
+
title: string;
|
|
83
|
+
archived: boolean;
|
|
84
|
+
createdAt: number;
|
|
85
|
+
updatedAt: number;
|
|
86
|
+
messages: JsonValue[];
|
|
87
|
+
specialistIds: string[];
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
declare type MiniappTestFixtureCheckpoint = {
|
|
91
|
+
installationId: string;
|
|
92
|
+
releaseId: string;
|
|
93
|
+
runtimeSlot: string;
|
|
94
|
+
checkpointReference: string;
|
|
95
|
+
value: JsonValue;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
declare type MiniappTestFixtureHttpCapture = {
|
|
99
|
+
sequence: number;
|
|
100
|
+
matched: boolean;
|
|
101
|
+
request: MiniappTestFixtureHttpRequest;
|
|
102
|
+
credentialRef?: string | undefined;
|
|
103
|
+
auth?: 'github' | undefined;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
declare type MiniappTestFixtureHttpCaptures = {
|
|
107
|
+
requests: MiniappTestFixtureHttpCapture[];
|
|
108
|
+
dropped: number;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
declare type MiniappTestFixtureHttpHeader = {
|
|
112
|
+
name: string;
|
|
113
|
+
value: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare type MiniappTestFixtureHttpHeaderInput = {
|
|
117
|
+
name: string;
|
|
118
|
+
value: string;
|
|
119
|
+
enabled?: boolean | undefined;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
declare type MiniappTestFixtureHttpRequest = {
|
|
123
|
+
method: string;
|
|
124
|
+
url: string;
|
|
125
|
+
query: MiniappTestFixtureHttpHeaderInput[];
|
|
126
|
+
headers: MiniappTestFixtureHttpHeaderInput[];
|
|
127
|
+
body?: string | undefined;
|
|
128
|
+
timeoutMs?: number | undefined;
|
|
129
|
+
responseBodyLimitBytes?: number | undefined;
|
|
130
|
+
followRedirects?: boolean | undefined;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
declare type MiniappTestFixtureHttpResponse = {
|
|
134
|
+
finalUrl: string;
|
|
135
|
+
status: number;
|
|
136
|
+
statusText: string;
|
|
137
|
+
headers: MiniappTestFixtureHttpHeader[];
|
|
138
|
+
bodyText?: string | undefined;
|
|
139
|
+
bodyBase64?: string | undefined;
|
|
140
|
+
bodyKind: 'text' | 'binary';
|
|
141
|
+
bodyTruncated: boolean;
|
|
142
|
+
sizeBytes: number;
|
|
143
|
+
elapsedMs: number;
|
|
144
|
+
contentType?: string | undefined;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
declare type MiniappTestFixtureHttpScript = {
|
|
148
|
+
request: MiniappTestFixtureHttpRequest;
|
|
149
|
+
credentialRef?: string | undefined;
|
|
150
|
+
auth?: 'github' | undefined;
|
|
151
|
+
response: MiniappTestFixtureHttpResponse;
|
|
152
|
+
repeat?: number | undefined;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
declare type MiniappTestFixtureHttpScriptState = {
|
|
156
|
+
request: MiniappTestFixtureHttpRequest;
|
|
157
|
+
credentialRef?: string | undefined;
|
|
158
|
+
auth?: 'github' | undefined;
|
|
159
|
+
response: MiniappTestFixtureHttpResponse;
|
|
160
|
+
repeat: number;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
declare type MiniappTestFixtureLedger = {
|
|
164
|
+
entries: MiniappTestFixtureLedgerEntry[];
|
|
165
|
+
dropped: number;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
declare type MiniappTestFixtureLedgerEntry = {
|
|
169
|
+
sequence: number;
|
|
170
|
+
fixtureGeneration: number;
|
|
171
|
+
timestampMs: number;
|
|
172
|
+
kind: 'event' | 'host-action' | 'native' | 'platform';
|
|
173
|
+
operation: string;
|
|
174
|
+
detail: JsonValue;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
declare type MiniappTestFixturePresence = {
|
|
178
|
+
packageId: string;
|
|
179
|
+
namespace: string;
|
|
180
|
+
room: string;
|
|
181
|
+
selfParticipantId: string;
|
|
182
|
+
participants: MiniappTestFixturePresenceParticipant[];
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
declare type MiniappTestFixturePresenceParticipant = {
|
|
186
|
+
participantId: string;
|
|
187
|
+
displayName: string;
|
|
188
|
+
state: JsonValue;
|
|
189
|
+
updatedAtMs: number;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
declare type MiniappTestFixtureProjectSeed = {
|
|
193
|
+
id: string;
|
|
194
|
+
name: string;
|
|
195
|
+
discoverable?: boolean | undefined;
|
|
196
|
+
channelIds: string[];
|
|
197
|
+
archivedChannelIds: string[];
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
declare type MiniappTestFixtureProjectState = {
|
|
201
|
+
id: string;
|
|
202
|
+
name: string;
|
|
203
|
+
discoverable: boolean;
|
|
204
|
+
channelIds: string[];
|
|
205
|
+
archivedChannelIds: string[];
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
declare type MiniappTestFixtureSeed = {
|
|
209
|
+
projects: MiniappTestFixtureProjectSeed[];
|
|
210
|
+
channels: MiniappTestFixtureChannelSeed[];
|
|
211
|
+
workflows: MiniappTestFixtureWorkflow[];
|
|
212
|
+
vfsFiles: MiniappTestFixtureVfsFile[];
|
|
213
|
+
vfsDirectories: MiniappTestFixtureVfsDirectory[];
|
|
214
|
+
storage: MiniappTestFixtureStorageEntry[];
|
|
215
|
+
presence: MiniappTestFixturePresence[];
|
|
216
|
+
checkpoints: MiniappTestFixtureCheckpoint[];
|
|
217
|
+
specialists: MiniappTestFixtureSpecialist[];
|
|
218
|
+
httpScripts: MiniappTestFixtureHttpScript[];
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
declare type MiniappTestFixtureSnapshot = {
|
|
222
|
+
schemaVersion: 1;
|
|
223
|
+
fixtureVersion: string;
|
|
224
|
+
workspaceId: string;
|
|
225
|
+
channelId: string;
|
|
226
|
+
fixtureGeneration: number;
|
|
227
|
+
fixtureDigest: string;
|
|
228
|
+
clockTick: number;
|
|
229
|
+
state: MiniappTestFixtureState;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
declare type MiniappTestFixtureSpecialist = {
|
|
233
|
+
id: string;
|
|
234
|
+
value: JsonValue;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
declare type MiniappTestFixtureState = {
|
|
238
|
+
projects: MiniappTestFixtureProjectState[];
|
|
239
|
+
channels: MiniappTestFixtureChannelState[];
|
|
240
|
+
workflows: MiniappTestFixtureWorkflow[];
|
|
241
|
+
vfsFiles: MiniappTestFixtureVfsFile[];
|
|
242
|
+
vfsDirectories: MiniappTestFixtureVfsDirectory[];
|
|
243
|
+
storage: MiniappTestFixtureStorageEntry[];
|
|
244
|
+
presence: MiniappTestFixturePresence[];
|
|
245
|
+
checkpoints: MiniappTestFixtureCheckpoint[];
|
|
246
|
+
specialists: MiniappTestFixtureSpecialist[];
|
|
247
|
+
httpScripts: MiniappTestFixtureHttpScriptState[];
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
declare type MiniappTestFixtureStorageEntry = {
|
|
251
|
+
workspaceId: string;
|
|
252
|
+
packageId: string;
|
|
253
|
+
namespace: string;
|
|
254
|
+
key: string;
|
|
255
|
+
revision: number;
|
|
256
|
+
value: JsonValue;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
declare type MiniappTestFixtureVfsDirectory = {
|
|
260
|
+
conversationId: string;
|
|
261
|
+
path: string;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
declare type MiniappTestFixtureVfsFile = {
|
|
265
|
+
conversationId: string;
|
|
266
|
+
path: string;
|
|
267
|
+
data: number[];
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
declare type MiniappTestFixtureWorkflow = {
|
|
271
|
+
workflowId: string;
|
|
272
|
+
name: string;
|
|
273
|
+
result: JsonValue;
|
|
274
|
+
type?: string | undefined;
|
|
275
|
+
createdAt?: number | undefined;
|
|
276
|
+
updatedAt?: number | undefined;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
declare type MiniappTestRemountSurfaceControlReceipt = {
|
|
280
|
+
schemaVersion: 1;
|
|
281
|
+
requestId: string;
|
|
282
|
+
runId: string;
|
|
283
|
+
operation: 'remount-surface';
|
|
284
|
+
mode: 'MINIAPP_TEST_MODE_SURFACE' | 'MINIAPP_TEST_MODE_LIVE_TAP';
|
|
285
|
+
surfaceGeneration: number;
|
|
286
|
+
fixtureGeneration?: number | undefined;
|
|
287
|
+
fixtureDigest?: string | undefined;
|
|
288
|
+
instanceId: string;
|
|
289
|
+
documentId: string;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
declare type MiniappTestResetFixtureControlReceipt = {
|
|
293
|
+
schemaVersion: 1;
|
|
294
|
+
requestId: string;
|
|
295
|
+
runId: string;
|
|
296
|
+
operation: 'reset-fixture';
|
|
297
|
+
mode: 'MINIAPP_TEST_MODE_SURFACE' | 'MINIAPP_TEST_MODE_LIVE_TAP';
|
|
298
|
+
surfaceGeneration: number;
|
|
299
|
+
fixtureGeneration?: number | undefined;
|
|
300
|
+
fixtureDigest?: string | undefined;
|
|
301
|
+
instanceId: string;
|
|
302
|
+
documentId: string;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
declare type MiniappTestScriptHttpControlReceipt = {
|
|
306
|
+
schemaVersion: 1;
|
|
307
|
+
requestId: string;
|
|
308
|
+
runId: string;
|
|
309
|
+
operation: 'script-http';
|
|
310
|
+
fixtureGeneration: number;
|
|
311
|
+
scriptedRequests: number;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
declare type MiniappTestSeedFixtureControlReceipt = {
|
|
315
|
+
schemaVersion: 1;
|
|
316
|
+
requestId: string;
|
|
317
|
+
runId: string;
|
|
318
|
+
operation: 'seed-fixture';
|
|
319
|
+
fixtureGeneration: number;
|
|
320
|
+
fixtureDigest: string;
|
|
321
|
+
surfaceGeneration: number;
|
|
322
|
+
instanceId: string;
|
|
323
|
+
documentId: string;
|
|
324
|
+
};
|
|
325
|
+
|
|
31
326
|
/** Validate a driver session before any endpoint or provenance field is used. */
|
|
32
327
|
export declare function parseTapMiniappTestSession(value: unknown): TapMiniappTestSession;
|
|
33
328
|
|
|
34
|
-
declare const sessionSchema: z.ZodObject<{
|
|
35
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
36
|
-
runId: z.ZodString;
|
|
37
|
-
workspaceId: z.ZodString;
|
|
38
|
-
channelId: z.ZodString;
|
|
39
|
-
packageId: z.ZodString;
|
|
40
|
-
installationId: z.ZodString;
|
|
41
|
-
mode: z.ZodEnum<{
|
|
42
|
-
surface: "surface";
|
|
43
|
-
"live-tap": "live-tap";
|
|
44
|
-
}>;
|
|
45
|
-
dataScope: z.ZodEnum<{
|
|
46
|
-
fixture: "fixture";
|
|
47
|
-
"selected-channel": "selected-channel";
|
|
48
|
-
}>;
|
|
49
|
-
permissionScenario: z.ZodString;
|
|
50
|
-
surfaceId: z.ZodString;
|
|
51
|
-
surfaceSelector: z.ZodString;
|
|
52
|
-
surfaceAssetOrigin: z.ZodString;
|
|
53
|
-
pageUrlPrefix: z.ZodString;
|
|
54
|
-
cdpEndpoint: z.ZodString;
|
|
55
|
-
cdpAuthorization: z.ZodString;
|
|
56
|
-
artifactDirectory: z.ZodString;
|
|
57
|
-
allowedNetworkOrigins: z.ZodArray<z.ZodString>;
|
|
58
|
-
credentialAliases: z.ZodArray<z.ZodString>;
|
|
59
|
-
releaseDigest: z.ZodOptional<z.ZodString>;
|
|
60
|
-
localGeneration: z.ZodOptional<z.ZodNumber>;
|
|
61
|
-
sourceDigest: z.ZodString;
|
|
62
|
-
testBundleDigest: z.ZodString;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
|
|
65
329
|
declare type TapAfterEachCallback<ExtraContext> = (context: TapHookContext<ExtraContext>) => void | Promise<void>;
|
|
66
330
|
|
|
67
331
|
declare type TapAfterEachHook<ExtraContext = TapRstestFixtures> = (callback: TapAfterEachCallback<ExtraContext>, timeout?: number) => void;
|
|
@@ -70,23 +334,157 @@ declare type TapBeforeEachCallback<ExtraContext> = (context: TapHookContext<Extr
|
|
|
70
334
|
|
|
71
335
|
declare type TapBeforeEachHook<ExtraContext = TapRstestFixtures> = (callback: TapBeforeEachCallback<ExtraContext>, timeout?: number) => void;
|
|
72
336
|
|
|
73
|
-
declare type TapHookContext<ExtraContext> = TestContext &
|
|
337
|
+
declare type TapHookContext<ExtraContext> = TestContext & {
|
|
338
|
+
[Key in keyof TapRstestFixtures]: Key extends keyof ExtraContext ? ExtraContext[Key] : TapRstestFixtures[Key];
|
|
339
|
+
} & Partial<Omit<ExtraContext, keyof TapRstestFixtures>>;
|
|
74
340
|
|
|
75
341
|
export declare type TapMiniappTestControl = {
|
|
76
|
-
/** Restore the
|
|
77
|
-
reset: () => Promise<
|
|
78
|
-
/**
|
|
79
|
-
|
|
342
|
+
/** Restore the declared fixture and permission scenario in Surface mode. */
|
|
343
|
+
reset: () => Promise<TapMiniappTestLifecycleReceipt>;
|
|
344
|
+
/** Remount the surface and await its exact ready handshake. */
|
|
345
|
+
remountSurface: () => Promise<TapMiniappTestLifecycleReceipt>;
|
|
346
|
+
/**
|
|
347
|
+
* Ask the TAP host to emit one versioned platform event through the normal
|
|
348
|
+
* frame bridge. Payloads must be canonical JSON no larger than 60 KiB.
|
|
349
|
+
*/
|
|
350
|
+
emitHostEvent: (event: string, payload?: unknown) => Promise<TapMiniappTestEventReceipt>;
|
|
80
351
|
};
|
|
81
352
|
|
|
82
|
-
export declare type
|
|
353
|
+
export declare type TapMiniappTestEventReceipt = TapMiniappTestEventReceipt_2;
|
|
354
|
+
|
|
355
|
+
declare type TapMiniappTestEventReceipt_2 = DeepReadonly<MiniappTestEmitHostEventControlReceipt>;
|
|
356
|
+
|
|
357
|
+
export declare type TapMiniappTestFixture = Readonly<Pick<TapMiniappTestSession, 'channelId' | 'dataScope' | 'descriptorDigest' | 'environment' | 'artifacts' | 'adapterVersion' | 'fixtureDigest' | 'hostContractVersion' | 'hostVersion' | 'installationId' | 'localGeneration' | 'matrixEntryId' | 'mode' | 'packageId' | 'permissionScenario' | 'policyDigest' | 'profileId' | 'releaseDigest' | 'runnerName' | 'runnerVersion' | 'runId' | 'seed' | 'sourceDigest' | 'surfaceId' | 'surfaceAssetOrigin' | 'testBundleDigest' | 'target' | 'workspaceId'> & {
|
|
83
358
|
/** Origins authorized for host-mediated SDK HTTP, not browser-wide egress. */
|
|
84
359
|
readonly allowedNetworkOrigins: readonly string[];
|
|
85
360
|
readonly credentialAliases: readonly string[];
|
|
361
|
+
fixture: TapMiniappTestFixtureApi;
|
|
86
362
|
control: TapMiniappTestControl;
|
|
87
363
|
}>;
|
|
88
364
|
|
|
89
|
-
export declare type
|
|
365
|
+
export declare type TapMiniappTestFixtureApi = Readonly<{
|
|
366
|
+
/** Public fixture-control contract version. */
|
|
367
|
+
schemaVersion: 1;
|
|
368
|
+
/** Restore the declared fixture and remount an exact ready Surface. */
|
|
369
|
+
reset: () => Promise<TapMiniappTestLifecycleReceipt>;
|
|
370
|
+
/** Replace all deterministic fixture realms with this strict JSON seed. */
|
|
371
|
+
seed: (seed: TapMiniappTestFixtureSeed) => Promise<TapMiniappTestFixtureSeedReceipt>;
|
|
372
|
+
/** Read a deterministic snapshot of every fixture realm. */
|
|
373
|
+
snapshot: () => Promise<TapMiniappTestFixtureSnapshot>;
|
|
374
|
+
/** Exact host-mediated SDK HTTP scripting and request capture. */
|
|
375
|
+
http: Readonly<{
|
|
376
|
+
script: (script: TapMiniappTestFixtureHttpScript) => Promise<TapMiniappTestFixtureScriptReceipt>;
|
|
377
|
+
requests: () => Promise<TapMiniappTestFixtureHttpCaptures>;
|
|
378
|
+
}>;
|
|
379
|
+
/** Ordered host-action, native, platform, and event evidence. */
|
|
380
|
+
ledger: Readonly<{
|
|
381
|
+
read: () => Promise<TapMiniappTestFixtureLedger>;
|
|
382
|
+
}>;
|
|
383
|
+
}>;
|
|
384
|
+
|
|
385
|
+
declare type TapMiniappTestFixtureChannelSeed = DeepReadonly<Omit<GeneratedFixtureChannelSeed, 'messages' | 'specialistIds'> & {
|
|
386
|
+
messages?: readonly GeneratedFixtureChannelSeed['messages'][number][];
|
|
387
|
+
specialistIds?: readonly string[];
|
|
388
|
+
}>;
|
|
389
|
+
|
|
390
|
+
export declare type TapMiniappTestFixtureHttpBodyKind = TapMiniappTestFixtureHttpBodyKind_2;
|
|
391
|
+
|
|
392
|
+
declare type TapMiniappTestFixtureHttpBodyKind_2 = GeneratedFixtureHttpResponse['bodyKind'];
|
|
393
|
+
|
|
394
|
+
export declare type TapMiniappTestFixtureHttpCaptures = TapMiniappTestFixtureHttpCaptures_2;
|
|
395
|
+
|
|
396
|
+
declare type TapMiniappTestFixtureHttpCaptures_2 = DeepReadonly<MiniappTestFixtureHttpCaptures>;
|
|
397
|
+
|
|
398
|
+
export declare type TapMiniappTestFixtureHttpHeaderInput = TapMiniappTestFixtureHttpHeaderInput_2;
|
|
399
|
+
|
|
400
|
+
declare type TapMiniappTestFixtureHttpHeaderInput_2 = Omit<GeneratedFixtureHttpHeaderInput, 'enabled'> & {
|
|
401
|
+
enabled?: boolean | null;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
export declare type TapMiniappTestFixtureHttpRequest = TapMiniappTestFixtureHttpRequest_2;
|
|
405
|
+
|
|
406
|
+
declare type TapMiniappTestFixtureHttpRequest_2 = Omit<GeneratedFixtureHttpRequest, 'body' | 'followRedirects' | 'headers' | 'query' | 'responseBodyLimitBytes' | 'timeoutMs'> & {
|
|
407
|
+
query?: readonly TapMiniappTestFixtureHttpHeaderInput_2[];
|
|
408
|
+
headers?: readonly TapMiniappTestFixtureHttpHeaderInput_2[];
|
|
409
|
+
body?: string | null;
|
|
410
|
+
timeoutMs?: number | null;
|
|
411
|
+
responseBodyLimitBytes?: number | null;
|
|
412
|
+
followRedirects?: boolean | null;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export declare type TapMiniappTestFixtureHttpResponse = TapMiniappTestFixtureHttpResponse_2;
|
|
416
|
+
|
|
417
|
+
declare type TapMiniappTestFixtureHttpResponse_2 = Omit<GeneratedFixtureHttpResponse, 'bodyBase64' | 'bodyKind' | 'bodyText' | 'contentType'> & {
|
|
418
|
+
bodyText: string | null;
|
|
419
|
+
bodyBase64: string | null;
|
|
420
|
+
bodyKind: TapMiniappTestFixtureHttpBodyKind_2;
|
|
421
|
+
contentType: string | null;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
export declare type TapMiniappTestFixtureHttpScript = TapMiniappTestFixtureHttpScript_2;
|
|
425
|
+
|
|
426
|
+
declare type TapMiniappTestFixtureHttpScript_2 = DeepReadonly<Omit<GeneratedFixtureHttpScript, 'request' | 'response'> & {
|
|
427
|
+
request: TapMiniappTestFixtureHttpRequest_2;
|
|
428
|
+
response: TapMiniappTestFixtureHttpResponse_2;
|
|
429
|
+
}>;
|
|
430
|
+
|
|
431
|
+
export declare type TapMiniappTestFixtureHttpScriptState = TapMiniappTestFixtureHttpScriptState_2;
|
|
432
|
+
|
|
433
|
+
declare type TapMiniappTestFixtureHttpScriptState_2 = DeepReadonly<Omit<GeneratedFixtureHttpScriptState, 'request' | 'response'> & {
|
|
434
|
+
request: TapMiniappTestFixtureHttpRequest_2;
|
|
435
|
+
response: TapMiniappTestFixtureHttpResponse_2;
|
|
436
|
+
}>;
|
|
437
|
+
|
|
438
|
+
export declare type TapMiniappTestFixtureLedger = TapMiniappTestFixtureLedger_2;
|
|
439
|
+
|
|
440
|
+
declare type TapMiniappTestFixtureLedger_2 = DeepReadonly<Omit<GeneratedFixtureLedger, 'entries'> & {
|
|
441
|
+
entries: readonly (Omit<GeneratedFixtureLedger['entries'][number], 'kind'> & {
|
|
442
|
+
kind: TapMiniappTestFixtureLedgerKind_2;
|
|
443
|
+
})[];
|
|
444
|
+
}>;
|
|
445
|
+
|
|
446
|
+
export declare type TapMiniappTestFixtureLedgerKind = TapMiniappTestFixtureLedgerKind_2;
|
|
447
|
+
|
|
448
|
+
declare type TapMiniappTestFixtureLedgerKind_2 = GeneratedFixtureLedger['entries'][number]['kind'];
|
|
449
|
+
|
|
450
|
+
declare type TapMiniappTestFixtureProjectSeed = DeepReadonly<Omit<GeneratedFixtureProjectSeed, 'archivedChannelIds' | 'channelIds'> & {
|
|
451
|
+
channelIds?: readonly string[];
|
|
452
|
+
archivedChannelIds?: readonly string[];
|
|
453
|
+
}>;
|
|
454
|
+
|
|
455
|
+
export declare type TapMiniappTestFixtureScriptReceipt = TapMiniappTestFixtureScriptReceipt_2;
|
|
456
|
+
|
|
457
|
+
declare type TapMiniappTestFixtureScriptReceipt_2 = DeepReadonly<MiniappTestScriptHttpControlReceipt>;
|
|
458
|
+
|
|
459
|
+
export declare type TapMiniappTestFixtureSeed = TapMiniappTestFixtureSeed_2;
|
|
460
|
+
|
|
461
|
+
declare type TapMiniappTestFixtureSeed_2 = DeepReadonly<Partial<Omit<GeneratedFixtureSeed, 'channels' | 'httpScripts' | 'projects'>> & {
|
|
462
|
+
projects?: readonly TapMiniappTestFixtureProjectSeed[];
|
|
463
|
+
channels?: readonly TapMiniappTestFixtureChannelSeed[];
|
|
464
|
+
httpScripts?: readonly TapMiniappTestFixtureHttpScript_2[];
|
|
465
|
+
}>;
|
|
466
|
+
|
|
467
|
+
export declare type TapMiniappTestFixtureSeedReceipt = TapMiniappTestFixtureSeedReceipt_2;
|
|
468
|
+
|
|
469
|
+
declare type TapMiniappTestFixtureSeedReceipt_2 = DeepReadonly<MiniappTestSeedFixtureControlReceipt>;
|
|
470
|
+
|
|
471
|
+
export declare type TapMiniappTestFixtureSnapshot = TapMiniappTestFixtureSnapshot_2;
|
|
472
|
+
|
|
473
|
+
declare type TapMiniappTestFixtureSnapshot_2 = DeepReadonly<Omit<GeneratedFixtureSnapshot, 'state'> & {
|
|
474
|
+
state: Omit<GeneratedFixtureSnapshot['state'], 'httpScripts'> & {
|
|
475
|
+
httpScripts: readonly TapMiniappTestFixtureHttpScriptState_2[];
|
|
476
|
+
};
|
|
477
|
+
}>;
|
|
478
|
+
|
|
479
|
+
export declare type TapMiniappTestLifecycleReceipt = TapMiniappTestLifecycleReceipt_2;
|
|
480
|
+
|
|
481
|
+
declare type TapMiniappTestLifecycleReceipt_2 = DeepReadonly<Omit<GeneratedLifecycleReceipt, 'fixtureDigest' | 'fixtureGeneration' | 'mode'> & {
|
|
482
|
+
mode: 'live-tap' | 'surface';
|
|
483
|
+
fixtureGeneration: number | null;
|
|
484
|
+
fixtureDigest: string | null;
|
|
485
|
+
}>;
|
|
486
|
+
|
|
487
|
+
export declare type TapMiniappTestSession = ValidatedTapMiniappTestSession;
|
|
90
488
|
|
|
91
489
|
export declare type TapRstestFixtures = {
|
|
92
490
|
browser: Browser;
|
|
@@ -99,13 +497,15 @@ export declare type TapRstestFixtures = {
|
|
|
99
497
|
};
|
|
100
498
|
|
|
101
499
|
declare type TapRstestTest<ExtraContext = TapRstestFixtures> = Omit<PlaywrightTest<ExtraContext>, 'afterEach' | 'beforeEach' | 'extend'> & {
|
|
102
|
-
(description: string, callback?: (context:
|
|
103
|
-
(description: string, options: TestOptions, callback?: (context:
|
|
500
|
+
(description: string, callback?: (context: TapTestCallbackContext<ExtraContext>) => void | Promise<void>, timeout?: number): void;
|
|
501
|
+
(description: string, options: TestOptions, callback?: (context: TapTestCallbackContext<ExtraContext>) => void | Promise<void>): void;
|
|
104
502
|
afterEach: TapAfterEachHook<ExtraContext>;
|
|
105
503
|
beforeEach: TapBeforeEachHook<ExtraContext>;
|
|
106
504
|
extend: <FixturesContext extends Record<string, unknown> = Record<never, never>>(fixtures: PlaywrightFixtures<FixturesContext, ExtraContext>) => TapRstestTest<MergeContext<ExtraContext, FixturesContext>>;
|
|
107
505
|
};
|
|
108
506
|
|
|
507
|
+
declare type TapTestCallbackContext<ExtraContext> = TestContext & ExtraContext;
|
|
508
|
+
|
|
109
509
|
/** Rstest's per-test context plus TAP's authorized browser and run fixtures. */
|
|
110
510
|
export declare type TapTestContext = TestContext & TapRstestFixtures;
|
|
111
511
|
|
|
@@ -116,4 +516,76 @@ export declare type TapTestContext = TestContext & TapRstestFixtures;
|
|
|
116
516
|
*/
|
|
117
517
|
export declare const test: TapRstestTest;
|
|
118
518
|
|
|
519
|
+
declare type ValidatedTapMiniappTestSession = Readonly<{
|
|
520
|
+
protocolMajor: number;
|
|
521
|
+
protocolMinor: number;
|
|
522
|
+
features: readonly string[];
|
|
523
|
+
runId: string;
|
|
524
|
+
runNonce: string;
|
|
525
|
+
expiresAt: string;
|
|
526
|
+
workspaceId: string;
|
|
527
|
+
channelId: string;
|
|
528
|
+
packageId: string;
|
|
529
|
+
installationId: string;
|
|
530
|
+
bindingId: string;
|
|
531
|
+
releaseDigest?: string;
|
|
532
|
+
localGeneration?: number;
|
|
533
|
+
matrixEntryId: string;
|
|
534
|
+
profileId: string;
|
|
535
|
+
target: string;
|
|
536
|
+
/** @deprecated Use `target`. */
|
|
537
|
+
matrixTarget: string;
|
|
538
|
+
mode: 'surface' | 'live-tap';
|
|
539
|
+
presentation: 'headless' | 'visible';
|
|
540
|
+
dataScope: 'fixture' | 'selected-channel';
|
|
541
|
+
selectedChannelId?: string;
|
|
542
|
+
permissionScenario: string;
|
|
543
|
+
fixtureVersion?: string;
|
|
544
|
+
seed: number;
|
|
545
|
+
environment: Readonly<{
|
|
546
|
+
viewport: Readonly<{
|
|
547
|
+
width: number;
|
|
548
|
+
height: number;
|
|
549
|
+
}>;
|
|
550
|
+
locale: string;
|
|
551
|
+
timezone: string;
|
|
552
|
+
theme: 'dark' | 'light';
|
|
553
|
+
reducedMotion: boolean;
|
|
554
|
+
seed: number;
|
|
555
|
+
fixedNow?: string;
|
|
556
|
+
}>;
|
|
557
|
+
artifacts: Readonly<{
|
|
558
|
+
trace: 'always' | 'failure-only' | 'off';
|
|
559
|
+
screenshots: 'always' | 'failure-only' | 'off';
|
|
560
|
+
maxBytes?: number;
|
|
561
|
+
}>;
|
|
562
|
+
sourceDigest: string;
|
|
563
|
+
testBundleDigest: string;
|
|
564
|
+
descriptorDigest: string;
|
|
565
|
+
fixtureDigest?: string;
|
|
566
|
+
policyDigest: string;
|
|
567
|
+
adapterVersion: string;
|
|
568
|
+
hostVersion: string;
|
|
569
|
+
hostContractVersion: string;
|
|
570
|
+
runnerName: 'rstest';
|
|
571
|
+
runnerVersion: string;
|
|
572
|
+
nodeVersion: string;
|
|
573
|
+
playwrightVersion: string;
|
|
574
|
+
browserEngine: string;
|
|
575
|
+
browserVersion: string;
|
|
576
|
+
targetId: string;
|
|
577
|
+
browserContextId?: string;
|
|
578
|
+
targetType: 'page';
|
|
579
|
+
pageUrl: string;
|
|
580
|
+
surfaceId: string;
|
|
581
|
+
surfaceSelector: string;
|
|
582
|
+
surfaceAssetOrigin: string;
|
|
583
|
+
cdpEndpoint: string;
|
|
584
|
+
cdpAuthorization: string;
|
|
585
|
+
artifactDirectory: string;
|
|
586
|
+
allowedNetworkOrigins: readonly string[];
|
|
587
|
+
effectGrants: readonly string[];
|
|
588
|
+
credentialAliases: readonly string[];
|
|
589
|
+
}>;
|
|
590
|
+
|
|
119
591
|
export { }
|