@sedum-dev/core 0.1.0-alpha.18 → 0.1.0-alpha.21
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/dist/index.d.ts +16 -4
- package/dist/index.js +197 -140
- package/dist/run-result.schema.json +9 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export { j as Ai, k as AiValue, l as FlowStep, m as FormatCoverage, n as ModuleD
|
|
|
5
5
|
import { inspect } from 'node:util';
|
|
6
6
|
import 'playwright/test';
|
|
7
7
|
|
|
8
|
+
/** Whether a test's outcome decides the run; see `ResultTest.blocking`. */
|
|
9
|
+
declare function isBlocking(test: ResultTest): boolean;
|
|
10
|
+
/** A non-blocking test that failed or could not run. */
|
|
11
|
+
declare function nonBlockingFailure(test: ResultTest): boolean;
|
|
8
12
|
declare function resultTotals(tests: readonly ResultTest[], setupCalls?: readonly ResultCall[], selectedTestCount?: number): RunResult["totals"];
|
|
9
13
|
|
|
10
14
|
declare const ResultSourceSchema: z.ZodObject<{
|
|
@@ -687,6 +691,7 @@ declare const ResultTestSchema: z.ZodObject<{
|
|
|
687
691
|
verify: z.ZodString;
|
|
688
692
|
}, z.core.$strict>>;
|
|
689
693
|
tags: z.ZodArray<z.ZodString>;
|
|
694
|
+
blocking: z.ZodOptional<z.ZodLiteral<false>>;
|
|
690
695
|
state: z.ZodEnum<{
|
|
691
696
|
error: "error";
|
|
692
697
|
running: "running";
|
|
@@ -1000,6 +1005,7 @@ declare const ResultTotalsSchema: z.ZodObject<{
|
|
|
1000
1005
|
executedTests: z.ZodNumber;
|
|
1001
1006
|
passedTests: z.ZodNumber;
|
|
1002
1007
|
failedTests: z.ZodNumber;
|
|
1008
|
+
nonBlockingFailedTests: z.ZodOptional<z.ZodNumber>;
|
|
1003
1009
|
passedSteps: z.ZodNumber;
|
|
1004
1010
|
failedSteps: z.ZodNumber;
|
|
1005
1011
|
historicalAttempts: z.ZodNumber;
|
|
@@ -1079,6 +1085,7 @@ declare const RunResultSchema: z.ZodObject<{
|
|
|
1079
1085
|
executedTests: z.ZodNumber;
|
|
1080
1086
|
passedTests: z.ZodNumber;
|
|
1081
1087
|
failedTests: z.ZodNumber;
|
|
1088
|
+
nonBlockingFailedTests: z.ZodOptional<z.ZodNumber>;
|
|
1082
1089
|
passedSteps: z.ZodNumber;
|
|
1083
1090
|
failedSteps: z.ZodNumber;
|
|
1084
1091
|
historicalAttempts: z.ZodNumber;
|
|
@@ -1123,6 +1130,7 @@ declare const RunResultSchema: z.ZodObject<{
|
|
|
1123
1130
|
verify: z.ZodString;
|
|
1124
1131
|
}, z.core.$strict>>;
|
|
1125
1132
|
tags: z.ZodArray<z.ZodString>;
|
|
1133
|
+
blocking: z.ZodOptional<z.ZodLiteral<false>>;
|
|
1126
1134
|
state: z.ZodEnum<{
|
|
1127
1135
|
error: "error";
|
|
1128
1136
|
running: "running";
|
|
@@ -1504,6 +1512,7 @@ declare class RunRecorder {
|
|
|
1504
1512
|
private readonly started;
|
|
1505
1513
|
private value;
|
|
1506
1514
|
private readonly ordinals;
|
|
1515
|
+
private nonBlocking;
|
|
1507
1516
|
private lastTestId;
|
|
1508
1517
|
constructor(sink: ResultSink, runId?: string);
|
|
1509
1518
|
get runId(): string;
|
|
@@ -1517,8 +1526,12 @@ declare class RunRecorder {
|
|
|
1517
1526
|
start(): Promise<void>;
|
|
1518
1527
|
addSetupCalls(calls: readonly ResultCall[]): Promise<void>;
|
|
1519
1528
|
addDiscoveryProblems(problems: NonNullable<RunResult["discoveryProblems"]>): Promise<void>;
|
|
1520
|
-
/**
|
|
1521
|
-
|
|
1529
|
+
/**
|
|
1530
|
+
* Record the selection size and, for parallel or sharded runs, how it runs.
|
|
1531
|
+
* Tests named in `nonBlockingIds` are recorded with `blocking: false` when
|
|
1532
|
+
* they start.
|
|
1533
|
+
*/
|
|
1534
|
+
selectTests(count: number, execution?: ResultExecution, nonBlockingIds?: readonly string[]): Promise<void>;
|
|
1522
1535
|
/** The recording for a selection ordinal, if that test has started. */
|
|
1523
1536
|
testAt(ordinal: number): TestRecording | undefined;
|
|
1524
1537
|
/** The most recently started test, for sequential single-test callers. */
|
|
@@ -3537,7 +3550,6 @@ interface SentencePresentation {
|
|
|
3537
3550
|
/** A question the test branches on: judged once and never gating. */
|
|
3538
3551
|
readonly check?: boolean;
|
|
3539
3552
|
}
|
|
3540
|
-
/** @internal Execute one classified sentence and record it as one step. */
|
|
3541
3553
|
declare function executeSentence(page: BrowserPage, step: ClassifiedFlowSentence, dependencies: AttemptDependencies, data: Record<string, ResolvedDataEntry>, opaqueEntries: ResolvedDataEntry[], presentation?: SentencePresentation): Promise<"continue" | "failed" | FlowRunResult>;
|
|
3542
3554
|
|
|
3543
3555
|
/** Capture the current safe page and selected target for a terminal goal failure. */
|
|
@@ -4204,4 +4216,4 @@ interface ActionRequest {
|
|
|
4204
4216
|
readonly description: string;
|
|
4205
4217
|
}
|
|
4206
4218
|
|
|
4207
|
-
export { ACCEPTANCE_POLICY_VERSION, type ActionRequest, AiValues, type Aim, type AimResult, type AllowRule, AssertionEngineError, type AssertionEngineErrorCode, type AssertionOptions, type AttemptDependencies, type AttemptReport, BACKOFF_JITTER, type BrowserContextOptions, type BrowserContextSession, type BrowserDriver, BrowserDriverError, type BrowserDriverErrorCode, type BrowserInstallResult, type BrowserKind, type BrowserLaunchOptions, type BrowserPage, type BrowserSession, type BrowserSignal, type BrowserSignalSource, BugDetector, type BugDetectorOptions, CACHE_FORMAT, CANDIDATE_LIMIT, CLASSIFICATION_PROMPT_VERSION, type CacheEntry, type CacheLookup, type CacheMissReason, type CacheStore, type CachedClassification, type Candidate, type CandidatePage, type ChoiceWhy, ClassificationBatchError, type ClassificationCache, type ClassificationDiagnostic, type ClassificationDiagnosticCode, type ClassificationInput, type ClassificationMetrics, type ClassificationOptions, type ClassificationProvider, type ClassificationResult, type ClassifiedFlowDefinition, type ClassifiedFlowSentence, type ClassifiedFlowStep, type ClassifiedModuleStep, type ClassifiedStep, type ClassifyFlowOptions, type ClickOptions, type ClickResult, type ControlStateResult, DEFAULT_ALLOW, DEFAULT_BAND, DEFAULT_CONTRADICTION_CUTOFF, DEFAULT_MAX_SEVERAL, DEFAULT_MIN_P, DEFAULT_PROVIDER_CONCURRENCY, DEFAULT_SEMANTIC_THRESHOLDS, DEFAULT_TUNING, DIGEST_LIMIT, DataResolutionError, DeclaredDataValue, type Detection, type DetectionCheck, type DetectorCall, type DigestResult, type DiscoveryProblem, type DiscoveryProblemCode, type EmittedStep, type EmittedTest, type ExplorationAdvisor, type ExploreAction, type ExploreActionKind, type ExploreAdvice, type ExploreAdviceRequest, type ExploreDecision, type ExploreDecisionRequest, type ExploreFailure, type ExploreFinding, type ExploreMode, type ExploreOptions, type ExploreResult, type ExploreRunMeta, type ExploreRunResult, type ExploreSafety, type ExploreStepView, type ExploreTuning, FileClassificationCache, type FillResult, type FillTarget, type FindingTest, type FlowClassificationDiagnostic, type FlowClassificationResult, FlowDefinition, FlowDiagnostic, type FlowRunResult, type FlowRunnerDependencies, FlowScalar, FlowSource, FlowToken, FlowValidationResult, type FrameBox, type FreshPage, FullValidationCoverage, GOAL_NO_MATCH, GateAborted, GateWaitExceeded, type GoalAction, type GoalChoice, type GoalDecision, type GoalOptions, type GoalPlanner, type GoalResult, type GoalState, type GoalValueState, type HelperCall, type HistoryMove, INSPECTED_PAGE_LIMITS, type ImportBinding, type InputSource, type InspectedPage, type InvalidListEntry, type ItemVerdict, type Judge, type JudgeDecision, type JudgePageDigest, type LineRange, type ListedDiagnostic, type ListedTest, type LoadedScriptFile, LocatorCacheConflict, type LocatorCacheDiagnostic, type LocatorCacheLookup, type LocatorCacheSeed, type LocatorDiagnostic, type LocatorFailure, type LocatorOptionDiagnostic, type LocatorOptions, type LocatorResult, MATCHER_VERSION, MAX_COOLDOWN_MS, MAX_PROVIDER_CONCURRENCY, MIN_MODEL_MARGIN, MIN_MODEL_PROBABILITY, MODEL_CHOICES, type MatchResult, type MeasureResult, type ModelChoice, type ModelClassification, type ModelDecision, ModuleBinding, ModuleBindingResolutionError, ModuleStep, NAME_LIMIT, NOT_CHECKED_OFFLINE_CODE, NO_PAGE_FINDINGS, type NavigationOptions, type NavigationResult, NoopCacheStore, NoopClassificationCache, OPERATIONS, OPERATION_SET_VERSION, type Operation, type OracleEvent, type OracleOptions, PAGE_KINDS, PAGE_PROTOCOL, PEER_LIMIT, type PageBridge, type PageCheck, PageChecks, type PageChecksOptions, type PageFindings, type PageInspection, type PageInspector, PageScriptError, PageSignalCollector, type PageVersion, type ParseFlowOptions, ParsedFlowResult, ParsedModuleResult, PlaywrightBrowserDriver, type PlaywrightBrowserDriverOptions, type ProjectFileValidation, type ProjectFiles, type ProjectValidationCounts, type ProjectValidationOptions, type ProjectValidationResult, type ProviderCall, type ProviderCallOptions, ProviderError, type ProviderErrorCode, ProviderGate, type ProviderGateOptions, type ProviderRate, type ProviderTokenUsage, RATE_LIMIT_BUDGET_MS, type ReadTargetResult, type RejectionOwner, RejectionRouter, type RelevanceProvider, type RelevanceTest, type RepeatedMemberPolicy, type ReportPrivacy, type ResolveFlowModulesOptions, type ResolvedDataEntry, type ResolvedFlowResult, ResolvedModuleCall, ResolvedStepTarget, type Resolver, type ResolverCandidate, type ResolverCandidates, type ResolverDecision, type ResolverItem, type ResolverOption, type ResultAttempt, ResultAttemptSchema, type ResultCall, ResultCallSchema, type ResultDetection, ResultDetectionSchema, ResultErrorSchema, type ResultExecution, ResultExecutionSchema, type ResultFrame, ResultFrameSchema, ResultJudgementSchema, ResultLocatorSchema, ResultObservationSchema, type ResultPage, ResultPageSchema, type ResultProblem, ResultProblemSchema, type ResultSink, ResultSourceSchema, type ResultStep, ResultStepSchema, type ResultTest, ResultTestSchema, ResultTotalsSchema, ReusableBrowserDriver, RunRecorder, type RunResult, RunResultSchema, type RunningTest, RuntimeUrl, RuntimeValue, SCRIPT_TEST_SUFFIX, SEMANTIC_CHECKS, ScriptRegistration, type ScriptSentence, type ScriptSentenceScan, type ScriptTest, ScriptUsageError, SeededRandom, type SemanticCheck, type SemanticThresholds, type SentenceClassification, type SentencePresentation, SentenceStep, type SettleOptions, type SettleResult, type ShrinkResult, type SignalSettleOptions, type StateInspection, type StepCommand, StepExecutionError, type StepExecutionOptions, type StepExecutionResult, type StepFailureCode, type StepFailurePhase, type StepFrames, type StepInspection, type StepOperation, type StepOperationKind, type StepOutcome, type StepSource, type StepTokenization, type StrayReason, TEST_SUFFIXES, type TargetCheckDecision, type TargetCheckInput, type TargetCheckOptions, type TargetChecker, type TargetIdentity, TestBody, type TestListing, TestRecording, type TestStartInput, type TraceEntry, type UnattributedRejection, ValidationInput, type VerifyDecision, type VerifyFlag, type VerifyOptions, type VerifyPolicy, type VerifyResult, type VisionFailure, type VisionObservation, type VisionResolver, WAIT_UNTIL, type WriteRecord, allowed, attributeRejection, backoffDelay, buildExploreRunResult, buildRelevanceBatches, callExtent, canonicalSentence, captureVisionObservation, checkRegistrations, classificationKey, classifyParsedFlow, classifySentenceSteps, classifySteps, clearPageRefs, clickTarget, closeQuietly, codePoints, collectCandidates, compareDiagnostics, controlState, cooldownDelay, dedupeDiagnostics, describeAction, describeRejection, discoverFlowFiles, discoverProjectFiles, displayPath, emitTest, evaluateModelAnswer, evaluateVerifyScores, executeSentence, executeStep, explore, findBrowserExecutable, findIdentityCollisions, firstDiagnostic, goalChoiceAccepted, goalFailureArtifacts, goalOperations, inlineValues, installChromium, isClaimSentence, isFlowScalar, isPageInspector, isRunWideProviderError, isSafeRole, isScriptTestFile, isStaticHoldsClaim, isWeakPeer, keyedDigest, listTests, liveCandidates, loadFlowFile, loadListingEntries, loadScriptFile, looksDestructive, matchEntry, matchLiveEntry, measure, navigationWhy, nextConcurrency, normalizeSignal, opaqueMatches, pageDigest, pageKey, pageVersion, parseAllowRule, parseDataTemplate, parseFlow, parseModule, parseRetryAfter, patternOperation, preflightSentence, projectCandidates, projectDigest, quietPage, readTarget, recordGoalAction, redactOpaqueText, relevanceQuestion, replay, reportPage, resolveData, resolveEntryUrl, resolveFlowModules, resolveModuleBindings, resolveTarget, resolveTypeOperand, resultCall, resultTotals, runFlow, runGoal, runResultJsonSchema, runScriptTest, runtimeFailure, safeSource, safeText, safeUrl, sameVisualVersion, scanImportBindings, scanLocalImports, scanScriptSentences, scriptListingEntries, semanticDetections, shrink, signalDetection, stageEntry, stateDetections, targetVariants, textDetections, tokenize, tokenizeStep, uniqueDetections, unknownCostCall, validateFlows, validateOperand, validateProject, validateRunResult, validateTypeOperand, valueEntries, verify, visibleText, visualCandidates, walkSuiteFiles };
|
|
4219
|
+
export { ACCEPTANCE_POLICY_VERSION, type ActionRequest, AiValues, type Aim, type AimResult, type AllowRule, AssertionEngineError, type AssertionEngineErrorCode, type AssertionOptions, type AttemptDependencies, type AttemptReport, BACKOFF_JITTER, type BrowserContextOptions, type BrowserContextSession, type BrowserDriver, BrowserDriverError, type BrowserDriverErrorCode, type BrowserInstallResult, type BrowserKind, type BrowserLaunchOptions, type BrowserPage, type BrowserSession, type BrowserSignal, type BrowserSignalSource, BugDetector, type BugDetectorOptions, CACHE_FORMAT, CANDIDATE_LIMIT, CLASSIFICATION_PROMPT_VERSION, type CacheEntry, type CacheLookup, type CacheMissReason, type CacheStore, type CachedClassification, type Candidate, type CandidatePage, type ChoiceWhy, ClassificationBatchError, type ClassificationCache, type ClassificationDiagnostic, type ClassificationDiagnosticCode, type ClassificationInput, type ClassificationMetrics, type ClassificationOptions, type ClassificationProvider, type ClassificationResult, type ClassifiedFlowDefinition, type ClassifiedFlowSentence, type ClassifiedFlowStep, type ClassifiedModuleStep, type ClassifiedStep, type ClassifyFlowOptions, type ClickOptions, type ClickResult, type ControlStateResult, DEFAULT_ALLOW, DEFAULT_BAND, DEFAULT_CONTRADICTION_CUTOFF, DEFAULT_MAX_SEVERAL, DEFAULT_MIN_P, DEFAULT_PROVIDER_CONCURRENCY, DEFAULT_SEMANTIC_THRESHOLDS, DEFAULT_TUNING, DIGEST_LIMIT, DataResolutionError, DeclaredDataValue, type Detection, type DetectionCheck, type DetectorCall, type DigestResult, type DiscoveryProblem, type DiscoveryProblemCode, type EmittedStep, type EmittedTest, type ExplorationAdvisor, type ExploreAction, type ExploreActionKind, type ExploreAdvice, type ExploreAdviceRequest, type ExploreDecision, type ExploreDecisionRequest, type ExploreFailure, type ExploreFinding, type ExploreMode, type ExploreOptions, type ExploreResult, type ExploreRunMeta, type ExploreRunResult, type ExploreSafety, type ExploreStepView, type ExploreTuning, FileClassificationCache, type FillResult, type FillTarget, type FindingTest, type FlowClassificationDiagnostic, type FlowClassificationResult, FlowDefinition, FlowDiagnostic, type FlowRunResult, type FlowRunnerDependencies, FlowScalar, FlowSource, FlowToken, FlowValidationResult, type FrameBox, type FreshPage, FullValidationCoverage, GOAL_NO_MATCH, GateAborted, GateWaitExceeded, type GoalAction, type GoalChoice, type GoalDecision, type GoalOptions, type GoalPlanner, type GoalResult, type GoalState, type GoalValueState, type HelperCall, type HistoryMove, INSPECTED_PAGE_LIMITS, type ImportBinding, type InputSource, type InspectedPage, type InvalidListEntry, type ItemVerdict, type Judge, type JudgeDecision, type JudgePageDigest, type LineRange, type ListedDiagnostic, type ListedTest, type LoadedScriptFile, LocatorCacheConflict, type LocatorCacheDiagnostic, type LocatorCacheLookup, type LocatorCacheSeed, type LocatorDiagnostic, type LocatorFailure, type LocatorOptionDiagnostic, type LocatorOptions, type LocatorResult, MATCHER_VERSION, MAX_COOLDOWN_MS, MAX_PROVIDER_CONCURRENCY, MIN_MODEL_MARGIN, MIN_MODEL_PROBABILITY, MODEL_CHOICES, type MatchResult, type MeasureResult, type ModelChoice, type ModelClassification, type ModelDecision, ModuleBinding, ModuleBindingResolutionError, ModuleStep, NAME_LIMIT, NOT_CHECKED_OFFLINE_CODE, NO_PAGE_FINDINGS, type NavigationOptions, type NavigationResult, NoopCacheStore, NoopClassificationCache, OPERATIONS, OPERATION_SET_VERSION, type Operation, type OracleEvent, type OracleOptions, PAGE_KINDS, PAGE_PROTOCOL, PEER_LIMIT, type PageBridge, type PageCheck, PageChecks, type PageChecksOptions, type PageFindings, type PageInspection, type PageInspector, PageScriptError, PageSignalCollector, type PageVersion, type ParseFlowOptions, ParsedFlowResult, ParsedModuleResult, PlaywrightBrowserDriver, type PlaywrightBrowserDriverOptions, type ProjectFileValidation, type ProjectFiles, type ProjectValidationCounts, type ProjectValidationOptions, type ProjectValidationResult, type ProviderCall, type ProviderCallOptions, ProviderError, type ProviderErrorCode, ProviderGate, type ProviderGateOptions, type ProviderRate, type ProviderTokenUsage, RATE_LIMIT_BUDGET_MS, type ReadTargetResult, type RejectionOwner, RejectionRouter, type RelevanceProvider, type RelevanceTest, type RepeatedMemberPolicy, type ReportPrivacy, type ResolveFlowModulesOptions, type ResolvedDataEntry, type ResolvedFlowResult, ResolvedModuleCall, ResolvedStepTarget, type Resolver, type ResolverCandidate, type ResolverCandidates, type ResolverDecision, type ResolverItem, type ResolverOption, type ResultAttempt, ResultAttemptSchema, type ResultCall, ResultCallSchema, type ResultDetection, ResultDetectionSchema, ResultErrorSchema, type ResultExecution, ResultExecutionSchema, type ResultFrame, ResultFrameSchema, ResultJudgementSchema, ResultLocatorSchema, ResultObservationSchema, type ResultPage, ResultPageSchema, type ResultProblem, ResultProblemSchema, type ResultSink, ResultSourceSchema, type ResultStep, ResultStepSchema, type ResultTest, ResultTestSchema, ResultTotalsSchema, ReusableBrowserDriver, RunRecorder, type RunResult, RunResultSchema, type RunningTest, RuntimeUrl, RuntimeValue, SCRIPT_TEST_SUFFIX, SEMANTIC_CHECKS, ScriptRegistration, type ScriptSentence, type ScriptSentenceScan, type ScriptTest, ScriptUsageError, SeededRandom, type SemanticCheck, type SemanticThresholds, type SentenceClassification, type SentencePresentation, SentenceStep, type SettleOptions, type SettleResult, type ShrinkResult, type SignalSettleOptions, type StateInspection, type StepCommand, StepExecutionError, type StepExecutionOptions, type StepExecutionResult, type StepFailureCode, type StepFailurePhase, type StepFrames, type StepInspection, type StepOperation, type StepOperationKind, type StepOutcome, type StepSource, type StepTokenization, type StrayReason, TEST_SUFFIXES, type TargetCheckDecision, type TargetCheckInput, type TargetCheckOptions, type TargetChecker, type TargetIdentity, TestBody, type TestListing, TestRecording, type TestStartInput, type TraceEntry, type UnattributedRejection, ValidationInput, type VerifyDecision, type VerifyFlag, type VerifyOptions, type VerifyPolicy, type VerifyResult, type VisionFailure, type VisionObservation, type VisionResolver, WAIT_UNTIL, type WriteRecord, allowed, attributeRejection, backoffDelay, buildExploreRunResult, buildRelevanceBatches, callExtent, canonicalSentence, captureVisionObservation, checkRegistrations, classificationKey, classifyParsedFlow, classifySentenceSteps, classifySteps, clearPageRefs, clickTarget, closeQuietly, codePoints, collectCandidates, compareDiagnostics, controlState, cooldownDelay, dedupeDiagnostics, describeAction, describeRejection, discoverFlowFiles, discoverProjectFiles, displayPath, emitTest, evaluateModelAnswer, evaluateVerifyScores, executeSentence, executeStep, explore, findBrowserExecutable, findIdentityCollisions, firstDiagnostic, goalChoiceAccepted, goalFailureArtifacts, goalOperations, inlineValues, installChromium, isBlocking, isClaimSentence, isFlowScalar, isPageInspector, isRunWideProviderError, isSafeRole, isScriptTestFile, isStaticHoldsClaim, isWeakPeer, keyedDigest, listTests, liveCandidates, loadFlowFile, loadListingEntries, loadScriptFile, looksDestructive, matchEntry, matchLiveEntry, measure, navigationWhy, nextConcurrency, nonBlockingFailure, normalizeSignal, opaqueMatches, pageDigest, pageKey, pageVersion, parseAllowRule, parseDataTemplate, parseFlow, parseModule, parseRetryAfter, patternOperation, preflightSentence, projectCandidates, projectDigest, quietPage, readTarget, recordGoalAction, redactOpaqueText, relevanceQuestion, replay, reportPage, resolveData, resolveEntryUrl, resolveFlowModules, resolveModuleBindings, resolveTarget, resolveTypeOperand, resultCall, resultTotals, runFlow, runGoal, runResultJsonSchema, runScriptTest, runtimeFailure, safeSource, safeText, safeUrl, sameVisualVersion, scanImportBindings, scanLocalImports, scanScriptSentences, scriptListingEntries, semanticDetections, shrink, signalDetection, stageEntry, stateDetections, targetVariants, textDetections, tokenize, tokenizeStep, uniqueDetections, unknownCostCall, validateFlows, validateOperand, validateProject, validateRunResult, validateTypeOperand, valueEntries, verify, visibleText, visualCandidates, walkSuiteFiles };
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,21 @@ import {
|
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
|
|
16
16
|
// src/run-result/validation.ts
|
|
17
|
+
function isBlocking(test2) {
|
|
18
|
+
return test2.blocking !== false;
|
|
19
|
+
}
|
|
20
|
+
function nonBlockingFailure(test2) {
|
|
21
|
+
return !isBlocking(test2) && (test2.verdict === "failed" || test2.state === "error");
|
|
22
|
+
}
|
|
23
|
+
function completedRunVerdict(tests) {
|
|
24
|
+
const blocking = tests.filter(isBlocking);
|
|
25
|
+
if (blocking.some((test2) => test2.verdict === "failed")) return "failed";
|
|
26
|
+
if (blocking.every((test2) => test2.verdict === "passed")) return "passed";
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function runFlags(tests) {
|
|
30
|
+
return [...new Set(tests.filter(isBlocking).flatMap((test2) => test2.flags))];
|
|
31
|
+
}
|
|
17
32
|
function resultTotals(tests, setupCalls = [], selectedTestCount = tests.length) {
|
|
18
33
|
const selected = tests.flatMap(
|
|
19
34
|
(test2) => test2.attempts.filter((attempt) => attempt.id === test2.selectedAttemptId)
|
|
@@ -33,7 +48,10 @@ function resultTotals(tests, setupCalls = [], selectedTestCount = tests.length)
|
|
|
33
48
|
selectedTests: selectedTestCount,
|
|
34
49
|
executedTests: tests.filter((test2) => test2.attempts.length > 0).length,
|
|
35
50
|
passedTests: tests.filter((test2) => test2.verdict === "passed").length,
|
|
36
|
-
failedTests: tests.filter(
|
|
51
|
+
failedTests: tests.filter(
|
|
52
|
+
(test2) => isBlocking(test2) && test2.verdict === "failed"
|
|
53
|
+
).length,
|
|
54
|
+
...tests.some((test2) => !isBlocking(test2)) ? { nonBlockingFailedTests: tests.filter(nonBlockingFailure).length } : {},
|
|
37
55
|
passedSteps: steps.filter((step) => step.verdict === "passed").length,
|
|
38
56
|
failedSteps: steps.filter((step) => step.verdict === "failed").length,
|
|
39
57
|
historicalAttempts: tests.reduce(
|
|
@@ -208,9 +226,7 @@ function validateTest(test2, ids) {
|
|
|
208
226
|
function expectedRunVerdict(result) {
|
|
209
227
|
if (result.error || result.state !== "completed" || result.tests.length === 0)
|
|
210
228
|
return null;
|
|
211
|
-
|
|
212
|
-
if (result.tests.every((test2) => test2.verdict === "passed")) return "passed";
|
|
213
|
-
return null;
|
|
229
|
+
return completedRunVerdict(result.tests);
|
|
214
230
|
}
|
|
215
231
|
function validateRunAggregates(result) {
|
|
216
232
|
const expectedTotals = resultTotals(
|
|
@@ -226,15 +242,14 @@ function validateRunAggregates(result) {
|
|
|
226
242
|
result.verdict !== expectedRunVerdict(result),
|
|
227
243
|
"Run verdict differs from tests"
|
|
228
244
|
);
|
|
229
|
-
const runFlags = [...new Set(result.tests.flatMap((test2) => test2.flags))];
|
|
230
245
|
rejectIf(
|
|
231
|
-
JSON.stringify(result.flags) !== JSON.stringify(runFlags),
|
|
246
|
+
JSON.stringify(result.flags) !== JSON.stringify(runFlags(result.tests)),
|
|
232
247
|
"Run flags differ from tests"
|
|
233
248
|
);
|
|
234
249
|
}
|
|
235
250
|
function validateRunCompletion(result) {
|
|
236
251
|
const hasIncompleteTest = result.tests.some(
|
|
237
|
-
(test2) => test2.state !== "completed"
|
|
252
|
+
(test2) => test2.state !== "completed" && (isBlocking(test2) || test2.state !== "error")
|
|
238
253
|
);
|
|
239
254
|
rejectIf(
|
|
240
255
|
result.state === "completed" && (result.error !== null || result.tests.length === 0 || hasIncompleteTest),
|
|
@@ -486,6 +501,12 @@ var ResultTestSchema = z.strictObject({
|
|
|
486
501
|
description: z.string().max(512),
|
|
487
502
|
goal: z.strictObject({ text: z.string(), verify: z.string() }).optional(),
|
|
488
503
|
tags: z.array(z.string().max(120)),
|
|
504
|
+
/**
|
|
505
|
+
* `false` when `--non-blocking-labels` matched a tag: the test runs and is
|
|
506
|
+
* reported, but its failure or error does not decide the run. Absent means
|
|
507
|
+
* blocking.
|
|
508
|
+
*/
|
|
509
|
+
blocking: z.literal(false).optional(),
|
|
489
510
|
state,
|
|
490
511
|
verdict: verdict.nullable(),
|
|
491
512
|
flags: z.array(flag),
|
|
@@ -496,7 +517,10 @@ var ResultTotalsSchema = z.strictObject({
|
|
|
496
517
|
selectedTests: count,
|
|
497
518
|
executedTests: count,
|
|
498
519
|
passedTests: count,
|
|
520
|
+
/** Failed blocking tests; non-blocking failures count separately. */
|
|
499
521
|
failedTests: count,
|
|
522
|
+
/** Non-blocking tests that failed or could not run; present when any test is non-blocking. */
|
|
523
|
+
nonBlockingFailedTests: count.optional(),
|
|
500
524
|
passedSteps: count,
|
|
501
525
|
failedSteps: count,
|
|
502
526
|
historicalAttempts: count,
|
|
@@ -634,6 +658,20 @@ function newAttempt(runId, ordinal2, lane2) {
|
|
|
634
658
|
primaryProblemId: null
|
|
635
659
|
};
|
|
636
660
|
}
|
|
661
|
+
function newTest(input, attempt, blocking) {
|
|
662
|
+
return {
|
|
663
|
+
id: input.id,
|
|
664
|
+
file: input.file,
|
|
665
|
+
description: input.description ?? "",
|
|
666
|
+
tags: [...input.tags ?? []],
|
|
667
|
+
...blocking ? {} : { blocking: false },
|
|
668
|
+
state: "running",
|
|
669
|
+
verdict: null,
|
|
670
|
+
flags: [],
|
|
671
|
+
selectedAttemptId: attempt.id,
|
|
672
|
+
attempts: [attempt]
|
|
673
|
+
};
|
|
674
|
+
}
|
|
637
675
|
var RunRecorder = class {
|
|
638
676
|
constructor(sink, runId = randomUUID()) {
|
|
639
677
|
this.sink = sink;
|
|
@@ -660,6 +698,7 @@ var RunRecorder = class {
|
|
|
660
698
|
started = performance.now();
|
|
661
699
|
value;
|
|
662
700
|
ordinals = /* @__PURE__ */ new Map();
|
|
701
|
+
nonBlocking = /* @__PURE__ */ new Set();
|
|
663
702
|
lastTestId = null;
|
|
664
703
|
get runId() {
|
|
665
704
|
return this.value.runId;
|
|
@@ -677,9 +716,7 @@ var RunRecorder = class {
|
|
|
677
716
|
this.value.setupCalls,
|
|
678
717
|
Math.max(this.value.selectedTestCount ?? 0, this.value.tests.length)
|
|
679
718
|
),
|
|
680
|
-
flags:
|
|
681
|
-
...new Set(this.value.tests.flatMap((test2) => test2.flags))
|
|
682
|
-
]
|
|
719
|
+
flags: runFlags(this.value.tests)
|
|
683
720
|
};
|
|
684
721
|
await this.sink(validateRunResult(this.value));
|
|
685
722
|
}
|
|
@@ -728,10 +765,15 @@ var RunRecorder = class {
|
|
|
728
765
|
};
|
|
729
766
|
await this.publish();
|
|
730
767
|
}
|
|
731
|
-
/**
|
|
732
|
-
|
|
768
|
+
/**
|
|
769
|
+
* Record the selection size and, for parallel or sharded runs, how it runs.
|
|
770
|
+
* Tests named in `nonBlockingIds` are recorded with `blocking: false` when
|
|
771
|
+
* they start.
|
|
772
|
+
*/
|
|
773
|
+
async selectTests(count2, execution, nonBlockingIds = []) {
|
|
733
774
|
if (!Number.isSafeInteger(count2) || count2 < this.value.tests.length)
|
|
734
775
|
throw new Error("Selected test count is invalid");
|
|
776
|
+
this.nonBlocking = new Set(nonBlockingIds);
|
|
735
777
|
this.value = {
|
|
736
778
|
...this.value,
|
|
737
779
|
selectedTestCount: count2,
|
|
@@ -760,18 +802,11 @@ var RunRecorder = class {
|
|
|
760
802
|
const ordinal2 = input.ordinal ?? Math.max(-1, ...this.ordinals.values()) + 1;
|
|
761
803
|
if ([...this.ordinals.values()].includes(ordinal2))
|
|
762
804
|
throw new Error("Test ordinal already started");
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
tags: [...input.tags ?? []],
|
|
769
|
-
state: "running",
|
|
770
|
-
verdict: null,
|
|
771
|
-
flags: [],
|
|
772
|
-
selectedAttemptId: attempt.id,
|
|
773
|
-
attempts: [attempt]
|
|
774
|
-
};
|
|
805
|
+
const test2 = newTest(
|
|
806
|
+
input,
|
|
807
|
+
newAttempt(this.value.runId, 1, input.lane),
|
|
808
|
+
!this.nonBlocking.has(input.id)
|
|
809
|
+
);
|
|
775
810
|
const position = this.value.tests.findIndex(
|
|
776
811
|
(entry) => (this.ordinals.get(entry.id) ?? 0) > ordinal2
|
|
777
812
|
);
|
|
@@ -982,15 +1017,13 @@ var RunRecorder = class {
|
|
|
982
1017
|
};
|
|
983
1018
|
}
|
|
984
1019
|
const tests = this.value.tests;
|
|
985
|
-
const verdict2 = error2 || tests.length === 0
|
|
1020
|
+
const verdict2 = error2 || tests.length === 0 ? null : completedRunVerdict(tests);
|
|
986
1021
|
this.value = {
|
|
987
1022
|
...this.value,
|
|
988
1023
|
state: error2 ? terminalState : "completed",
|
|
989
1024
|
error: error2,
|
|
990
1025
|
verdict: verdict2,
|
|
991
|
-
flags:
|
|
992
|
-
...new Set(tests.flatMap((test2) => test2.flags))
|
|
993
|
-
],
|
|
1026
|
+
flags: runFlags(tests),
|
|
994
1027
|
finishedAt: at
|
|
995
1028
|
};
|
|
996
1029
|
await this.publish();
|
|
@@ -1894,6 +1927,23 @@ var BrowserDriverError = class extends Error {
|
|
|
1894
1927
|
var DEFAULT_NAVIGATION_TIMEOUT_MS = 3e4;
|
|
1895
1928
|
var DEFAULT_SETTLE_TIMEOUT_MS = 4e3;
|
|
1896
1929
|
var DEFAULT_ACTION_TIMEOUT_MS = 8e3;
|
|
1930
|
+
var PAGE_CLOSE_TIMEOUT_MS = 2e3;
|
|
1931
|
+
function clickDispatched(error2) {
|
|
1932
|
+
const message = error2 instanceof Error ? error2.message : "";
|
|
1933
|
+
if (!message.includes("\nCall log:")) return true;
|
|
1934
|
+
return message.includes("performing click action");
|
|
1935
|
+
}
|
|
1936
|
+
function clickFailure(hover, error2) {
|
|
1937
|
+
if (hover || clickDispatched(error2))
|
|
1938
|
+
return {
|
|
1939
|
+
actionable: false,
|
|
1940
|
+
reason: "action_started",
|
|
1941
|
+
retryable: false,
|
|
1942
|
+
callLog: safeCallLog(error2)
|
|
1943
|
+
};
|
|
1944
|
+
const message = error2 instanceof Error ? error2.message : "";
|
|
1945
|
+
return message.includes("not attached to the DOM") ? { actionable: false, reason: "stale" } : { actionable: false, reason: "not_actionable" };
|
|
1946
|
+
}
|
|
1897
1947
|
function actionTimeout(value) {
|
|
1898
1948
|
if (value === void 0) return DEFAULT_ACTION_TIMEOUT_MS;
|
|
1899
1949
|
if (!Number.isFinite(value) || value <= 0 || value > 2147483647)
|
|
@@ -1925,7 +1975,7 @@ function errorText(error2) {
|
|
|
1925
1975
|
return error2 instanceof Error ? error2.message : String(error2);
|
|
1926
1976
|
}
|
|
1927
1977
|
function isMissingExecutable(error2) {
|
|
1928
|
-
return /executable does not exist|executable.*doesn't exist|executable.*not found|channel .* is not installed|ENOENT/i.test(
|
|
1978
|
+
return /executable does not exist|executable.*doesn't exist|executable.*not found|channel .* is not installed|distribution '.*' is not found|ENOENT/i.test(
|
|
1929
1979
|
errorText(error2)
|
|
1930
1980
|
);
|
|
1931
1981
|
}
|
|
@@ -2016,7 +2066,7 @@ var PlaywrightPage = class {
|
|
|
2016
2066
|
}
|
|
2017
2067
|
async terminateTimedOutInput() {
|
|
2018
2068
|
this.terminalAfterInputTimeout = true;
|
|
2019
|
-
|
|
2069
|
+
await this.close().catch(() => void 0);
|
|
2020
2070
|
}
|
|
2021
2071
|
state() {
|
|
2022
2072
|
return {
|
|
@@ -2289,12 +2339,7 @@ var PlaywrightPage = class {
|
|
|
2289
2339
|
});
|
|
2290
2340
|
return { actionable: true, aim: dispatchAim };
|
|
2291
2341
|
} catch (error2) {
|
|
2292
|
-
return
|
|
2293
|
-
actionable: false,
|
|
2294
|
-
reason: "action_started",
|
|
2295
|
-
retryable: false,
|
|
2296
|
-
callLog: safeCallLog(error2)
|
|
2297
|
-
};
|
|
2342
|
+
return clickFailure(Boolean(aim.hover), error2);
|
|
2298
2343
|
} finally {
|
|
2299
2344
|
await hide();
|
|
2300
2345
|
}
|
|
@@ -2375,9 +2420,34 @@ var PlaywrightPage = class {
|
|
|
2375
2420
|
throw safeOperationError(error2, this.state(), "Scroll");
|
|
2376
2421
|
}
|
|
2377
2422
|
}
|
|
2423
|
+
/**
|
|
2424
|
+
* Chromium can accept a close while the page reloads and keep the tab open,
|
|
2425
|
+
* and Playwright then waits for it forever. Give up after a bound: closing
|
|
2426
|
+
* the page's context still disposes it, and every owner closes that next.
|
|
2427
|
+
*/
|
|
2378
2428
|
async close() {
|
|
2379
2429
|
if (this.page.isClosed()) return;
|
|
2380
|
-
|
|
2430
|
+
const closing = this.page.close();
|
|
2431
|
+
let timer;
|
|
2432
|
+
try {
|
|
2433
|
+
await Promise.race([
|
|
2434
|
+
closing,
|
|
2435
|
+
new Promise((_resolve, reject) => {
|
|
2436
|
+
timer = setTimeout(
|
|
2437
|
+
() => reject(
|
|
2438
|
+
new BrowserDriverError(
|
|
2439
|
+
"operation-failed",
|
|
2440
|
+
"The page did not close; close its context to dispose it."
|
|
2441
|
+
)
|
|
2442
|
+
),
|
|
2443
|
+
PAGE_CLOSE_TIMEOUT_MS
|
|
2444
|
+
);
|
|
2445
|
+
})
|
|
2446
|
+
]);
|
|
2447
|
+
} finally {
|
|
2448
|
+
clearTimeout(timer);
|
|
2449
|
+
closing.catch(() => void 0);
|
|
2450
|
+
}
|
|
2381
2451
|
}
|
|
2382
2452
|
};
|
|
2383
2453
|
var PlaywrightContext = class {
|
|
@@ -3083,22 +3153,15 @@ async function observeRoute(page, op, before, remaining) {
|
|
|
3083
3153
|
throw new StepExecutionError(op, "action_uncertain", "post_dispatch");
|
|
3084
3154
|
}
|
|
3085
3155
|
}
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
const observed = await quietPage(
|
|
3096
|
-
page,
|
|
3097
|
-
80,
|
|
3098
|
-
remaining(1e3, "post_dispatch")
|
|
3099
|
-
).catch(() => ({ quiet: false }));
|
|
3100
|
-
if (!observed.quiet)
|
|
3101
|
-
throw new StepExecutionError(op, "action_uncertain", "post_dispatch");
|
|
3156
|
+
try {
|
|
3157
|
+
if (after.document !== before.document)
|
|
3158
|
+
await page.settle({
|
|
3159
|
+
state: "domcontentloaded",
|
|
3160
|
+
timeoutMs: remaining(4e3, "post_dispatch")
|
|
3161
|
+
});
|
|
3162
|
+
if (after.route !== before.route)
|
|
3163
|
+
await quietPage(page, 80, remaining(1e3, "post_dispatch"));
|
|
3164
|
+
} catch {
|
|
3102
3165
|
}
|
|
3103
3166
|
return after.route !== before.route ? "route_changed" : "no_route_change";
|
|
3104
3167
|
}
|
|
@@ -9379,33 +9442,26 @@ function failureMessage(claim2, found) {
|
|
|
9379
9442
|
const frequency = found === 1 ? "once" : `${found} times`;
|
|
9380
9443
|
return `The text appears ${frequency} on the page.`;
|
|
9381
9444
|
}
|
|
9382
|
-
function
|
|
9383
|
-
const
|
|
9384
|
-
return context.record(
|
|
9385
|
-
unsupported(context.step.source.file, context.step.source, message),
|
|
9386
|
-
{ error: { code: "text_unreadable", message } }
|
|
9387
|
-
);
|
|
9445
|
+
function lastReadFailure(context, claim2, found) {
|
|
9446
|
+
const error2 = found === null ? { code: "text_unreadable", message: "The page text could not be read." } : { code: "text_check", message: failureMessage(claim2, found) };
|
|
9447
|
+
return context.record("failed", { error: error2 });
|
|
9388
9448
|
}
|
|
9389
9449
|
async function executeTextAssertion(context, claim2, limitMs) {
|
|
9390
9450
|
const deadline = performance.now() + limitMs;
|
|
9391
9451
|
const wanted = (claim2.alternatives ?? [claim2.text]).map(
|
|
9392
9452
|
(text) => revealValues(text, context.data)
|
|
9393
9453
|
);
|
|
9394
|
-
let
|
|
9454
|
+
let found = null;
|
|
9395
9455
|
for (; ; ) {
|
|
9396
9456
|
const before = await readPageVersion(context.page);
|
|
9397
9457
|
await quietPage(context.page, 80, 2e3).catch(() => void 0);
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
}
|
|
9404
|
-
if (expectationHolds(claim2, found)) return context.record("continue");
|
|
9405
|
-
message = failureMessage(claim2, found);
|
|
9406
|
-
if (!await waitForPageChange(context, before, deadline, false)) break;
|
|
9458
|
+
found = await countMatches(context, claim2, wanted).catch(() => null);
|
|
9459
|
+
if (found !== null && expectationHolds(claim2, found))
|
|
9460
|
+
return context.record("continue");
|
|
9461
|
+
const since = found === null ? null : before;
|
|
9462
|
+
if (!await waitForPageChange(context, since, deadline, false)) break;
|
|
9407
9463
|
}
|
|
9408
|
-
return context
|
|
9464
|
+
return lastReadFailure(context, claim2, found);
|
|
9409
9465
|
}
|
|
9410
9466
|
|
|
9411
9467
|
// src/flow-runner/assertions.ts
|
|
@@ -9510,6 +9566,7 @@ async function detectStep(page, detector, report, signal) {
|
|
|
9510
9566
|
|
|
9511
9567
|
// src/flow-runner/action-recovery.ts
|
|
9512
9568
|
import { setTimeout as delay2 } from "timers/promises";
|
|
9569
|
+
var DEFAULT_ACTION_BUDGET_MS = 8e3;
|
|
9513
9570
|
async function refreshAfterQuiet(page, remainingMs, signal, locate) {
|
|
9514
9571
|
const deadline = performance.now() + remainingMs;
|
|
9515
9572
|
const quiet = await quietPage(page, 80, Math.min(4e3, remainingMs)).catch(
|
|
@@ -9534,7 +9591,7 @@ async function performWithRecovery(options) {
|
|
|
9534
9591
|
var ActionAttempts = class {
|
|
9535
9592
|
constructor(options) {
|
|
9536
9593
|
this.options = options;
|
|
9537
|
-
const budget = options.timeoutMs ??
|
|
9594
|
+
const budget = options.timeoutMs ?? DEFAULT_ACTION_BUDGET_MS;
|
|
9538
9595
|
this.deadline = this.started + budget;
|
|
9539
9596
|
const timeout = AbortSignal.timeout(Math.max(1, Math.ceil(budget)));
|
|
9540
9597
|
this.signal = options.signal ? AbortSignal.any([options.signal, timeout]) : timeout;
|
|
@@ -9546,6 +9603,7 @@ var ActionAttempts = class {
|
|
|
9546
9603
|
signal;
|
|
9547
9604
|
last;
|
|
9548
9605
|
attempts = 0;
|
|
9606
|
+
staleRefusals = 0;
|
|
9549
9607
|
remaining() {
|
|
9550
9608
|
return this.signal.aborted ? 0 : Math.max(0, this.deadline - performance.now());
|
|
9551
9609
|
}
|
|
@@ -9578,9 +9636,9 @@ var ActionAttempts = class {
|
|
|
9578
9636
|
retryable(error2) {
|
|
9579
9637
|
if (!(error2 instanceof StepExecutionError)) return false;
|
|
9580
9638
|
if (!error2.retryable || !this.options.allowed()) return false;
|
|
9581
|
-
if (
|
|
9582
|
-
|
|
9583
|
-
return
|
|
9639
|
+
if (error2.code === "not_actionable") return true;
|
|
9640
|
+
if (error2.code !== "stale") return false;
|
|
9641
|
+
return this.options.op === "click" || this.staleRefusals++ === 0;
|
|
9584
9642
|
}
|
|
9585
9643
|
async perform() {
|
|
9586
9644
|
try {
|
|
@@ -9626,39 +9684,16 @@ var LocateRetryError = class extends Error {
|
|
|
9626
9684
|
}
|
|
9627
9685
|
priorCalls;
|
|
9628
9686
|
};
|
|
9629
|
-
function
|
|
9630
|
-
if (
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
async function retryStaleResolution(page, resolved, locate, enabled) {
|
|
9634
|
-
if (!shouldRetryStale2(resolved, enabled)) return resolved;
|
|
9635
|
-
const priorCalls = resolved.calls;
|
|
9636
|
-
const settled = await quietPage(page, 1e3, 4e3).catch(() => ({
|
|
9637
|
-
quiet: false
|
|
9638
|
-
}));
|
|
9639
|
-
if (!settled.quiet) return resolved;
|
|
9640
|
-
try {
|
|
9641
|
-
const retried = await locate();
|
|
9642
|
-
return { ...retried, calls: [...priorCalls, ...retried.calls] };
|
|
9643
|
-
} catch (error2) {
|
|
9644
|
-
if (isRunWideProviderError(error2)) throw error2;
|
|
9645
|
-
throw new LocateRetryError(priorCalls);
|
|
9646
|
-
}
|
|
9647
|
-
}
|
|
9648
|
-
function hasNoCandidates(result) {
|
|
9649
|
-
if (result.kind === "resolved") return false;
|
|
9650
|
-
return result.reason === "no_candidates";
|
|
9687
|
+
function recoveryFor(result, staleRetry) {
|
|
9688
|
+
if (result.kind === "resolved") return "none";
|
|
9689
|
+
if (result.reason === "no_candidates") return "empty";
|
|
9690
|
+
return staleRetry && result.reason === "stale" ? "stale" : "none";
|
|
9651
9691
|
}
|
|
9652
9692
|
function mayRetry(deadline, signal) {
|
|
9653
9693
|
if (performance.now() >= deadline) return false;
|
|
9654
9694
|
return signal?.aborted !== true;
|
|
9655
9695
|
}
|
|
9656
|
-
async function
|
|
9657
|
-
await new Promise((resolve) => setTimeout(resolve, 400));
|
|
9658
|
-
const settled = await quietPage(page, 80, 1e3).catch(() => ({
|
|
9659
|
-
quiet: false
|
|
9660
|
-
}));
|
|
9661
|
-
if (!settled.quiet) return void 0;
|
|
9696
|
+
async function tryLocate(locate) {
|
|
9662
9697
|
try {
|
|
9663
9698
|
return await locate();
|
|
9664
9699
|
} catch (error2) {
|
|
@@ -9666,30 +9701,34 @@ async function observeAfterDelay(page, locate) {
|
|
|
9666
9701
|
return void 0;
|
|
9667
9702
|
}
|
|
9668
9703
|
}
|
|
9669
|
-
async function
|
|
9670
|
-
|
|
9671
|
-
const fresh = await
|
|
9672
|
-
if (!fresh)
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9704
|
+
async function relocateAfterRender(page, locate, priorCalls) {
|
|
9705
|
+
await quietPage(page, 80, 1e3).catch(() => void 0);
|
|
9706
|
+
const fresh = await tryLocate(locate);
|
|
9707
|
+
if (!fresh) throw new LocateRetryError(priorCalls);
|
|
9708
|
+
return fresh;
|
|
9709
|
+
}
|
|
9710
|
+
async function relocateWhenFilled(page, locate) {
|
|
9711
|
+
await new Promise((resolve) => setTimeout(resolve, 400));
|
|
9712
|
+
const settled = await quietPage(page, 80, 1e3).catch(() => ({
|
|
9713
|
+
quiet: false
|
|
9714
|
+
}));
|
|
9715
|
+
return settled.quiet ? tryLocate(locate) : void 0;
|
|
9716
|
+
}
|
|
9717
|
+
async function readAgain(page, recovery, locate, current) {
|
|
9718
|
+
const fresh = recovery === "stale" ? await relocateAfterRender(page, locate, current.calls) : await relocateWhenFilled(page, locate);
|
|
9719
|
+
return fresh ? { ...fresh, calls: [...current.calls, ...fresh.calls] } : current;
|
|
9684
9720
|
}
|
|
9685
9721
|
async function reobserveLocator(page, first, locate, options) {
|
|
9686
|
-
const
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
options.staleRetry
|
|
9691
|
-
|
|
9692
|
-
|
|
9722
|
+
const deadline = performance.now() + 8e3;
|
|
9723
|
+
let staleReads = 0;
|
|
9724
|
+
let current = first;
|
|
9725
|
+
for (; ; ) {
|
|
9726
|
+
const recovery = recoveryFor(current, options.staleRetry && staleReads < 4);
|
|
9727
|
+
if (recovery === "none" || !mayRetry(deadline, options.signal))
|
|
9728
|
+
return current;
|
|
9729
|
+
staleReads += Number(recovery === "stale");
|
|
9730
|
+
current = await readAgain(page, recovery, locate, current);
|
|
9731
|
+
}
|
|
9693
9732
|
}
|
|
9694
9733
|
function unresolvedReason(reason, op) {
|
|
9695
9734
|
if (reason === "none")
|
|
@@ -9698,6 +9737,10 @@ function unresolvedReason(reason, op) {
|
|
|
9698
9737
|
const action = op === "type" ? "type into" : op;
|
|
9699
9738
|
return `the page had nothing to ${action}`;
|
|
9700
9739
|
}
|
|
9740
|
+
if (reason === "stale")
|
|
9741
|
+
return "the page kept replacing it while it was located; wait for the page to settle first";
|
|
9742
|
+
if (reason === "provider_error")
|
|
9743
|
+
return "the model call that picks the target failed; run the test again";
|
|
9701
9744
|
return "several elements match it; name the one you mean more precisely";
|
|
9702
9745
|
}
|
|
9703
9746
|
function visionFailure(vision) {
|
|
@@ -9707,7 +9750,8 @@ function visionFallbackNote(resolved) {
|
|
|
9707
9750
|
const vision = resolved.diagnostic.vision;
|
|
9708
9751
|
if (vision?.outcome === "abstained")
|
|
9709
9752
|
return "the vision model did not find it either";
|
|
9710
|
-
if (vision || resolved.reason
|
|
9753
|
+
if (vision || ["no_candidates", "stale"].includes(resolved.reason))
|
|
9754
|
+
return void 0;
|
|
9711
9755
|
return "vision fallback could not run (it needs 2 to 40 fully visible, unobscured controls on screen)";
|
|
9712
9756
|
}
|
|
9713
9757
|
function unresolvedLocatorWhy(resolved, op, visionEnabled) {
|
|
@@ -9751,6 +9795,20 @@ function chooseOption(sentence, labels) {
|
|
|
9751
9795
|
}
|
|
9752
9796
|
|
|
9753
9797
|
// src/flow-runner/sentence-execution.ts
|
|
9798
|
+
var FAILED_LOCATOR_REASONS = [
|
|
9799
|
+
"none",
|
|
9800
|
+
"ambiguous",
|
|
9801
|
+
"no_candidates",
|
|
9802
|
+
"stale",
|
|
9803
|
+
// Run-wide provider failures are thrown before this; what reaches here is
|
|
9804
|
+
// one failed model call, which a retry can get past.
|
|
9805
|
+
"provider_error"
|
|
9806
|
+
];
|
|
9807
|
+
var FAILED_ACTION_CODES = [
|
|
9808
|
+
"not_actionable",
|
|
9809
|
+
"stale",
|
|
9810
|
+
"invalid_input"
|
|
9811
|
+
];
|
|
9754
9812
|
async function executeSentence(page, step, dependencies, data, opaqueEntries, presentation = {}) {
|
|
9755
9813
|
const started = performance.now();
|
|
9756
9814
|
const report = dependencies.report;
|
|
@@ -9899,24 +9957,18 @@ async function executeSentence(page, step, dependencies, data, opaqueEntries, pr
|
|
|
9899
9957
|
});
|
|
9900
9958
|
return error2;
|
|
9901
9959
|
};
|
|
9902
|
-
const
|
|
9960
|
+
const settleMs = Math.max(4e3, dependencies.verifyGraceMs ?? 0);
|
|
9961
|
+
const quiet = await quietPage(page, 80, settleMs).catch(() => ({
|
|
9903
9962
|
quiet: false
|
|
9904
9963
|
}));
|
|
9905
9964
|
const waits = step.op === "verify" && waitUntilTimeoutMs(step.text) !== null;
|
|
9906
9965
|
if (!quiet.quiet && !waits)
|
|
9907
|
-
return record(
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
step.
|
|
9911
|
-
"The page did not settle before this step could be resolved."
|
|
9912
|
-
),
|
|
9913
|
-
{
|
|
9914
|
-
error: {
|
|
9915
|
-
code: "observation_timeout",
|
|
9916
|
-
message: "The page did not settle before this step could be resolved."
|
|
9917
|
-
}
|
|
9966
|
+
return record("failed", {
|
|
9967
|
+
error: {
|
|
9968
|
+
code: "observation_timeout",
|
|
9969
|
+
message: "The page did not settle before this step could be resolved."
|
|
9918
9970
|
}
|
|
9919
|
-
);
|
|
9971
|
+
});
|
|
9920
9972
|
let typeValue;
|
|
9921
9973
|
if (step.op === "type") {
|
|
9922
9974
|
const operand = validateTypeOperand(step);
|
|
@@ -10287,7 +10339,7 @@ async function executeSentence(page, step, dependencies, data, opaqueEntries, pr
|
|
|
10287
10339
|
}
|
|
10288
10340
|
);
|
|
10289
10341
|
if (resolved.kind !== "resolved") {
|
|
10290
|
-
if (
|
|
10342
|
+
if (FAILED_LOCATOR_REASONS.includes(resolved.reason))
|
|
10291
10343
|
return record("failed", {
|
|
10292
10344
|
locator: resolved,
|
|
10293
10345
|
error: {
|
|
@@ -10349,6 +10401,9 @@ async function executeSentence(page, step, dependencies, data, opaqueEntries, pr
|
|
|
10349
10401
|
let observation = 1;
|
|
10350
10402
|
await performWithRecovery({
|
|
10351
10403
|
op: step.op,
|
|
10404
|
+
// A target can stay disabled while the app works; wait as long as the
|
|
10405
|
+
// step's grace allows, never less than the default action budget.
|
|
10406
|
+
timeoutMs: Math.max(DEFAULT_ACTION_BUDGET_MS, actionGraceMs),
|
|
10352
10407
|
...dependencies.signal ? { signal: dependencies.signal } : {},
|
|
10353
10408
|
perform: performAction,
|
|
10354
10409
|
allowed: () => !visionAttempted,
|
|
@@ -10427,7 +10482,7 @@ async function executeSentence(page, step, dependencies, data, opaqueEntries, pr
|
|
|
10427
10482
|
} catch (error2) {
|
|
10428
10483
|
if (isRunWideProviderError(error2)) throw await runWide(error2);
|
|
10429
10484
|
const actionError2 = error2 instanceof StepExecutionError ? error2 : null;
|
|
10430
|
-
const failed = actionError2 && (actionError2.code
|
|
10485
|
+
const failed = actionError2 && FAILED_ACTION_CODES.includes(actionError2.code);
|
|
10431
10486
|
const facts = {
|
|
10432
10487
|
locator: resolved,
|
|
10433
10488
|
replayFrame,
|
|
@@ -17499,6 +17554,7 @@ export {
|
|
|
17499
17554
|
goalOperations,
|
|
17500
17555
|
inlineValues,
|
|
17501
17556
|
installChromium,
|
|
17557
|
+
isBlocking,
|
|
17502
17558
|
isClaimSentence,
|
|
17503
17559
|
isFlowScalar,
|
|
17504
17560
|
isFullyValidated,
|
|
@@ -17521,6 +17577,7 @@ export {
|
|
|
17521
17577
|
measure,
|
|
17522
17578
|
navigationWhy,
|
|
17523
17579
|
nextConcurrency,
|
|
17580
|
+
nonBlockingFailure,
|
|
17524
17581
|
normalizeSignal,
|
|
17525
17582
|
opaqueMatches,
|
|
17526
17583
|
pageDigest,
|
|
@@ -198,6 +198,11 @@
|
|
|
198
198
|
"minimum": 0,
|
|
199
199
|
"maximum": 9007199254740991
|
|
200
200
|
},
|
|
201
|
+
"nonBlockingFailedTests": {
|
|
202
|
+
"type": "integer",
|
|
203
|
+
"minimum": 0,
|
|
204
|
+
"maximum": 9007199254740991
|
|
205
|
+
},
|
|
201
206
|
"passedSteps": {
|
|
202
207
|
"type": "integer",
|
|
203
208
|
"minimum": 0,
|
|
@@ -442,6 +447,10 @@
|
|
|
442
447
|
"maxLength": 120
|
|
443
448
|
}
|
|
444
449
|
},
|
|
450
|
+
"blocking": {
|
|
451
|
+
"type": "boolean",
|
|
452
|
+
"const": false
|
|
453
|
+
},
|
|
445
454
|
"state": {
|
|
446
455
|
"type": "string",
|
|
447
456
|
"enum": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sedum-dev/core",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.21",
|
|
4
4
|
"repository": "https://github.com/sedum-dev/sedum",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"playwright-core": "1.63.0",
|
|
33
33
|
"sharp": "0.35.5",
|
|
34
34
|
"yaml": "2.9.1",
|
|
35
|
-
"zod": "4.6.
|
|
35
|
+
"zod": "4.6.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@hegeldev/hegel": "0.4.7"
|