@testsmith/testblocks 0.8.5 → 0.8.6
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/cli/executor.js +13 -0
- package/dist/cli/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/executor.js
CHANGED
|
@@ -544,6 +544,18 @@ class TestExecutor {
|
|
|
544
544
|
stack: err.stack,
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
|
+
// Capture screenshot on failure if page is available
|
|
548
|
+
let screenshot;
|
|
549
|
+
if (status === 'failed' && this.page) {
|
|
550
|
+
try {
|
|
551
|
+
const buffer = await this.page.screenshot({ type: 'png' });
|
|
552
|
+
screenshot = `data:image/png;base64,${buffer.toString('base64')}`;
|
|
553
|
+
}
|
|
554
|
+
catch (screenshotError) {
|
|
555
|
+
// Silently ignore screenshot errors
|
|
556
|
+
console.debug('Failed to capture screenshot:', screenshotError);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
547
559
|
const result = {
|
|
548
560
|
stepId: step.id,
|
|
549
561
|
stepType: step.type,
|
|
@@ -551,6 +563,7 @@ class TestExecutor {
|
|
|
551
563
|
duration: Date.now() - startTime,
|
|
552
564
|
output,
|
|
553
565
|
error,
|
|
566
|
+
screenshot,
|
|
554
567
|
};
|
|
555
568
|
for (const plugin of this.plugins.values()) {
|
|
556
569
|
if (plugin.hooks?.afterStep) {
|
package/dist/cli/index.js
CHANGED
|
@@ -443,7 +443,7 @@ program
|
|
|
443
443
|
'test:ci': 'testblocks run tests/**/*.testblocks.json -r console,html,junit -o reports',
|
|
444
444
|
},
|
|
445
445
|
devDependencies: {
|
|
446
|
-
'@testsmith/testblocks': '^0.8.
|
|
446
|
+
'@testsmith/testblocks': '^0.8.6',
|
|
447
447
|
},
|
|
448
448
|
};
|
|
449
449
|
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));
|