Skip to content

Commit 9f67ba6

Browse files
Superset Devclaude
andcommitted
fix(mobile): create screenshot output dir defensively
MOBILE_SCREENSHOTS_DIR is committed to the repo alongside the generated images, so this was never hit in practice, but Playwright doesn't create missing parent directories for screenshot paths — mkdir defensively so the generator also works standalone against a clean/pruned checkout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent bcb5a3b commit 9f67ba6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

superset-frontend/playwright/generators/docs/mobile-screenshots.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* Screenshots are saved under docs/static/img/screenshots/mobile/.
3535
*/
3636

37+
import fs from 'fs';
3738
import path from 'path';
3839
import { Page, test, expect } from '@playwright/test';
3940
import { URL } from '../../utils/urls';
@@ -42,6 +43,11 @@ const MOBILE_SCREENSHOTS_DIR = path.resolve(
4243
__dirname,
4344
'../../../../docs/static/img/screenshots/mobile',
4445
);
46+
// Committed to the repo alongside the generated images, but create it
47+
// defensively in case someone deletes the directory and re-runs this
48+
// generator standalone (Playwright does not create missing parent
49+
// directories for screenshot paths).
50+
fs.mkdirSync(MOBILE_SCREENSHOTS_DIR, { recursive: true });
4551

4652
// iPhone 12-class viewport; 2x scale factor for crisp docs images
4753
test.use({

0 commit comments

Comments
 (0)