forked from bobmatnyc/claude-mpm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-files-tab.js
More file actions
98 lines (82 loc) · 3.57 KB
/
verify-files-tab.js
File metadata and controls
98 lines (82 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const { chromium } = require('playwright');
(async () => {
console.log('Starting browser for Files tab verification...');
const browser = await chromium.launch({ headless: false });
const context = await browser.newContext({
viewport: { width: 1920, height: 1080 }
});
const page = await context.newPage();
// Track console messages
const errors = [];
page.on('console', msg => {
if (msg.type() === 'error') {
errors.push(msg.text());
}
console.log(`[CONSOLE ${msg.type()}] ${msg.text()}`);
});
try {
console.log('Navigating to dashboard...');
await page.goto('http://localhost:8765', { waitUntil: 'networkidle' });
await page.waitForTimeout(2000);
// Click on Files tab
console.log('Clicking Files tab...');
const filesTab = await page.$('button:has-text("Files")');
if (filesTab) {
await filesTab.click();
await page.waitForTimeout(2000); // Wait for socket events to be processed
} else {
throw new Error('Files tab not found');
}
// Take screenshot
await page.screenshot({ path: 'dashboard_files_panel.png', fullPage: true });
console.log('Screenshot saved: dashboard_files_panel.png');
// Check for files in the list
const bodyText = await page.textContent('body');
// Look for operation badges
const hasReadBadge = bodyText.includes('READ') || bodyText.includes('read');
const hasWriteBadge = bodyText.includes('WRITE') || bodyText.includes('write');
const hasEditBadge = bodyText.includes('EDIT') || bodyText.includes('edit');
// Look for specific files
const hasPackageJson = bodyText.includes('package.json');
const hasDashboardTest = bodyText.includes('dashboard-test.txt');
// Count files
const fileCountMatch = bodyText.match(/(\d+)\s+files?/);
const fileCount = fileCountMatch ? parseInt(fileCountMatch[1]) : 0;
console.log('\n=== FILES TAB VERIFICATION RESULTS ===');
console.log(`File count: ${fileCount}`);
console.log(`\nOperation badges found:`);
console.log(` - READ: ${hasReadBadge ? '✓' : '✗'}`);
console.log(` - WRITE: ${hasWriteBadge ? '✓' : '✗'}`);
console.log(` - EDIT: ${hasEditBadge ? '✓' : '✗'}`);
console.log(`\nSpecific files found:`);
console.log(` - package.json: ${hasPackageJson ? '✓' : '✗'}`);
console.log(` - dashboard-test.txt: ${hasDashboardTest ? '✓' : '✗'}`);
console.log(`\nConsole errors: ${errors.length}`);
if (errors.length > 0) {
console.log('\nErrors:');
errors.forEach(err => console.log(` - ${err}`));
}
// Try to click on a file if any exist
if (fileCount > 0) {
console.log('\nAttempting to click on a file...');
const fileButton = await page.$('button[class*="border-l-"]');
if (fileButton) {
await fileButton.click();
await page.waitForTimeout(1000);
// Check if file content appeared
const hasContent = await page.$('pre') || await page.$('code') || await page.$('[class*="content"]');
console.log(`File content viewer appeared: ${hasContent ? '✓' : '✗'}`);
// Take final screenshot
await page.screenshot({ path: 'dashboard_file_selected.png', fullPage: true });
console.log('Screenshot with file selected: dashboard_file_selected.png');
}
}
console.log('\nKeeping browser open for 30 seconds for inspection...');
await page.waitForTimeout(30000);
} catch (error) {
console.error('Error:', error);
await page.screenshot({ path: 'error-files-tab.png', fullPage: true });
} finally {
await browser.close();
}
})();