forked from DreamLab-AI/origin-logseq-AR
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtest-filter-simple.ts
More file actions
104 lines (86 loc) · 3.31 KB
/
test-filter-simple.ts
File metadata and controls
104 lines (86 loc) · 3.31 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
99
100
101
102
103
104
import { chromium } from 'playwright';
async function testFilterSimple() {
console.log('Starting simple filter test...\n');
const browser = await chromium.launch({
headless: false,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
// Collect console logs
const logs: string[] = [];
page.on('console', msg => {
const text = msg.text();
logs.push(`[${msg.type()}] ${text}`);
if (text.includes('Filter') || text.includes('filter') ||
text.includes('sent to server') || text.includes('subscription')) {
console.log(`>>> ${text}`);
}
});
try {
console.log('1. Navigating to VisionFlow...');
await page.goto('http://192.168.0.51:3001', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(5000);
// Hide the SpaceMouse warning banner via JavaScript
console.log('2. Hiding any blocking banners...');
await page.evaluate(() => {
// Find and hide the orange/red warning banner
const banner = document.querySelector('.fixed.top-0.z-50');
if (banner) {
(banner as HTMLElement).style.display = 'none';
console.log('Hidden SpaceMouse banner');
}
// Also try by background color
document.querySelectorAll('div').forEach(el => {
const style = window.getComputedStyle(el);
if (style.position === 'fixed' && style.top === '0px' && style.zIndex === '50') {
(el as HTMLElement).style.display = 'none';
}
});
});
await page.waitForTimeout(500);
await page.screenshot({ path: '/tmp/filter-simple-1-initial.png' });
console.log(' Screenshot 1: Initial\n');
// Find and interact with the first slider using force click
console.log('3. Finding and clicking slider...');
const slider = await page.locator('input[type="range"]').first();
if (await slider.isVisible().catch(() => false)) {
// Use force click to bypass any overlays
await slider.click({ force: true });
await page.waitForTimeout(500);
// Change value using keyboard
console.log('4. Changing slider value via keyboard...');
await page.keyboard.press('Home');
await page.waitForTimeout(200);
for (let i = 0; i < 5; i++) {
await page.keyboard.press('ArrowRight');
await page.waitForTimeout(200);
}
console.log(' Slider changed');
await page.waitForTimeout(2000);
await page.screenshot({ path: '/tmp/filter-simple-2-changed.png' });
} else {
console.log(' Slider not visible');
}
// Check logs
console.log('\n=== Filter-Related Console Logs ===');
const filterLogs = logs.filter(l =>
l.toLowerCase().includes('filter') ||
l.toLowerCase().includes('sent to server')
);
if (filterLogs.length === 0) {
console.log('No filter-related logs found');
} else {
filterLogs.forEach(l => console.log(l));
}
// Final screenshot
await page.screenshot({ path: '/tmp/filter-simple-3-final.png', fullPage: true });
console.log('\nScreenshot 3: Final');
} catch (error) {
console.error('Test error:', error);
await page.screenshot({ path: '/tmp/filter-simple-error.png' });
} finally {
await browser.close();
}
console.log('\nTest completed.');
}
testFilterSimple().catch(console.error);