Files
rrweb/debug-buttons.js
xugp 71438691b3
Some checks failed
Tests / Tests (push) Has been cancelled
ESLint Check / ESLint Check and Report Upload (push) Has been cancelled
Prettier Check / Format Check (push) Has been cancelled
Prettier Check / Format Code (push) Has been cancelled
ESLint Check / Build Base for Bundle Size Comparison (push) Has been cancelled
feat: enhance web extension with export functionality and utility improvements
- Add export functionality to SessionList and Player pages
- Add new utility modules: dataOperations, format, path, settings
- Update manifest with export and download permissions
- Enhance storage utility with new data operations
- Add various test scripts and documentation files
2026-04-16 10:44:50 +08:00

101 lines
3.0 KiB
JavaScript

const puppeteer = require('puppeteer-core');
(async () => {
const browser = await puppeteer.launch({
headless: true,
executablePath: 'C:\\Users\\xgp\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe',
args: ['--allow-file-access-from-files', '--disable-web-security']
});
const page = await browser.newPage();
// Capture console logs
page.on('console', msg => {
console.log('CONSOLE:', msg.type(), msg.text());
});
page.on('pageerror', error => {
console.log('PAGE ERROR:', error.message);
});
await page.goto('file:///C:/Users/xgp/projects/rrweb/index.html', {
waitUntil: 'networkidle2',
timeout: 120000
});
// Wait for scripts to load
await new Promise(r => setTimeout(r, 3000));
console.log('=== Checking Button Status ===');
// Check rrweb loading
const rrwebStatus = await page.evaluate(() => {
return {
hasrrweb: typeof rrweb !== 'undefined',
hasRecord: typeof rrweb.record === 'function',
hasReplayer: typeof rrweb.Replayer === 'function',
hasExport: typeof exportRecording === 'function'
};
});
console.log('rrweb Status:', rrwebStatus);
// Check button states
const buttonStates = await page.evaluate(() => {
const elements = {
playToggle: document.getElementById('play-toggle-btn'),
timeline: document.getElementById('timeline'),
speedButtons: document.querySelectorAll('.speed-controls button'),
exportButton: document.querySelector('button[onclick="exportRecording()"]'),
startBtn: document.getElementById('start-btn'),
stopBtn: document.getElementById('stop-btn')
};
const states = {};
for (const [key, elem] of Object.entries(elements)) {
states[key] = {
exists: !!elem,
disabled: elem ? elem.disabled : false,
text: elem ? elem.textContent : 'N/A'
};
}
return states;
});
console.log('Button States:', buttonStates);
// Check if setupButtons was called
const setupStatus = await page.evaluate(() => {
return {
setupButtonsExists: typeof window.setupButtons === 'function',
speedButtons: Array.from(document.querySelectorAll('.speed-controls button')).length,
playToggleExists: !!document.getElementById('play-toggle-btn'),
timelineExists: !!document.getElementById('timeline')
};
});
console.log('Setup Status:', setupStatus);
// Test individual functions
const functionTests = await page.evaluate(() => {
return {
exportRecording: typeof window.exportRecording === 'function',
toggleReplay: typeof window.toggleReplay === 'function',
changeReplaySpeed: typeof window.changeReplaySpeed === 'function'
};
});
console.log('Function Tests:', functionTests);
// Try to call exportRecording directly
try {
await page.evaluate(() => {
window.exportRecording();
});
console.log('✓ exportRecording called successfully');
} catch (e) {
console.log('✗ exportRecording failed:', e.message);
}
await browser.close();
})().catch(e => {
console.error(e);
process.exit(1);
});