@sudobility/testomniac_runner_service 0.1.26 → 0.1.29
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/analyzer/index.d.ts +2 -0
- package/dist/analyzer/index.d.ts.map +1 -0
- package/dist/analyzer/index.js +2 -0
- package/dist/analyzer/index.js.map +1 -0
- package/dist/analyzer/page-analyzer.d.ts +47 -0
- package/dist/analyzer/page-analyzer.d.ts.map +1 -0
- package/dist/analyzer/page-analyzer.js +232 -0
- package/dist/analyzer/page-analyzer.js.map +1 -0
- package/dist/api/client.d.ts +17 -4
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +75 -10
- package/dist/api/client.js.map +1 -1
- package/dist/browser/page-utils.d.ts +2 -2
- package/dist/browser/page-utils.d.ts.map +1 -1
- package/dist/browser/page-utils.js +5 -5
- package/dist/browser/page-utils.js.map +1 -1
- package/dist/expertise/index.d.ts +9 -0
- package/dist/expertise/index.d.ts.map +1 -0
- package/dist/expertise/index.js +22 -0
- package/dist/expertise/index.js.map +1 -0
- package/dist/expertise/noop-expertise.d.ts +11 -0
- package/dist/expertise/noop-expertise.d.ts.map +1 -0
- package/dist/expertise/noop-expertise.js +14 -0
- package/dist/expertise/noop-expertise.js.map +1 -0
- package/dist/expertise/performance-expertise.d.ts +10 -0
- package/dist/expertise/performance-expertise.d.ts.map +1 -0
- package/dist/expertise/performance-expertise.js +41 -0
- package/dist/expertise/performance-expertise.js.map +1 -0
- package/dist/expertise/security-expertise.d.ts +12 -0
- package/dist/expertise/security-expertise.d.ts.map +1 -0
- package/dist/expertise/security-expertise.js +61 -0
- package/dist/expertise/security-expertise.js.map +1 -0
- package/dist/expertise/seo-expertise.d.ts +14 -0
- package/dist/expertise/seo-expertise.d.ts.map +1 -0
- package/dist/expertise/seo-expertise.js +84 -0
- package/dist/expertise/seo-expertise.js.map +1 -0
- package/dist/expertise/tester-expertise.d.ts +14 -0
- package/dist/expertise/tester-expertise.d.ts.map +1 -0
- package/dist/expertise/tester-expertise.js +87 -0
- package/dist/expertise/tester-expertise.js.map +1 -0
- package/dist/expertise/types.d.ts +21 -0
- package/dist/expertise/types.d.ts.map +1 -0
- package/dist/expertise/types.js +1 -0
- package/dist/expertise/types.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/orchestrator/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator/orchestrator.js +4 -4
- package/dist/orchestrator/orchestrator.js.map +1 -1
- package/dist/orchestrator/runner.d.ts +12 -0
- package/dist/orchestrator/runner.d.ts.map +1 -0
- package/dist/orchestrator/runner.js +163 -0
- package/dist/orchestrator/runner.js.map +1 -0
- package/dist/orchestrator/test-case-executor.d.ts +15 -0
- package/dist/orchestrator/test-case-executor.d.ts.map +1 -0
- package/dist/orchestrator/test-case-executor.js +259 -0
- package/dist/orchestrator/test-case-executor.js.map +1 -0
- package/dist/orchestrator/types.d.ts +18 -6
- package/dist/orchestrator/types.d.ts.map +1 -1
- package/dist/scanner/component-detector.d.ts +2 -2
- package/dist/scanner/component-detector.js +1 -1
- package/dist/scanner/html-decomposer.d.ts +5 -5
- package/dist/scanner/html-decomposer.d.ts.map +1 -1
- package/dist/scanner/html-decomposer.js +7 -7
- package/dist/scanner/html-decomposer.js.map +1 -1
- package/dist/scanner/scaffold-cache.d.ts +13 -0
- package/dist/scanner/scaffold-cache.d.ts.map +1 -0
- package/dist/scanner/{reusable-element-cache.js → scaffold-cache.js} +4 -4
- package/dist/scanner/scaffold-cache.js.map +1 -0
- package/package.json +3 -3
- package/dist/scanner/reusable-element-cache.d.ts +0 -13
- package/dist/scanner/reusable-element-cache.d.ts.map +0 -1
- package/dist/scanner/reusable-element-cache.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BrowserAdapter } from "../adapter";
|
|
2
|
+
import type { ApiClient } from "../api/client";
|
|
3
|
+
import type { RunConfig, ScanEventHandler, ScanResult } from "./types";
|
|
4
|
+
import type { Expertise } from "../expertise/types";
|
|
5
|
+
/**
|
|
6
|
+
* Main entry point for the new runner execution loop.
|
|
7
|
+
* Replaces the old runScan/processDecompositionJob/executeTestCases orchestrator.
|
|
8
|
+
*
|
|
9
|
+
* Execution: bundle → iterate suites → iterate cases → run case
|
|
10
|
+
*/
|
|
11
|
+
export declare function runTestRun(adapter: BrowserAdapter, config: RunConfig, api: ApiClient, expertises: Expertise[], events: ScanEventHandler): Promise<ScanResult>;
|
|
12
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/orchestrator/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,SAAS,EACd,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,UAAU,CAAC,CAkMrB"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { PageAnalyzer } from "../analyzer";
|
|
2
|
+
import { executeTestCase } from "./test-case-executor";
|
|
3
|
+
/**
|
|
4
|
+
* Main entry point for the new runner execution loop.
|
|
5
|
+
* Replaces the old runScan/processDecompositionJob/executeTestCases orchestrator.
|
|
6
|
+
*
|
|
7
|
+
* Execution: bundle → iterate suites → iterate cases → run case
|
|
8
|
+
*/
|
|
9
|
+
export async function runTestRun(adapter, config, api, expertises, events) {
|
|
10
|
+
const startTime = Date.now();
|
|
11
|
+
let pagesFound = 0;
|
|
12
|
+
let pageStatesFound = 0;
|
|
13
|
+
let testRunsCompleted = 0;
|
|
14
|
+
let findingsFound = 0;
|
|
15
|
+
// Wrap event handler to track stats
|
|
16
|
+
const wrappedEvents = {
|
|
17
|
+
...events,
|
|
18
|
+
onPageFound(page) {
|
|
19
|
+
pagesFound++;
|
|
20
|
+
events.onPageFound(page);
|
|
21
|
+
emitStats();
|
|
22
|
+
},
|
|
23
|
+
onPageStateCreated(state) {
|
|
24
|
+
pageStatesFound++;
|
|
25
|
+
events.onPageStateCreated(state);
|
|
26
|
+
emitStats();
|
|
27
|
+
},
|
|
28
|
+
onTestCaseRunCompleted(run) {
|
|
29
|
+
testRunsCompleted++;
|
|
30
|
+
events.onTestCaseRunCompleted(run);
|
|
31
|
+
emitStats();
|
|
32
|
+
},
|
|
33
|
+
onTestRunCompleted(run) {
|
|
34
|
+
events.onTestRunCompleted(run);
|
|
35
|
+
},
|
|
36
|
+
onFindingCreated(finding) {
|
|
37
|
+
findingsFound++;
|
|
38
|
+
events.onFindingCreated(finding);
|
|
39
|
+
emitStats();
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
function emitStats() {
|
|
43
|
+
events.onStatsUpdated({
|
|
44
|
+
pagesFound,
|
|
45
|
+
pageStatesFound,
|
|
46
|
+
testRunsCompleted,
|
|
47
|
+
findingsFound,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
// Claim the test run
|
|
52
|
+
const claimed = await api.claimTestRun(config.testRunId, config.runnerInstanceId, config.runnerInstanceName);
|
|
53
|
+
if (!claimed) {
|
|
54
|
+
throw new Error(`Test run ${config.testRunId} already claimed by another runner`);
|
|
55
|
+
}
|
|
56
|
+
// Get the test run to find the bundle run
|
|
57
|
+
const testRun = await api.getTestRun(config.testRunId);
|
|
58
|
+
if (!testRun) {
|
|
59
|
+
throw new Error(`Test run ${config.testRunId} not found`);
|
|
60
|
+
}
|
|
61
|
+
if (!testRun.testSuiteBundleRunId) {
|
|
62
|
+
throw new Error(`Test run ${config.testRunId} has no test suite bundle run`);
|
|
63
|
+
}
|
|
64
|
+
// Set up analyzer for discovery mode
|
|
65
|
+
const analyzer = testRun.discovery ? new PageAnalyzer() : null;
|
|
66
|
+
// Get navigation suite for discovery context
|
|
67
|
+
let navigationSuite = null;
|
|
68
|
+
if (testRun.discovery) {
|
|
69
|
+
const suites = await api.getTestSuitesByRunner(config.runnerId);
|
|
70
|
+
navigationSuite =
|
|
71
|
+
suites.find(s => s.title === "Navigation" &&
|
|
72
|
+
(config.uid ? s.uid === config.uid : s.uid == null)) ?? null;
|
|
73
|
+
}
|
|
74
|
+
// Execution loop: iterate open suite runs in the bundle
|
|
75
|
+
let hasOpenSuites = true;
|
|
76
|
+
while (hasOpenSuites) {
|
|
77
|
+
if (config.signal?.aborted)
|
|
78
|
+
break;
|
|
79
|
+
const openSuiteRuns = await api.getOpenTestSuiteRuns(testRun.testSuiteBundleRunId);
|
|
80
|
+
if (openSuiteRuns.length === 0) {
|
|
81
|
+
hasOpenSuites = false;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
const currentSuiteRun = openSuiteRuns[0];
|
|
85
|
+
// Iterate open case runs in this suite
|
|
86
|
+
let hasOpenCases = true;
|
|
87
|
+
while (hasOpenCases) {
|
|
88
|
+
if (config.signal?.aborted)
|
|
89
|
+
break;
|
|
90
|
+
const openCaseRuns = await api.getOpenTestCaseRuns(currentSuiteRun.id);
|
|
91
|
+
if (openCaseRuns.length === 0) {
|
|
92
|
+
hasOpenCases = false;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
const currentCaseRun = openCaseRuns[0];
|
|
96
|
+
// Execute the test case
|
|
97
|
+
await executeTestCase(adapter, currentCaseRun, testRun, expertises, analyzer, api, wrappedEvents, navigationSuite && testRun.testSuiteBundleRunId
|
|
98
|
+
? {
|
|
99
|
+
navigationSuite,
|
|
100
|
+
bundleRun: {
|
|
101
|
+
id: testRun.testSuiteBundleRunId,
|
|
102
|
+
testSuiteBundleId: 0, // will be resolved by API
|
|
103
|
+
status: "running",
|
|
104
|
+
startedAt: null,
|
|
105
|
+
completedAt: null,
|
|
106
|
+
createdAt: null,
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
: undefined);
|
|
110
|
+
}
|
|
111
|
+
// All cases done in this suite — mark suite run completed
|
|
112
|
+
await api.completeTestSuiteRun(currentSuiteRun.id, {
|
|
113
|
+
status: "completed",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// All suites done — mark bundle run and test run completed
|
|
117
|
+
await api.completeTestSuiteBundleRun(testRun.testSuiteBundleRunId, {
|
|
118
|
+
status: "completed",
|
|
119
|
+
});
|
|
120
|
+
const durationMs = Date.now() - startTime;
|
|
121
|
+
await api.completeTestRun(config.testRunId, {
|
|
122
|
+
status: "completed",
|
|
123
|
+
totalDurationMs: durationMs,
|
|
124
|
+
pagesFound,
|
|
125
|
+
pageStatesFound,
|
|
126
|
+
testRunsCompleted,
|
|
127
|
+
});
|
|
128
|
+
const result = {
|
|
129
|
+
testRunId: config.testRunId,
|
|
130
|
+
pagesFound,
|
|
131
|
+
pageStatesFound,
|
|
132
|
+
testRunsCompleted,
|
|
133
|
+
findingsFound,
|
|
134
|
+
durationMs,
|
|
135
|
+
};
|
|
136
|
+
wrappedEvents.onScanComplete({
|
|
137
|
+
totalPages: pagesFound,
|
|
138
|
+
totalFindings: findingsFound,
|
|
139
|
+
durationMs,
|
|
140
|
+
});
|
|
141
|
+
wrappedEvents.onTestRunCompleted({
|
|
142
|
+
testRunId: config.testRunId,
|
|
143
|
+
passed: findingsFound === 0,
|
|
144
|
+
});
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
149
|
+
wrappedEvents.onError({ message });
|
|
150
|
+
// Try to mark the run as failed
|
|
151
|
+
try {
|
|
152
|
+
await api.completeTestRun(config.testRunId, {
|
|
153
|
+
status: "failed",
|
|
154
|
+
totalDurationMs: Date.now() - startTime,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// best effort
|
|
159
|
+
}
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/orchestrator/runner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAuB,EACvB,MAAiB,EACjB,GAAc,EACd,UAAuB,EACvB,MAAwB;IAExB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,eAAe,GAAG,CAAC,CAAC;IACxB,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAC1B,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,oCAAoC;IACpC,MAAM,aAAa,GAAqB;QACtC,GAAG,MAAM;QACT,WAAW,CAAC,IAAI;YACd,UAAU,EAAE,CAAC;YACb,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACzB,SAAS,EAAE,CAAC;QACd,CAAC;QACD,kBAAkB,CAAC,KAAK;YACtB,eAAe,EAAE,CAAC;YAClB,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACjC,SAAS,EAAE,CAAC;QACd,CAAC;QACD,sBAAsB,CAAC,GAAG;YACxB,iBAAiB,EAAE,CAAC;YACpB,MAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;YACnC,SAAS,EA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AAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACzE,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAEnC,gCAAgC;QAChC,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,EAAE;gBAC1C,MAAM,EAAE,QAAQ;gBAChB,eAAe,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;aACxC,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,cAAc;QAChB,CAAC;QAED,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BrowserAdapter } from "../adapter";
|
|
2
|
+
import type { ApiClient } from "../api/client";
|
|
3
|
+
import type { TestCaseRunResponse, TestRunResponse, TestSuiteResponse, TestSuiteBundleRunResponse } from "@sudobility/testomniac_types";
|
|
4
|
+
import type { ScanEventHandler } from "./types";
|
|
5
|
+
import type { Expertise } from "../expertise/types";
|
|
6
|
+
import type { PageAnalyzer } from "../analyzer";
|
|
7
|
+
/**
|
|
8
|
+
* Execute a single test case: run actions, decompose page, evaluate expertises,
|
|
9
|
+
* set outcomes, create findings, and optionally discover new test cases.
|
|
10
|
+
*/
|
|
11
|
+
export declare function executeTestCase(adapter: BrowserAdapter, testCaseRun: TestCaseRunResponse, testRun: TestRunResponse, expertises: Expertise[], analyzer: PageAnalyzer | null, api: ApiClient, events: ScanEventHandler, discoveryContext?: {
|
|
12
|
+
navigationSuite: TestSuiteResponse;
|
|
13
|
+
bundleRun: TestSuiteBundleRunResponse;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=test-case-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-case-executor.d.ts","sourceRoot":"","sources":["../../src/orchestrator/test-case-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAA6B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AAMjE;;;GAGG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,mBAAmB,EAChC,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,SAAS,EAAE,EACvB,QAAQ,EAAE,YAAY,GAAG,IAAI,EAC7B,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,gBAAgB,EACxB,gBAAgB,CAAC,EAAE;IACjB,eAAe,EAAE,iBAAiB,CAAC;IACnC,SAAS,EAAE,0BAA0B,CAAC;CACvC,GACA,OAAO,CAAC,IAAI,CAAC,CAiQf"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { extractActionableItems } from "../extractors";
|
|
2
|
+
import { computeHashes } from "../browser/page-utils";
|
|
3
|
+
import { detectScaffoldRegions } from "../scanner/component-detector";
|
|
4
|
+
import { detectPatternsWithInstances } from "../scanner/pattern-detector";
|
|
5
|
+
/**
|
|
6
|
+
* Execute a single test case: run actions, decompose page, evaluate expertises,
|
|
7
|
+
* set outcomes, create findings, and optionally discover new test cases.
|
|
8
|
+
*/
|
|
9
|
+
export async function executeTestCase(adapter, testCaseRun, testRun, expertises, analyzer, api, events, discoveryContext) {
|
|
10
|
+
const startTime = Date.now();
|
|
11
|
+
const consoleLogs = [];
|
|
12
|
+
const networkLogs = [];
|
|
13
|
+
// Listen for console and network events
|
|
14
|
+
adapter.on("console", (...args) => {
|
|
15
|
+
consoleLogs.push(String(args[0] ?? ""));
|
|
16
|
+
});
|
|
17
|
+
adapter.on("response", (...args) => {
|
|
18
|
+
const entry = args[0];
|
|
19
|
+
if (entry && typeof entry.url === "string") {
|
|
20
|
+
networkLogs.push({
|
|
21
|
+
method: "GET",
|
|
22
|
+
url: entry.url,
|
|
23
|
+
status: entry.status,
|
|
24
|
+
contentType: entry.contentType ?? "",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
try {
|
|
29
|
+
const tc = await api.getTestCasesByRunner(testRun.runnerId);
|
|
30
|
+
const testCase = tc.find(c => c.id === testCaseRun.testCaseId);
|
|
31
|
+
if (!testCase) {
|
|
32
|
+
throw new Error(`Test case ${testCaseRun.testCaseId} not found`);
|
|
33
|
+
}
|
|
34
|
+
// Parse steps from JSON
|
|
35
|
+
const steps = testCase.stepsJson ?? [];
|
|
36
|
+
// Record beginning page state
|
|
37
|
+
const _beginningUrl = await adapter.getUrl();
|
|
38
|
+
const beginningPageStateId = testCase.startingPageStateId ?? 0;
|
|
39
|
+
// Navigate to starting path if needed
|
|
40
|
+
if (testCase.startingPath) {
|
|
41
|
+
const baseUrl = testRun.scanUrl
|
|
42
|
+
? new URL(testRun.scanUrl).origin
|
|
43
|
+
: "http://localhost";
|
|
44
|
+
const absoluteUrl = testCase.startingPath.startsWith("http")
|
|
45
|
+
? testCase.startingPath
|
|
46
|
+
: new URL(testCase.startingPath, baseUrl).toString();
|
|
47
|
+
await adapter.goto(absoluteUrl, { waitUntil: "networkidle0" });
|
|
48
|
+
}
|
|
49
|
+
// Execute test actions
|
|
50
|
+
for (const step of steps) {
|
|
51
|
+
await executeAction(adapter, step.action, testRun);
|
|
52
|
+
}
|
|
53
|
+
// Decompose the page using local detectors
|
|
54
|
+
const html = await adapter.content();
|
|
55
|
+
const scaffolds = await detectScaffoldRegions(adapter);
|
|
56
|
+
const patterns = await detectPatternsWithInstances(adapter);
|
|
57
|
+
const items = await extractActionableItems(adapter);
|
|
58
|
+
// Parse global expectations
|
|
59
|
+
const globalExpectations = testCase.globalExpectationsJson ?? [];
|
|
60
|
+
// If discovery mode: generate baseline expectations
|
|
61
|
+
let expectations = [...globalExpectations];
|
|
62
|
+
if (analyzer && testCase.stepsJson) {
|
|
63
|
+
const parsedTestCase = {
|
|
64
|
+
title: testCase.title,
|
|
65
|
+
type: testCase.testType,
|
|
66
|
+
sizeClass: testCase.sizeClass,
|
|
67
|
+
suite_tags: testCase.suiteTags,
|
|
68
|
+
priority: testCase.priority,
|
|
69
|
+
startingPageStateId: testCase.startingPageStateId ?? 0,
|
|
70
|
+
startingPath: testCase.startingPath ?? "",
|
|
71
|
+
steps: steps,
|
|
72
|
+
globalExpectations: globalExpectations,
|
|
73
|
+
};
|
|
74
|
+
const generated = analyzer.generateExpectations(parsedTestCase);
|
|
75
|
+
expectations = [...expectations, ...generated];
|
|
76
|
+
}
|
|
77
|
+
// Build expertise context
|
|
78
|
+
const expertiseContext = {
|
|
79
|
+
html,
|
|
80
|
+
scaffolds,
|
|
81
|
+
patterns,
|
|
82
|
+
consoleLogs,
|
|
83
|
+
networkLogs,
|
|
84
|
+
expectations: expectations,
|
|
85
|
+
};
|
|
86
|
+
// Evaluate all expertises
|
|
87
|
+
const allOutcomes = [];
|
|
88
|
+
for (const expertise of expertises) {
|
|
89
|
+
const outcomes = expertise.evaluate(expertiseContext);
|
|
90
|
+
allOutcomes.push(...outcomes);
|
|
91
|
+
// Create findings for warnings and errors
|
|
92
|
+
for (const outcome of outcomes) {
|
|
93
|
+
if (outcome.result === "warning" || outcome.result === "error") {
|
|
94
|
+
await api.createTestRunFinding({
|
|
95
|
+
testCaseRunId: testCaseRun.id,
|
|
96
|
+
type: outcome.result === "error" ? "error" : "warning",
|
|
97
|
+
title: `[${expertise.name}] ${outcome.expected}`,
|
|
98
|
+
description: outcome.observed,
|
|
99
|
+
});
|
|
100
|
+
events.onFindingCreated({
|
|
101
|
+
type: outcome.result,
|
|
102
|
+
title: `[${expertise.name}] ${outcome.expected}`,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Aggregate outcomes
|
|
108
|
+
const expectedOutcome = allOutcomes.map(o => o.expected).join("\n");
|
|
109
|
+
const observedOutcome = allOutcomes
|
|
110
|
+
.map(o => `[${o.result}] ${o.observed}`)
|
|
111
|
+
.join("\n");
|
|
112
|
+
const hasErrors = allOutcomes.some(o => o.result === "error");
|
|
113
|
+
const hasWarnings = allOutcomes.some(o => o.result === "warning");
|
|
114
|
+
const status = hasErrors
|
|
115
|
+
? "failed"
|
|
116
|
+
: hasWarnings
|
|
117
|
+
? "completed"
|
|
118
|
+
: "completed";
|
|
119
|
+
// Complete test case run
|
|
120
|
+
const durationMs = Date.now() - startTime;
|
|
121
|
+
await api.completeTestCaseRun(testCaseRun.id, {
|
|
122
|
+
status,
|
|
123
|
+
durationMs,
|
|
124
|
+
expectedOutcome: expectedOutcome || undefined,
|
|
125
|
+
observedOutcome: observedOutcome || undefined,
|
|
126
|
+
// Attach logs if there were issues
|
|
127
|
+
...(hasErrors || hasWarnings
|
|
128
|
+
? {
|
|
129
|
+
consoleLog: consoleLogs.join("\n") || undefined,
|
|
130
|
+
networkLog: JSON.stringify(networkLogs) || undefined,
|
|
131
|
+
}
|
|
132
|
+
: {}),
|
|
133
|
+
});
|
|
134
|
+
events.onTestCaseRunCompleted({
|
|
135
|
+
testCaseRunId: testCaseRun.id,
|
|
136
|
+
passed: !hasErrors,
|
|
137
|
+
});
|
|
138
|
+
// If discovery mode: generate new test cases
|
|
139
|
+
if (analyzer && discoveryContext) {
|
|
140
|
+
const currentUrl = await adapter.getUrl();
|
|
141
|
+
const currentPath = new URL(currentUrl).pathname;
|
|
142
|
+
const currentHashes = await computeHashes(html, items);
|
|
143
|
+
const currentPageState = await api.findMatchingPageState(0, // pageId not needed for state comparison
|
|
144
|
+
currentHashes, testRun.sizeClass);
|
|
145
|
+
const page = await api.findOrCreatePage(testRun.runnerId, currentPath);
|
|
146
|
+
const analyzerCtx = {
|
|
147
|
+
runnerId: testRun.runnerId,
|
|
148
|
+
sizeClass: testRun.sizeClass,
|
|
149
|
+
uid: testRun.createdByUserId ?? undefined,
|
|
150
|
+
currentPageStateId: currentPageState?.id ?? 0,
|
|
151
|
+
beginningPageStateId: beginningPageStateId,
|
|
152
|
+
currentPath,
|
|
153
|
+
pageId: page.id,
|
|
154
|
+
pageRequiresLogin: page.requiresLogin ?? false,
|
|
155
|
+
scaffolds,
|
|
156
|
+
actionableItems: items,
|
|
157
|
+
navigationSuite: discoveryContext.navigationSuite,
|
|
158
|
+
bundleRun: discoveryContext.bundleRun,
|
|
159
|
+
api,
|
|
160
|
+
};
|
|
161
|
+
const parsedTestCase = {
|
|
162
|
+
title: testCase.title,
|
|
163
|
+
type: testCase.testType,
|
|
164
|
+
sizeClass: testCase.sizeClass,
|
|
165
|
+
suite_tags: testCase.suiteTags,
|
|
166
|
+
priority: testCase.priority,
|
|
167
|
+
startingPageStateId: testCase.startingPageStateId ?? 0,
|
|
168
|
+
startingPath: testCase.startingPath ?? "",
|
|
169
|
+
steps: steps,
|
|
170
|
+
globalExpectations: globalExpectations,
|
|
171
|
+
};
|
|
172
|
+
await analyzer.generateTestCases(parsedTestCase, analyzerCtx);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
const durationMs = Date.now() - startTime;
|
|
177
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
178
|
+
await api.completeTestCaseRun(testCaseRun.id, {
|
|
179
|
+
status: "failed",
|
|
180
|
+
durationMs,
|
|
181
|
+
errorMessage,
|
|
182
|
+
consoleLog: consoleLogs.join("\n") || undefined,
|
|
183
|
+
networkLog: JSON.stringify(networkLogs) || undefined,
|
|
184
|
+
});
|
|
185
|
+
await api.createTestRunFinding({
|
|
186
|
+
testCaseRunId: testCaseRun.id,
|
|
187
|
+
type: "error",
|
|
188
|
+
title: `Test execution error`,
|
|
189
|
+
description: errorMessage,
|
|
190
|
+
});
|
|
191
|
+
events.onFindingCreated({ type: "error", title: "Test execution error" });
|
|
192
|
+
events.onTestCaseRunCompleted({
|
|
193
|
+
testCaseRunId: testCaseRun.id,
|
|
194
|
+
passed: false,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function executeAction(adapter, action, testRun) {
|
|
199
|
+
const baseUrl = testRun.scanUrl
|
|
200
|
+
? new URL(testRun.scanUrl).origin
|
|
201
|
+
: "http://localhost";
|
|
202
|
+
switch (action.actionType) {
|
|
203
|
+
case "goto": {
|
|
204
|
+
const path = action.path ?? "/";
|
|
205
|
+
const url = path.startsWith("http")
|
|
206
|
+
? path
|
|
207
|
+
: new URL(path, baseUrl).toString();
|
|
208
|
+
await adapter.goto(url, { waitUntil: "networkidle0" });
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
case "waitForLoadState":
|
|
212
|
+
try {
|
|
213
|
+
await adapter.waitForNavigation({
|
|
214
|
+
waitUntil: "networkidle0",
|
|
215
|
+
timeout: 5000,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
// No navigation pending is fine
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
case "click":
|
|
223
|
+
if (action.path)
|
|
224
|
+
await adapter.click(action.path);
|
|
225
|
+
break;
|
|
226
|
+
case "dblclick":
|
|
227
|
+
if (action.path)
|
|
228
|
+
await adapter.click(action.path); // adapter may not support dblclick
|
|
229
|
+
break;
|
|
230
|
+
case "fill":
|
|
231
|
+
if (action.path && action.value != null)
|
|
232
|
+
await adapter.type(action.path, action.value);
|
|
233
|
+
break;
|
|
234
|
+
case "select":
|
|
235
|
+
if (action.path && action.value != null)
|
|
236
|
+
await adapter.select(action.path, action.value);
|
|
237
|
+
break;
|
|
238
|
+
case "check":
|
|
239
|
+
case "uncheck":
|
|
240
|
+
case "radio_select":
|
|
241
|
+
if (action.path)
|
|
242
|
+
await adapter.click(action.path);
|
|
243
|
+
break;
|
|
244
|
+
case "hover":
|
|
245
|
+
if (action.path)
|
|
246
|
+
await adapter.hover(action.path);
|
|
247
|
+
break;
|
|
248
|
+
case "press":
|
|
249
|
+
if (action.value)
|
|
250
|
+
await adapter.pressKey(action.value);
|
|
251
|
+
break;
|
|
252
|
+
case "screenshot":
|
|
253
|
+
await adapter.screenshot({ type: "png" });
|
|
254
|
+
break;
|
|
255
|
+
default:
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=test-case-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-case-executor.js","sourceRoot":"","sources":["../../src/orchestrator/test-case-executor.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAuB,EACvB,WAAgC,EAChC,OAAwB,EACxB,UAAuB,EACvB,QAA6B,EAC7B,GAAc,EACd,MAAwB,EACxB,gBAGC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,WAAW,GAKX,EAAE,CAAC;IAET,wCAAwC;IACxC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE;QAC3C,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC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AAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YAChD,MAAM;QACR,KAAK,QAAQ;YACX,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,IAAI,IAAI;gBACrC,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YAClD,MAAM;QACR,KAAK,OAAO,CAAC;QACb,KAAK,SAAS,CAAC;QACf,KAAK,cAAc;YACjB,IAAI,MAAM,CAAC,IAAI;gBAAE,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAClD,MAAM;QACR,KAAK,OAAO;YACV,IAAI,MAAM,CAAC,IAAI;gBAAE,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAClD,MAAM;QACR,KAAK,OAAO;YACV,IAAI,MAAM,CAAC,KAAK;gBAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvD,MAAM;QACR,KAAK,YAAY;YACf,MAAM,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1C,MAAM;QACR;YACE,MAAM;IACV,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import type { SizeClass } from "../domain/types";
|
|
2
|
-
export interface
|
|
3
|
-
|
|
2
|
+
export interface RunConfig {
|
|
3
|
+
testRunId: number;
|
|
4
4
|
runnerId: number;
|
|
5
|
-
scanUrl: string;
|
|
6
5
|
baseUrl: string;
|
|
7
6
|
sizeClass: SizeClass;
|
|
7
|
+
testEnvironmentId?: number;
|
|
8
|
+
uid?: string;
|
|
9
|
+
runnerInstanceId: string;
|
|
10
|
+
runnerInstanceName: string;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
}
|
|
13
|
+
/** @deprecated Use RunConfig */
|
|
14
|
+
export type ScanConfig = RunConfig & {
|
|
15
|
+
scanId: number;
|
|
16
|
+
scanUrl: string;
|
|
8
17
|
openaiApiKey?: string;
|
|
9
18
|
openaiModel?: string;
|
|
10
19
|
testWorkerCount?: number;
|
|
11
|
-
|
|
12
|
-
}
|
|
20
|
+
};
|
|
13
21
|
export interface ScanEventHandler {
|
|
14
22
|
onPageFound(page: {
|
|
15
23
|
relativePath: string;
|
|
@@ -31,6 +39,10 @@ export interface ScanEventHandler {
|
|
|
31
39
|
suiteId: number;
|
|
32
40
|
title: string;
|
|
33
41
|
}): void;
|
|
42
|
+
onTestCaseRunCompleted(run: {
|
|
43
|
+
testCaseRunId: number;
|
|
44
|
+
passed: boolean;
|
|
45
|
+
}): void;
|
|
34
46
|
onTestRunCompleted(run: {
|
|
35
47
|
testRunId: number;
|
|
36
48
|
passed: boolean;
|
|
@@ -59,7 +71,7 @@ export interface ScanEventHandler {
|
|
|
59
71
|
}): void;
|
|
60
72
|
}
|
|
61
73
|
export interface ScanResult {
|
|
62
|
-
|
|
74
|
+
testRunId: number;
|
|
63
75
|
pagesFound: number;
|
|
64
76
|
pageStatesFound: number;
|
|
65
77
|
testRunsCompleted: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/orchestrator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/orchestrator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,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AE,GAAG,IAAI,CAAC;IACtE,gBAAgB,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,cAAc,CAAC,KAAK,EAAE;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;QACxB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;IACT,oBAAoB,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACvE,cAAc,CAAC,OAAO,EAAE;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,OAAO,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -2,13 +2,13 @@ import type { BrowserAdapter } from "../adapter";
|
|
|
2
2
|
import type { HtmlComponentType } from "@sudobility/testomniac_types";
|
|
3
3
|
export declare const COMPONENT_SELECTORS: string[];
|
|
4
4
|
export declare const COMPONENT_TYPE_SELECTORS: Record<HtmlComponentType, string[]>;
|
|
5
|
-
export interface
|
|
5
|
+
export interface DetectedScaffoldRegion {
|
|
6
6
|
type: HtmlComponentType;
|
|
7
7
|
selector: string;
|
|
8
8
|
outerHtml: string;
|
|
9
9
|
hash: string;
|
|
10
10
|
}
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function detectScaffoldRegions(adapter: BrowserAdapter): Promise<DetectedScaffoldRegion[]>;
|
|
12
12
|
export interface CandidateRegion {
|
|
13
13
|
pageStateId: number;
|
|
14
14
|
selector: string;
|
|
@@ -110,7 +110,7 @@ export const COMPONENT_TYPE_SELECTORS = {
|
|
|
110
110
|
'[class*="scroll-top"]',
|
|
111
111
|
],
|
|
112
112
|
};
|
|
113
|
-
export async function
|
|
113
|
+
export async function detectScaffoldRegions(adapter) {
|
|
114
114
|
const typeEntries = Object.entries(COMPONENT_TYPE_SELECTORS);
|
|
115
115
|
const results = await adapter.evaluate((...args) => {
|
|
116
116
|
const entries = args[0];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DetectedScaffoldRegion } from "./component-detector";
|
|
2
2
|
import type { PatternInstance } from "@sudobility/testomniac_types";
|
|
3
3
|
export declare function getBody(html: string): string;
|
|
4
|
-
export declare function getContentBody(body: string, regions:
|
|
4
|
+
export declare function getContentBody(body: string, regions: DetectedScaffoldRegion[]): {
|
|
5
5
|
contentBody: string;
|
|
6
|
-
|
|
6
|
+
scaffolds: DetectedScaffoldRegion[];
|
|
7
7
|
};
|
|
8
8
|
export declare function getFixedBody(contentBody: string, patternInstances: PatternInstance[]): {
|
|
9
9
|
fixedBody: string;
|
|
@@ -12,8 +12,8 @@ export declare function getFixedBody(contentBody: string, patternInstances: Patt
|
|
|
12
12
|
export interface DecomposedHtml {
|
|
13
13
|
bodyHtml: string;
|
|
14
14
|
contentHtml: string;
|
|
15
|
-
regions:
|
|
15
|
+
regions: DetectedScaffoldRegion[];
|
|
16
16
|
}
|
|
17
17
|
/** @deprecated Use getContentBody instead */
|
|
18
|
-
export declare function decomposeHtml(bodyHtml: string, regions:
|
|
18
|
+
export declare function decomposeHtml(bodyHtml: string, regions: DetectedScaffoldRegion[]): DecomposedHtml;
|
|
19
19
|
//# sourceMappingURL=html-decomposer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-decomposer.d.ts","sourceRoot":"","sources":["../../src/scanner/html-decomposer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5C;AAMD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sBAAsB,EAAE,GAChC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,
|
|
1
|
+
{"version":3,"file":"html-decomposer.d.ts","sourceRoot":"","sources":["../../src/scanner/html-decomposer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5C;AAMD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sBAAsB,EAAE,GAChC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,sBAAsB,EAAE,CAAA;CAAE,CAa9D;AAMD,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,eAAe,EAAE,GAClC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;CAAE,CAapD;AAMD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,sBAAsB,EAAE,CAAC;CACnC;AAED,6CAA6C;AAC7C,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,sBAAsB,EAAE,GAChC,cAAc,CAGhB"}
|
|
@@ -6,18 +6,18 @@ export function getBody(html) {
|
|
|
6
6
|
return match ? match[1] : html;
|
|
7
7
|
}
|
|
8
8
|
// =============================================================================
|
|
9
|
-
// getContentBody — strip
|
|
9
|
+
// getContentBody — strip scaffolds from body
|
|
10
10
|
// =============================================================================
|
|
11
11
|
export function getContentBody(body, regions) {
|
|
12
12
|
let contentBody = body;
|
|
13
|
-
const
|
|
13
|
+
const scaffolds = [];
|
|
14
14
|
for (const region of regions) {
|
|
15
15
|
if (contentBody.includes(region.outerHtml)) {
|
|
16
|
-
contentBody = contentBody.replace(region.outerHtml, `<!--
|
|
17
|
-
|
|
16
|
+
contentBody = contentBody.replace(region.outerHtml, `<!-- scaffold: ${region.type} -->`);
|
|
17
|
+
scaffolds.push(region);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
return { contentBody,
|
|
20
|
+
return { contentBody, scaffolds };
|
|
21
21
|
}
|
|
22
22
|
// =============================================================================
|
|
23
23
|
// getFixedBody — strip pattern instances from content body
|
|
@@ -35,7 +35,7 @@ export function getFixedBody(contentBody, patternInstances) {
|
|
|
35
35
|
}
|
|
36
36
|
/** @deprecated Use getContentBody instead */
|
|
37
37
|
export function decomposeHtml(bodyHtml, regions) {
|
|
38
|
-
const { contentBody,
|
|
39
|
-
return { bodyHtml, contentHtml: contentBody, regions:
|
|
38
|
+
const { contentBody, scaffolds } = getContentBody(bodyHtml, regions);
|
|
39
|
+
return { bodyHtml, contentHtml: contentBody, regions: scaffolds };
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=html-decomposer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-decomposer.js","sourceRoot":"","sources":["../../src/scanner/html-decomposer.ts"],"names":[],"mappings":"AAGA,gFAAgF;AAChF,kDAAkD;AAClD,gFAAgF;AAEhF,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,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