Skip to content

Commit e96acdd

Browse files
author
Mohammod Al Amin Ashik
committed
fix: sanitize screenshot filenames for NTFS compatibility
1 parent 4851ac6 commit e96acdd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/e2e/wdio.conf.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ export const config: Options.Testrunner = {
245245
afterTest: async function(test, context, { error }) {
246246
if (error) {
247247
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
248-
const filename = `./tests/e2e/screenshots/FAIL-${test.title.replace(/\s+/g, '_')}-${timestamp}.png`;
248+
// Sanitize test title: replace invalid filename chars (NTFS: " : < > | * ? \r \n) and spaces
249+
const safeTitle = test.title.replace(/[":*?<>|\r\n\\\/]+/g, '-').replace(/\s+/g, '_');
250+
const filename = `./tests/e2e/screenshots/FAIL-${safeTitle}-${timestamp}.png`;
249251
await browser.saveScreenshot(filename);
250252
console.log(`[e2e] Screenshot saved: ${filename}`);
251253
}

0 commit comments

Comments
 (0)