@testsmith/testblocks 0.8.5 → 0.8.7
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 +5 -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
|
@@ -267,6 +267,10 @@ program
|
|
|
267
267
|
}
|
|
268
268
|
// Merge variables: globals first, then CLI overrides
|
|
269
269
|
const variables = { ...globalVariables, ...cliVariables };
|
|
270
|
+
// If baseUrl is provided via CLI, add it to variables so ${baseUrl} resolves correctly
|
|
271
|
+
if (options.baseUrl) {
|
|
272
|
+
variables.baseUrl = options.baseUrl;
|
|
273
|
+
}
|
|
270
274
|
// Create executor options
|
|
271
275
|
const executorOptions = {
|
|
272
276
|
headless: !options.headed,
|
|
@@ -443,7 +447,7 @@ program
|
|
|
443
447
|
'test:ci': 'testblocks run tests/**/*.testblocks.json -r console,html,junit -o reports',
|
|
444
448
|
},
|
|
445
449
|
devDependencies: {
|
|
446
|
-
'@testsmith/testblocks': '^0.8.
|
|
450
|
+
'@testsmith/testblocks': '^0.8.7',
|
|
447
451
|
},
|
|
448
452
|
};
|
|
449
453
|
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));
|