kryptheon 0.1.47 → 0.1.49

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.
@@ -128,13 +128,26 @@ function toSignatureRequests(list) {
128
128
  return out;
129
129
  }
130
130
 
131
+ // The word every value the input and reliability checks type carries
132
+ // (kryptheon-probe.js TEST_WORD). Text holding it is test data those checks
133
+ // left in the app - a row, a link, a heading - not a change in the flow, and
134
+ // the next replay must never say a flow broke because of it (blind round 17).
135
+ const TEST_WORD = 'kryptheon-test';
136
+
137
+ function notTestData(list) {
138
+ return (list || []).filter((item) => String(item == null ? '' : item).toLowerCase().indexOf(TEST_WORD) === -1);
139
+ }
140
+
131
141
  /** Assembles the signature from raw, page-shaped input. */
132
142
  function buildSignature(raw) {
133
143
  const input = raw || {};
134
144
  return {
135
- headings: uniqueInOrder(input.headings),
136
- actions: uniqueSorted(input.actions).slice(0, MAX_ACTIONS),
137
- fields: uniqueSorted(input.fields),
145
+ headings: uniqueInOrder(notTestData(input.headings)),
146
+ actions: uniqueSorted(notTestData(input.actions)).slice(0, MAX_ACTIONS),
147
+ // Links that name one record in a list the app fills (readPage rowOf):
148
+ // kept to say what was there, never compared as the page's own buttons.
149
+ data: uniqueSorted(notTestData(input.data)).slice(0, MAX_ACTIONS),
150
+ fields: uniqueSorted(notTestData(input.fields)),
138
151
  failedRequests: toSignatureRequests(input.failedRequests),
139
152
  };
140
153
  }
