@le-space/playwright 0.6.29 → 0.6.30
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/index.d.ts +11 -1
- package/index.js +49 -2
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -139,6 +139,8 @@ interface CleanupRelayOptions {
|
|
|
139
139
|
account: RelayWalletAccount;
|
|
140
140
|
instanceName: string;
|
|
141
141
|
instanceHash: string;
|
|
142
|
+
/** Guest-published relay-bootstrap POST to verify after graceful VM shutdown. */
|
|
143
|
+
registrationHash?: string;
|
|
142
144
|
driver?: RelayButtonDriver;
|
|
143
145
|
apiHosts?: readonly string[];
|
|
144
146
|
schedulerUrl?: string;
|
|
@@ -157,6 +159,7 @@ interface CleanupRelayResult {
|
|
|
157
159
|
eraseSummary: string;
|
|
158
160
|
forgetSummary: string;
|
|
159
161
|
verificationSummary: string;
|
|
162
|
+
registrationVerificationSummary?: string;
|
|
160
163
|
}
|
|
161
164
|
interface CleanupRelayHooks {
|
|
162
165
|
erase?: typeof eraseInstanceOnCrn;
|
|
@@ -237,6 +240,13 @@ declare function waitForAlephInstanceDeletion(options: {
|
|
|
237
240
|
pollIntervalMs?: number;
|
|
238
241
|
fetch?: typeof fetch;
|
|
239
242
|
}): Promise<string>;
|
|
243
|
+
declare function waitForAlephMessageForgotten(options: {
|
|
244
|
+
messageHash: string;
|
|
245
|
+
apiHosts?: readonly string[];
|
|
246
|
+
timeoutMs?: number;
|
|
247
|
+
pollIntervalMs?: number;
|
|
248
|
+
fetch?: typeof fetch;
|
|
249
|
+
}): Promise<string>;
|
|
240
250
|
declare function cleanupRelay(options: CleanupRelayOptions): Promise<CleanupRelayResult>;
|
|
241
251
|
declare function createRelayEvidence(options: {
|
|
242
252
|
instanceName: string;
|
|
@@ -255,4 +265,4 @@ declare function createRelayTest(options: CreateRelayTestOptions): _playwright_t
|
|
|
255
265
|
relayLifecycle: RelayLifecycleFixture;
|
|
256
266
|
}, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
|
|
257
267
|
|
|
258
|
-
export { type AlephChromiumConnector, type AlephCostEvidence, type AlephCreditBalanceSnapshot, type AlephPricingSnapshot, type AlephRemoteBrowserOptions, type AlephRunnerInstanceCandidate, type AlephRunnerJanitorSelection, type CleanupRelayHooks, type CleanupRelayOptions, type CleanupRelayResult, type CreateRelayTestOptions, DEFAULT_ALEPH_SCHEDULER_URL, PLAYWRIGHT_RUNNER_VERSION, type ProvisionRelayOptions, type ProvisionedRelay, type RelayAddressPolicy, RelayButtonDriver, type RelayButtonDriverOptions, type RelayEvidence, type RelayEvidenceStep, type RelayLifecycleFixture, type RelayWalletAccount, SUPPORTED_ALEPH_API_HOSTS, type WaitForPubsubSubscriberOptions, appendRelayGithubSummary, buildAlephCostEvidence, cleanupRelay, connectAlephChromium, createRelayEvidence, createRelayTest, findAlephInstanceHash, formatAlephCostGithubSummary, formatRelayGithubSummary, installEip1193WalletMock, provisionRelay, resolveAlephApiHosts, selectBrowserRelayAddresses, selectExpiredAlephPlaywrightRunners, updateRelayEvidenceStep, waitForAlephInstanceDeletion, waitForBootstrapRegistration, waitForDeployableManifest, waitForPubsubSubscriber, writeRelayEvidence };
|
|
268
|
+
export { type AlephChromiumConnector, type AlephCostEvidence, type AlephCreditBalanceSnapshot, type AlephPricingSnapshot, type AlephRemoteBrowserOptions, type AlephRunnerInstanceCandidate, type AlephRunnerJanitorSelection, type CleanupRelayHooks, type CleanupRelayOptions, type CleanupRelayResult, type CreateRelayTestOptions, DEFAULT_ALEPH_SCHEDULER_URL, PLAYWRIGHT_RUNNER_VERSION, type ProvisionRelayOptions, type ProvisionedRelay, type RelayAddressPolicy, RelayButtonDriver, type RelayButtonDriverOptions, type RelayEvidence, type RelayEvidenceStep, type RelayLifecycleFixture, type RelayWalletAccount, SUPPORTED_ALEPH_API_HOSTS, type WaitForPubsubSubscriberOptions, appendRelayGithubSummary, buildAlephCostEvidence, cleanupRelay, connectAlephChromium, createRelayEvidence, createRelayTest, findAlephInstanceHash, formatAlephCostGithubSummary, formatRelayGithubSummary, installEip1193WalletMock, provisionRelay, resolveAlephApiHosts, selectBrowserRelayAddresses, selectExpiredAlephPlaywrightRunners, updateRelayEvidenceStep, waitForAlephInstanceDeletion, waitForAlephMessageForgotten, waitForBootstrapRegistration, waitForDeployableManifest, waitForPubsubSubscriber, writeRelayEvidence };
|
package/index.js
CHANGED
|
@@ -489,6 +489,35 @@ async function waitForAlephInstanceDeletion(options) {
|
|
|
489
489
|
}
|
|
490
490
|
throw new Error(`Aleph INSTANCE ${options.instanceHash} was not deleted within ${options.timeoutMs ?? 5 * 6e4}ms: ${lastSummary}`);
|
|
491
491
|
}
|
|
492
|
+
async function waitForAlephMessageForgotten(options) {
|
|
493
|
+
const fetchImpl = options.fetch ?? globalThis.fetch?.bind(globalThis);
|
|
494
|
+
if (!fetchImpl) throw new Error("A fetch implementation is required for cleanup verification");
|
|
495
|
+
const hosts = resolveAlephApiHosts(options.apiHosts);
|
|
496
|
+
const deadline = Date.now() + (options.timeoutMs ?? 2 * 6e4);
|
|
497
|
+
let lastSummary = "Bootstrap deregistration has not been observed yet.";
|
|
498
|
+
while (Date.now() < deadline) {
|
|
499
|
+
let forgottenOnAllReplicas = true;
|
|
500
|
+
const observations = [];
|
|
501
|
+
for (const apiHost of hosts) {
|
|
502
|
+
try {
|
|
503
|
+
const response = await fetchImpl(new URL(`/api/v0/messages/${options.messageHash}`, apiHost), { cache: "no-cache" });
|
|
504
|
+
const payload = await response.json().catch(() => null);
|
|
505
|
+
const forgotten = payload?.status === "forgotten" || Boolean(payload?.forgotten_by?.length);
|
|
506
|
+
forgottenOnAllReplicas &&= forgotten;
|
|
507
|
+
observations.push(`${apiHost}: ${forgotten ? "forgotten" : payload?.status ?? `HTTP ${response.status}`}`);
|
|
508
|
+
} catch (error) {
|
|
509
|
+
forgottenOnAllReplicas = false;
|
|
510
|
+
observations.push(`${apiHost}: ${error instanceof Error ? error.message : String(error)}`);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
lastSummary = observations.join("; ");
|
|
514
|
+
if (forgottenOnAllReplicas) return lastSummary;
|
|
515
|
+
await delay(options.pollIntervalMs ?? 2e3);
|
|
516
|
+
}
|
|
517
|
+
throw new Error(
|
|
518
|
+
`Aleph bootstrap registration ${options.messageHash} was not deregistered within ${options.timeoutMs ?? 2 * 6e4}ms: ${lastSummary}`
|
|
519
|
+
);
|
|
520
|
+
}
|
|
492
521
|
async function cleanupRelay(options) {
|
|
493
522
|
if (!/^[a-f0-9]{64}$/iu.test(options.instanceHash)) {
|
|
494
523
|
throw new Error(`Invalid Aleph INSTANCE hash: ${options.instanceHash}`);
|
|
@@ -516,13 +545,21 @@ async function cleanupRelay(options) {
|
|
|
516
545
|
pollIntervalMs: options.pollIntervalMs,
|
|
517
546
|
fetch: fetchImpl
|
|
518
547
|
});
|
|
548
|
+
const registrationVerificationSummary2 = options.registrationHash ? await waitForAlephMessageForgotten({
|
|
549
|
+
messageHash: options.registrationHash,
|
|
550
|
+
apiHosts: hosts,
|
|
551
|
+
timeoutMs: options.timeoutMs,
|
|
552
|
+
pollIntervalMs: options.pollIntervalMs,
|
|
553
|
+
fetch: fetchImpl
|
|
554
|
+
}) : void 0;
|
|
519
555
|
return {
|
|
520
556
|
instanceHash: options.instanceHash,
|
|
521
557
|
uiDeleteRequested,
|
|
522
558
|
fallbackUsed: false,
|
|
523
559
|
eraseSummary: "Relay Button UI requested runtime erase",
|
|
524
560
|
forgetSummary: "Relay Button UI submitted FORGET",
|
|
525
|
-
verificationSummary: verificationSummary2
|
|
561
|
+
verificationSummary: verificationSummary2,
|
|
562
|
+
registrationVerificationSummary: registrationVerificationSummary2
|
|
526
563
|
};
|
|
527
564
|
} catch {
|
|
528
565
|
}
|
|
@@ -584,13 +621,21 @@ async function cleanupRelay(options) {
|
|
|
584
621
|
pollIntervalMs: options.pollIntervalMs,
|
|
585
622
|
fetch: fetchImpl
|
|
586
623
|
});
|
|
624
|
+
const registrationVerificationSummary = options.registrationHash ? await waitForAlephMessageForgotten({
|
|
625
|
+
messageHash: options.registrationHash,
|
|
626
|
+
apiHosts: hosts,
|
|
627
|
+
timeoutMs: options.timeoutMs,
|
|
628
|
+
pollIntervalMs: options.pollIntervalMs,
|
|
629
|
+
fetch: fetchImpl
|
|
630
|
+
}) : void 0;
|
|
587
631
|
return {
|
|
588
632
|
instanceHash: options.instanceHash,
|
|
589
633
|
uiDeleteRequested,
|
|
590
634
|
fallbackUsed: true,
|
|
591
635
|
eraseSummary,
|
|
592
636
|
forgetSummary,
|
|
593
|
-
verificationSummary
|
|
637
|
+
verificationSummary,
|
|
638
|
+
registrationVerificationSummary
|
|
594
639
|
};
|
|
595
640
|
}
|
|
596
641
|
function createRelayEvidence(options) {
|
|
@@ -705,6 +750,7 @@ function createRelayTest(options) {
|
|
|
705
750
|
account: options.account,
|
|
706
751
|
instanceName: relay.instanceName,
|
|
707
752
|
instanceHash: relay.instanceHash,
|
|
753
|
+
registrationHash: relay.registration.itemHash ?? relay.registration.hash ?? void 0,
|
|
708
754
|
driver: relay.driver
|
|
709
755
|
})
|
|
710
756
|
);
|
|
@@ -745,6 +791,7 @@ export {
|
|
|
745
791
|
selectExpiredAlephPlaywrightRunners,
|
|
746
792
|
updateRelayEvidenceStep,
|
|
747
793
|
waitForAlephInstanceDeletion,
|
|
794
|
+
waitForAlephMessageForgotten,
|
|
748
795
|
waitForBootstrapRegistration,
|
|
749
796
|
waitForDeployableManifest,
|
|
750
797
|
waitForPubsubSubscriber,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/playwright",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.30",
|
|
4
4
|
"description": "Reusable Playwright fixtures and Relay Button lifecycle helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "https://github.com/NiKrause/relay-button/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@le-space/aleph-bootstrap": "0.6.
|
|
28
|
-
"@le-space/core": "0.6.
|
|
27
|
+
"@le-space/aleph-bootstrap": "0.6.30",
|
|
28
|
+
"@le-space/core": "0.6.30"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@playwright/test": ">=1.61.1 <1.62.0"
|