Skip to content

Commit eac1eb6

Browse files
fix: update screenshot script port to 3001 and resolve build conflicts
1 parent 9f3ef0c commit eac1eb6

4 files changed

Lines changed: 38 additions & 9 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"3d-visualization"
2020
],
2121
"scripts": {
22-
"dev": "next dev --turbopack",
22+
"dev": "next dev",
2323
"build": "next build",
2424
"start": "next start",
2525
"lint": "eslint",
@@ -66,4 +66,4 @@
6666
"ts-jest": "^29.4.6",
6767
"typescript": "^5"
6868
}
69-
}
69+
}
926 KB
Loading
180 KB
Loading

scripts/capture-screens.mjs

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const __filename = fileURLToPath(import.meta.url);
77
const __dirname = path.dirname(__filename);
88

99
const OUTPUT_DIR = path.resolve(__dirname, '../public/screenshots');
10-
const URL = 'http://localhost:3000'; // Make sure the app is running!
10+
const URL = 'http://localhost:3001'; // Make sure the app is running!
1111

1212
if (!fs.existsSync(OUTPUT_DIR)) {
1313
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
@@ -17,7 +17,12 @@ async function capture() {
1717
console.log('🚀 Launching browser for screenshot capture...');
1818
const browser = await puppeteer.launch({
1919
headless: "new",
20-
args: ['--no-sandbox', '--disable-setuid-sandbox'],
20+
args: [
21+
'--no-sandbox',
22+
'--disable-setuid-sandbox',
23+
'--disable-web-security',
24+
'--window-size=1920,1080'
25+
],
2126
defaultViewport: null,
2227
});
2328

@@ -29,15 +34,23 @@ async function capture() {
2934
try {
3035
console.log(`🌐 Navigating to ${URL}...`);
3136
// Wait until network is idle to ensure assets are loaded
32-
await page.goto(URL, { waitUntil: 'networkidle0', timeout: 60000 });
37+
const response = await page.goto(URL, { waitUntil: 'networkidle0', timeout: 90000 });
38+
39+
if (response?.status() !== 200) {
40+
console.warn(`⚠️ Page loaded with status ${response?.status()}`);
41+
}
3342

3443
// --- 1. Desktop Capture ---
3544
console.log('📸 Capturing Desktop View...');
3645
await page.setViewport({ width: 1920, height: 1080 });
3746

38-
// Wait for Globe or critical UI to be visible
39-
// We'll wait a bit extra for Cesium to render tiles
40-
await new Promise(r => setTimeout(r, 10000));
47+
// Wait for Cesium Canvas explicitly
48+
await page.waitForSelector('canvas', { timeout: 30000 });
49+
console.log(' - Canvas detected');
50+
51+
// Wait for Fly-in Animation (Start + 4s duration) + Tile Loading
52+
console.log(' - Waiting for cinematic fly-in & tiles...');
53+
await new Promise(r => setTimeout(r, 12000));
4154

4255
await page.screenshot({
4356
path: path.join(OUTPUT_DIR, 'desktop-preview.png'),
@@ -51,7 +64,12 @@ async function capture() {
5164

5265
// Reload to trigger mobile-specific logic (e.g. Globe resolution reduction)
5366
await page.reload({ waitUntil: 'networkidle0' });
54-
await new Promise(r => setTimeout(r, 10000)); // Wait for render
67+
68+
await page.waitForSelector('canvas', { timeout: 30000 });
69+
console.log(' - Mobile Canvas detected');
70+
71+
// Wait again for mobile reload + animation
72+
await new Promise(r => setTimeout(r, 12000));
5573

5674
await page.screenshot({
5775
path: path.join(OUTPUT_DIR, 'mobile-preview.png'),
@@ -61,6 +79,17 @@ async function capture() {
6179

6280
} catch (error) {
6381
console.error('❌ Error capturing screenshots:', error);
82+
83+
// Take an error screenshot to see what's happening
84+
try {
85+
await page.screenshot({
86+
path: path.join(OUTPUT_DIR, 'debug-error.png'),
87+
fullPage: true
88+
});
89+
console.log('📸 Saved debug-error.png');
90+
} catch (e) {
91+
console.error('Could not save debug screenshot');
92+
}
6493
} finally {
6594
await browser.close();
6695
console.log('✨ Done.');

0 commit comments

Comments
 (0)