browser-commander 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jscpd-baseline.json +7 -18
- package/CHANGELOG.md +48 -0
- package/README.md +84 -0
- package/eslint.config.js +5 -0
- package/package.json +4 -1
- package/scripts/version-and-commit.mjs +13 -2
- package/src/bindings.js +13 -1
- package/src/browser/connector.js +15 -3
- package/src/browser/launcher.js +14 -2
- package/src/browser/navigation.js +63 -0
- package/src/core/dialog-manager.js +48 -0
- package/src/core/navigation-manager.js +83 -87
- package/src/core/navigation-readiness.js +133 -0
- package/src/core/readiness.js +478 -0
- package/src/downloads/attach.js +58 -0
- package/src/downloads/destination.js +125 -0
- package/src/downloads/manager.js +453 -0
- package/src/downloads/naming.js +246 -0
- package/src/downloads/sources.js +188 -0
- package/src/downloads/store.js +256 -0
- package/src/exports.js +72 -0
- package/src/factory.js +55 -0
- package/src/interactions/click-activation.js +317 -0
- package/src/interactions/click-result.js +108 -0
- package/src/interactions/click.js +766 -352
- package/src/tests/index.js +75 -11
- package/src/tests/tracing.js +236 -0
- package/src/traces/bundle.js +323 -0
- package/src/traces/observers.js +246 -0
- package/src/traces/page-capture.js +365 -0
- package/src/traces/reader.js +226 -0
- package/src/traces/recorder.js +437 -0
- package/src/traces/redaction.js +231 -0
- package/src/traces/schema.js +165 -0
- package/src/traces/viewer.js +302 -0
- package/tests/e2e/click-readiness.e2e.test.js +240 -0
- package/tests/e2e/downloads.e2e.test.js +188 -0
- package/tests/e2e/traces.e2e.test.js +457 -0
- package/tests/helpers/click-fixtures.js +62 -0
- package/tests/helpers/download-fixtures.js +125 -0
- package/tests/helpers/download-server.js +109 -0
- package/tests/helpers/e2e-browser.js +67 -0
- package/tests/helpers/file-modes.js +31 -0
- package/tests/helpers/fixture-server.js +56 -0
- package/tests/helpers/mocks.js +63 -66
- package/tests/helpers/readiness-server.js +96 -0
- package/tests/helpers/temp-directory.js +44 -0
- package/tests/helpers/trace-fixtures.js +198 -0
- package/tests/helpers/trace-server.js +117 -0
- package/tests/unit/core/dialog-manager.test.js +118 -10
- package/tests/unit/core/navigation-manager.test.js +162 -0
- package/tests/unit/core/readiness.test.js +517 -0
- package/tests/unit/downloads/attach.test.js +220 -0
- package/tests/unit/downloads/destination.test.js +114 -0
- package/tests/unit/downloads/manager.test.js +354 -0
- package/tests/unit/downloads/naming.test.js +174 -0
- package/tests/unit/downloads/store.test.js +215 -0
- package/tests/unit/interactions/click-activation.test.js +283 -0
- package/tests/unit/interactions/click-result.test.js +90 -0
- package/tests/unit/interactions/click.test.js +409 -200
- package/tests/unit/scripts/check-release-format.test.js +4 -1
- package/tests/unit/scripts/push-failure-classifier.test.js +153 -0
- package/tests/unit/scripts/push-with-rebase-retry.test.js +302 -0
- package/tests/unit/tests/tracing.test.js +299 -0
- package/tests/unit/traces/bundle.test.js +260 -0
- package/tests/unit/traces/reader.test.js +208 -0
- package/tests/unit/traces/recorder.test.js +562 -0
- package/tests/unit/traces/redaction.test.js +170 -0
- package/tests/unit/traces/schema.test.js +92 -0
- package/tests/unit/traces/viewer.test.js +289 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert';
|
|
3
|
+
import {
|
|
4
|
+
CLICK_STATUS,
|
|
5
|
+
CLICK_EFFECT,
|
|
6
|
+
evidence,
|
|
7
|
+
makeClickResult,
|
|
8
|
+
nextActionId,
|
|
9
|
+
} from '../../../src/interactions/click-result.js';
|
|
10
|
+
|
|
11
|
+
describe('click result model', () => {
|
|
12
|
+
it('should expose the documented status and effect vocabularies', () => {
|
|
13
|
+
assert.deepStrictEqual(Object.values(CLICK_STATUS).sort(), [
|
|
14
|
+
'failed',
|
|
15
|
+
'interrupted',
|
|
16
|
+
'succeeded',
|
|
17
|
+
'timed_out',
|
|
18
|
+
'unverified',
|
|
19
|
+
]);
|
|
20
|
+
assert.deepStrictEqual(Object.values(CLICK_EFFECT).sort(), [
|
|
21
|
+
'confirmed',
|
|
22
|
+
'contradicted',
|
|
23
|
+
'not-observed',
|
|
24
|
+
]);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should build evidence entries with a type and detail', () => {
|
|
28
|
+
const entry = evidence('navigation', { urlChanged: true });
|
|
29
|
+
assert.deepStrictEqual(entry, {
|
|
30
|
+
type: 'navigation',
|
|
31
|
+
detail: { urlChanged: true },
|
|
32
|
+
});
|
|
33
|
+
assert.deepStrictEqual(evidence('element-state').detail, {});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should derive verified only from confirmed effect', () => {
|
|
37
|
+
// Regression test for issue #89: `verified` must never be true unless an
|
|
38
|
+
// effect was actually observed.
|
|
39
|
+
const confirmed = makeClickResult({
|
|
40
|
+
status: CLICK_STATUS.SUCCEEDED,
|
|
41
|
+
dispatched: true,
|
|
42
|
+
effect: CLICK_EFFECT.CONFIRMED,
|
|
43
|
+
});
|
|
44
|
+
assert.strictEqual(confirmed.verified, true);
|
|
45
|
+
|
|
46
|
+
for (const effect of [
|
|
47
|
+
CLICK_EFFECT.NOT_OBSERVED,
|
|
48
|
+
CLICK_EFFECT.CONTRADICTED,
|
|
49
|
+
]) {
|
|
50
|
+
const result = makeClickResult({
|
|
51
|
+
status: CLICK_STATUS.UNVERIFIED,
|
|
52
|
+
dispatched: true,
|
|
53
|
+
effect,
|
|
54
|
+
});
|
|
55
|
+
assert.strictEqual(result.verified, false, effect);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should derive clicked from dispatched', () => {
|
|
60
|
+
assert.strictEqual(makeClickResult({ dispatched: true }).clicked, true);
|
|
61
|
+
assert.strictEqual(makeClickResult({ dispatched: false }).clicked, false);
|
|
62
|
+
assert.strictEqual(makeClickResult({}).clicked, false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should default to a conservative not-observed effect', () => {
|
|
66
|
+
const result = makeClickResult({ status: CLICK_STATUS.UNVERIFIED });
|
|
67
|
+
assert.strictEqual(result.effect, CLICK_EFFECT.NOT_OBSERVED);
|
|
68
|
+
assert.strictEqual(result.verified, false);
|
|
69
|
+
assert.strictEqual(result.navigated, false);
|
|
70
|
+
assert.deepStrictEqual(result.evidence, []);
|
|
71
|
+
assert.strictEqual(result.elapsedMs, 0);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should omit actionId unless one was supplied', () => {
|
|
75
|
+
assert.ok(!('actionId' in makeClickResult({})));
|
|
76
|
+
assert.strictEqual(makeClickResult({ actionId: 'a1' }).actionId, 'a1');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should carry extra fields through untouched', () => {
|
|
80
|
+
const result = makeClickResult({ selector: '#go', ready: false });
|
|
81
|
+
assert.strictEqual(result.selector, '#go');
|
|
82
|
+
assert.strictEqual(result.ready, false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should mint unique action ids for navigation correlation', () => {
|
|
86
|
+
const ids = new Set(Array.from({ length: 200 }, () => nextActionId()));
|
|
87
|
+
assert.strictEqual(ids.size, 200);
|
|
88
|
+
assert.ok([...ids].every((id) => id.startsWith('click-')));
|
|
89
|
+
});
|
|
90
|
+
});
|