@@ -225,9 +238,15 @@ function compareSignatures(previous, current, renamed) {
225
238
  if (!previous || typeof previous !== 'object') return null;
226
239
  if (!current || typeof current !== 'object') return null;
227
240
 
228
- const headings = setDifference(previous.headings, current.headings);
229
- const actions = withoutRenames(setDifference(previous.actions, current.actions), renamed);
230
- const fields = withoutRenames(setDifference(previous.fields, current.fields), renamed);
241
+ // A baseline taken while test data was on the page holds it too: it is
242
+ // left out on both sides, so its coming or going is never a change.
243
+ const headings = setDifference(notTestData(previous.headings), notTestData(current.headings));
244
+ // A record in a list on either side is data, never a button that came or
245
+ // went - the list rotating as records are added is not the flow breaking.
246
+ const records = new Set((previous.data || []).concat(current.data || []));
247
+ const notRecord = (list) => notTestData(list).filter((item) => !records.has(item));
248
+ const actions = withoutRenames(setDifference(notRecord(previous.actions), notRecord(current.actions)), renamed);
249
+ const fields = withoutRenames(setDifference(notTestData(previous.fields), notTestData(current.fields)), renamed);
231
250
 
232
251
  // Only new failures matter. A 500 that has been fixed since the baseline was
233
252
  // taken is an improvement, and failing the run for it would be perverse.
@@ -286,7 +305,27 @@ function readPage() {
286
305
  if (isVisible(el)) headings.push(text(el));
287
306
  }
288
307
 
308
+ // A row of a list the app fills from its data: one of two or more siblings
309
+ // of the same kind, holding more than the button itself. A link in it
310
+ // named for one record ("Starter plan pricing") is that record, not part
311
+ // of the page - the list rotates as records are added, and the flow did
312
+ // not break (blind round 17: "Recent studies"). A button every row has
313
+ // ("Edit") is part of the page and stays. Navigation never counts as a
314
+ // list, and a nav item is the button itself, not a row around one.
315
+ const rowOf = (el) => {
316
+ if (el.closest('nav, [role="navigation"], [role="menu"], [role="menubar"], [role="tablist"]')) return null;
317
+ let node = el.parentElement;
318
+ for (let depth = 0; node && node !== document.body && depth < 6; depth++, node = node.parentElement) {
319
+ const parent = node.parentElement;
320
+ if (!parent) return null;
321
+ const same = Array.from(parent.children).filter((c) => c.tagName === node.tagName && c.className === node.className);
322
+ if (same.length >= 2 && text(node).replace(/\s+/g, ' ').trim() !== text(el).replace(/\s+/g, ' ').trim()) return node;
323
+ }
324
+ return null;
325
+ };
326
+
289
327
  const actions = [];
328
+ const rowed = [];
290
329
  const actionSelector =
291
330
  'button, a[href], [role="button"], [role="link"], input[type="submit"], input[type="button"]';
292
331
  for (const el of document.querySelectorAll(actionSelector)) {
@@ -297,7 +336,27 @@ function readPage() {
297
336
  text(el) ||
298
337
  el.getAttribute('title') ||
299
338
  '';
300
- if (label) actions.push(label);
339
+ if (!label) continue;
340
+ const row = rowOf(el);
341
+ if (row) rowed.push({ label: label.replace(/\s+/g, ' ').trim(), row: row, list: row.parentElement });
342
+ else actions.push(label);
343
+ }
344
+ // A row's own button is one every row of its list has, and is said like a
345
+ // command ("Edit", "View details") - not a record's name that many rows
346
+ // happen to share: a flow that saves the same title each run fills the list
347
+ // with it (blind round 17), and that is still data.
348
+ const COMMAND = /^(edit|delete|remove|view|open|details?|more|manage|archive|duplicate|copy|download|share|select|assign|approve|reject|accept|decline|reply|retry|cancel|save|add|update|change|show|hide|expand|collapse|undo|restore|pin|unpin)\b/i;
349
+ const rowsOf = new Map();
350
+ for (const r of rowed) {
351
+ if (!rowsOf.has(r.list)) rowsOf.set(r.list, new Set());
352
+ rowsOf.get(r.list).add(r.row);
353
+ }
354
+ const data = [];
355
+ for (const r of rowed) {
356
+ const rows = rowsOf.get(r.list);
357
+ const everyRow = Array.from(rows).every((row) => rowed.some((x) => x.row === row && x.label === r.label));
358
+ if (everyRow && (r.label.length <= 12 || COMMAND.test(r.label))) actions.push(r.label);
359
+ else data.push(r.label);
301
360
  }
302
361
 
303
362
  const fields = [];
@@ -325,7 +384,7 @@ function readPage() {
325
384
  const declared = !!document.querySelector('meta[charset], meta[http-equiv="Content-Type" i]');
326
385
  const guessedEncoding = !declared && String(document.characterSet || '').toUpperCase() !== 'UTF-8';
327
386
 
328
- return { headings: headings, actions: actions, fields: fields, guessedEncoding: guessedEncoding };
387
+ return { headings: headings, actions: actions, data: data, fields: fields, guessedEncoding: guessedEncoding };
329
388
  }
330
389
 
331
390
  /** True only for an explicit opt-in. */
@@ -364,6 +423,7 @@ async function readSignature(page, failedRequests) {
364
423
  const signature = buildSignature({
365
424
  headings: raw.headings,
366
425
  actions: raw.actions,
426
+ data: raw.data,
367
427
  fields: raw.fields,
368
428
  failedRequests: failedRequests,
369
429
  });
@@ -560,6 +620,7 @@ module.exports = {
560
620
  describeSignature: describeSignature,
561
621
  setDifference: setDifference,
562
622
  signatureEnabled: signatureEnabled,
623
+ TEST_WORD: TEST_WORD,
563
624
  collectSignature: collectSignature,
564
625
  printSignature: printSignature,
565
626
  readPage: readPage,
package/package.json CHANGED
@@ -1,104 +1,104 @@
1
- {
2
- "name": "kryptheon",
3
- "version": "0.1.47",
4
- "description": "Record what you do in your app and get plain-language reports when it breaks.",
5
- "license": "SEE LICENSE IN LICENSE",
6
- "type": "commonjs",
7
- "bin": {
8
- "kryptheon": "bin/kryptheon.js"
9
- },
10
- "exports": {
11
- ".": "./kryptheon-fixture.js",
12
- "./kryptheon-fixture": "./kryptheon-fixture.js",
13
- "./kryptheon-reporter": "./kryptheon-reporter.js",
14
- "./package.json": "./package.json",
15
- "./kryptheon-replay": "./kryptheon-replay.js",
16
- "./kryptheon-signature": "./kryptheon-signature.js",
17
- "./kryptheon-secrets": "./kryptheon-secrets.js"
18
- },
19
- "files": [
20
- "bin/",
21
- "kryptheon-fixture.js",
22
- "kryptheon-reporter.js",
23
- "kryptheon-signature.js",
24
- "kryptheon-secrets.js",
25
- "playwright.config.js",
26
- "README.md",
27
- "kryptheon-replay.js",
28
- "kryptheon-heal.js",
29
- "kryptheon-selectors.js",
30
- "kryptheon-recordings.js",
31
- "kryptheon-testfiles.js",
32
- "kryptheon-cleanup.js",
33
- "kryptheon-baselines.js",
34
- "kryptheon-project.js",
35
- "kryptheon-store.js",
36
- "kryptheon-code.js",
37
- "kryptheon-keys.js",
38
- "kryptheon-dashboard.js",
39
- "kryptheon-dashboard.html",
40
- "kryptheon-dashboard-page.js",
41
- "kryptheon-logo.png",
42
- "kryptheon-fonts-OFL.txt",
43
- "kryptheon-spacemono.woff2",
44
- "kryptheon-archivo.woff2",
45
- "kryptheon-changes.js",
46
- "kryptheon-look.js",
47
- "kryptheon-autostart.js",
48
- "kryptheon-edge.js",
49
- "kryptheon-probe.js",
50
- "kryptheon-probe-fixture.js",
51
- "kryptheon-probe-reporter.js",
52
- "kryptheon-probe.config.js",
53
- "kryptheon-reliability.js"
54
- ],
55
- "engines": {
56
- "node": ">=20.6.0"
57
- },
58
- "dependencies": {
59
- "@playwright/test": "^1.62.1"
60
- },
61
- "scripts": {
62
- "check": "node kryptheon-store.check.js && node kryptheon-code.check.js && node kryptheon-constdata.check.js && node kryptheon-listitems.check.js && node kryptheon-accept.check.js && node kryptheon-keys.check.js && node kryptheon-dashboard.check.js && node kryptheon-edge.check.js && node kryptheon-reliability.check.js && node kryptheon-autostart.check.js && node kryptheon-changes.check.js && node kryptheon-look.check.js && node kryptheon-verify.check.js && node kryptheon-recheck.check.js && node kryptheon-reporter.check.js && node kryptheon-signature.check.js && node kryptheon-signature.stream.check.js && node kryptheon-signature.baseline.check.js && node kryptheon-signature.settle.check.js && node kryptheon-signature.number.check.js && node kryptheon-env.check.js && node kryptheon-watchdog.check.js && node kryptheon-phone.check.js && node kryptheon-homedash.check.js && node kryptheon-record.check.js && node kryptheon-selectors.check.js && node kryptheon-recordings.check.js && node kryptheon-testfiles.check.js && node kryptheon-cleanup.check.js && node kryptheon-orphan.check.js && node kryptheon-project.check.js && node kryptheon-setup.check.js && node kryptheon-browser.check.js && node kryptheon-heal.check.js && node kryptheon-load.check.js && node kryptheon-package.check.js",
63
- "check:store": "node kryptheon-store.check.js",
64
- "check:code": "node kryptheon-code.check.js",
65
- "check:constdata": "node kryptheon-constdata.check.js",
66
- "check:dashboard": "node kryptheon-dashboard.check.js",
67
- "check:autostart": "node kryptheon-autostart.check.js",
68
- "check:changes": "node kryptheon-changes.check.js",
69
- "check:look": "node kryptheon-look.check.js",
70
- "check:verify": "node kryptheon-verify.check.js",
71
- "check:recheck": "node kryptheon-recheck.check.js",
72
- "check:reporter": "node kryptheon-reporter.check.js",
73
- "check:signature": "node kryptheon-signature.check.js",
74
- "check:stream": "node kryptheon-signature.stream.check.js",
75
- "check:baseline": "node kryptheon-signature.baseline.check.js",
76
- "check:settle": "node kryptheon-signature.settle.check.js",
77
- "check:number": "node kryptheon-signature.number.check.js",
78
- "check:env": "node kryptheon-env.check.js",
79
- "check:watchdog": "node kryptheon-watchdog.check.js",
80
- "check:record": "node kryptheon-record.check.js",
81
- "check:selectors": "node kryptheon-selectors.check.js",
82
- "check:recordings": "node kryptheon-recordings.check.js",
83
- "check:cleanup": "node kryptheon-cleanup.check.js",
84
- "check:orphan": "node kryptheon-orphan.check.js",
85
- "check:project": "node kryptheon-project.check.js",
86
- "check:setup": "node kryptheon-setup.check.js",
87
- "check:browser": "node kryptheon-browser.check.js",
88
- "check:heal": "node kryptheon-heal.check.js",
89
- "check:load": "node kryptheon-load.check.js",
90
- "check:package": "node kryptheon-package.check.js",
91
- "prepublishOnly": "node kryptheon-package.check.js",
92
- "check:testfiles": "node kryptheon-testfiles.check.js",
93
- "check:listitems": "node kryptheon-listitems.check.js",
94
- "check:edge": "node kryptheon-edge.check.js",
95
- "check:reliability": "node kryptheon-reliability.check.js"
96
- },
97
- "keywords": [
98
- "playwright",
99
- "testing",
100
- "end-to-end",
101
- "cli"
102
- ],
103
- "homepage": "https://kryptheon.tech"
104
- }
1
+ {
2
+ "name": "kryptheon",
3
+ "version": "0.1.49",
4
+ "description": "Record what you do in your app and get plain-language reports when it breaks.",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "type": "commonjs",
7
+ "bin": {
8
+ "kryptheon": "bin/kryptheon.js"
9
+ },
10
+ "exports": {
11
+ ".": "./kryptheon-fixture.js",
12
+ "./kryptheon-fixture": "./kryptheon-fixture.js",
13
+ "./kryptheon-reporter": "./kryptheon-reporter.js",
14
+ "./package.json": "./package.json",
15
+ "./kryptheon-replay": "./kryptheon-replay.js",
16
+ "./kryptheon-signature": "./kryptheon-signature.js",
17
+ "./kryptheon-secrets": "./kryptheon-secrets.js"
18
+ },
19
+ "files": [
20
+ "bin/",
21
+ "kryptheon-fixture.js",
22
+ "kryptheon-reporter.js",
23
+ "kryptheon-signature.js",
24
+ "kryptheon-secrets.js",
25
+ "playwright.config.js",
26
+ "README.md",
27
+ "kryptheon-replay.js",
28
+ "kryptheon-heal.js",
29
+ "kryptheon-selectors.js",
30
+ "kryptheon-recordings.js",
31
+ "kryptheon-testfiles.js",
32
+ "kryptheon-cleanup.js",
33
+ "kryptheon-baselines.js",
34
+ "kryptheon-project.js",
35
+ "kryptheon-store.js",
36
+ "kryptheon-code.js",
37
+ "kryptheon-keys.js",
38
+ "kryptheon-dashboard.js",
39
+ "kryptheon-dashboard.html",
40
+ "kryptheon-dashboard-page.js",
41
+ "kryptheon-logo.png",
42
+ "kryptheon-fonts-OFL.txt",
43
+ "kryptheon-spacemono.woff2",
44
+ "kryptheon-archivo.woff2",
45
+ "kryptheon-changes.js",
46
+ "kryptheon-look.js",
47
+ "kryptheon-autostart.js",
48
+ "kryptheon-edge.js",
49
+ "kryptheon-probe.js",
50
+ "kryptheon-probe-fixture.js",
51
+ "kryptheon-probe-reporter.js",
52
+ "kryptheon-probe.config.js",
53
+ "kryptheon-reliability.js"
54
+ ],
55
+ "engines": {
56
+ "node": ">=20.6.0"
57
+ },
58
+ "dependencies": {
59
+ "@playwright/test": "^1.62.1"
60
+ },
61
+ "scripts": {
62
+ "check": "node kryptheon-store.check.js && node kryptheon-code.check.js && node kryptheon-constdata.check.js && node kryptheon-listitems.check.js && node kryptheon-accept.check.js && node kryptheon-keys.check.js && node kryptheon-dashboard.check.js && node kryptheon-edge.check.js && node kryptheon-reliability.check.js && node kryptheon-autostart.check.js && node kryptheon-changes.check.js && node kryptheon-look.check.js && node kryptheon-verify.check.js && node kryptheon-recheck.check.js && node kryptheon-reporter.check.js && node kryptheon-signature.check.js && node kryptheon-signature.stream.check.js && node kryptheon-signature.baseline.check.js && node kryptheon-signature.settle.check.js && node kryptheon-signature.number.check.js && node kryptheon-signature.rows.check.js && node kryptheon-env.check.js && node kryptheon-watchdog.check.js && node kryptheon-phone.check.js && node kryptheon-homedash.check.js && node kryptheon-record.check.js && node kryptheon-selectors.check.js && node kryptheon-recordings.check.js && node kryptheon-testfiles.check.js && node kryptheon-cleanup.check.js && node kryptheon-orphan.check.js && node kryptheon-project.check.js && node kryptheon-setup.check.js && node kryptheon-browser.check.js && node kryptheon-heal.check.js && node kryptheon-load.check.js && node kryptheon-package.check.js",
63
+ "check:store": "node kryptheon-store.check.js",
64
+ "check:code": "node kryptheon-code.check.js",
65
+ "check:constdata": "node kryptheon-constdata.check.js",
66
+ "check:dashboard": "node kryptheon-dashboard.check.js",
67
+ "check:autostart": "node kryptheon-autostart.check.js",
68
+ "check:changes": "node kryptheon-changes.check.js",
69
+ "check:look": "node kryptheon-look.check.js",
70
+ "check:verify": "node kryptheon-verify.check.js",
71
+ "check:recheck": "node kryptheon-recheck.check.js",
72
+ "check:reporter": "node kryptheon-reporter.check.js",
73
+ "check:signature": "node kryptheon-signature.check.js",
74
+ "check:stream": "node kryptheon-signature.stream.check.js",
75
+ "check:baseline": "node kryptheon-signature.baseline.check.js",
76
+ "check:settle": "node kryptheon-signature.settle.check.js",
77
+ "check:number": "node kryptheon-signature.number.check.js",
78
+ "check:env": "node kryptheon-env.check.js",
79
+ "check:watchdog": "node kryptheon-watchdog.check.js",
80
+ "check:record": "node kryptheon-record.check.js",
81
+ "check:selectors": "node kryptheon-selectors.check.js",
82
+ "check:recordings": "node kryptheon-recordings.check.js",
83
+ "check:cleanup": "node kryptheon-cleanup.check.js",
84
+ "check:orphan": "node kryptheon-orphan.check.js",
85
+ "check:project": "node kryptheon-project.check.js",
86
+ "check:setup": "node kryptheon-setup.check.js",
87
+ "check:browser": "node kryptheon-browser.check.js",
88
+ "check:heal": "node kryptheon-heal.check.js",
89
+ "check:load": "node kryptheon-load.check.js",
90
+ "check:package": "node kryptheon-package.check.js",
91
+ "prepublishOnly": "node kryptheon-package.check.js",
92
+ "check:testfiles": "node kryptheon-testfiles.check.js",
93
+ "check:listitems": "node kryptheon-listitems.check.js",
94
+ "check:edge": "node kryptheon-edge.check.js",
95
+ "check:reliability": "node kryptheon-reliability.check.js"
96
+ },
97
+ "keywords": [
98
+ "playwright",
99
+ "testing",
100
+ "end-to-end",
101
+ "cli"
102
+ ],
103
+ "homepage": "https://kryptheon.tech"
104
+ }