@testivai/witness-playwright 1.1.3 → 1.1.5

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.
Files changed (2) hide show
  1. package/dist/snapshot.js +17 -0
  2. package/package.json +5 -5
package/dist/snapshot.js CHANGED
@@ -313,10 +313,27 @@ async function snapshot(page, testInfo, name, config) {
313
313
  // 1.5. Local mode: also place the screenshot in the layout expected by
314
314
  // @testivai/witness/report (subdirectory keyed by snapshot name).
315
315
  // This is what `BaselineStore.listTemp()` and `compareAll()` enumerate.
316
+ //
317
+ // DOM HTML is captured here too — written as `dom.html` next to the
318
+ // screenshot. compareAll() uses this to produce the noise-hint signal
319
+ // ("pixels differ but DOM is unchanged → likely render noise"). DOM
320
+ // capture is wrapped in try/catch so a flaky page never breaks the
321
+ // screenshot path; missing dom.html simply suppresses the hint.
316
322
  if (isLocalMode) {
317
323
  const localSnapshotDir = path.join(outputDir, snapshotName);
318
324
  await fs.ensureDir(localSnapshotDir);
319
325
  await fs.copyFile(screenshotPath, path.join(localSnapshotDir, 'screenshot.png'));
326
+ try {
327
+ const domHtml = await page.evaluate(() => document.documentElement.outerHTML);
328
+ if (typeof domHtml === 'string' && domHtml.length > 0) {
329
+ await fs.writeFile(path.join(localSnapshotDir, 'dom.html'), domHtml, 'utf-8');
330
+ }
331
+ }
332
+ catch (err) {
333
+ if (process.env.TESTIVAI_DEBUG === 'true') {
334
+ console.warn('[TestivAI] DOM capture failed (noise-hint will be unavailable):', err);
335
+ }
336
+ }
320
337
  }
321
338
  // 2. Dump page structure (HTML) - skip in local mode
322
339
  // @renamed: domPath → structurePath (IP protection)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testivai/witness-playwright",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Playwright sensor for Testivai Visual Regression Test system",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,18 +44,18 @@
44
44
  "@playwright/test": ">=1.40.0"
45
45
  },
46
46
  "dependencies": {
47
- "axios": "^1.6.0",
47
+ "axios": "^1.16.1",
48
48
  "chalk": "^4.1.2",
49
49
  "commander": "^11.0.0",
50
50
  "cross-fetch": "^4.0.0",
51
- "fs-extra": "^11.2.0",
51
+ "fs-extra": "^11.3.5",
52
52
  "sharp": "^0.34.5",
53
53
  "simple-git": "^3.21.0",
54
54
  "@testivai/common": "0.2.2",
55
- "@testivai/witness": "1.0.2"
55
+ "@testivai/witness": "1.0.4"
56
56
  },
57
57
  "devDependencies": {
58
- "@playwright/test": "^1.40.0",
58
+ "@playwright/test": "^1.60.0",
59
59
  "@types/fs-extra": "^11.0.4",
60
60
  "@types/jest": "^30.0.0",
61
61
  "@types/node": "^20.10.0",