-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-frontend-routing.js
More file actions
69 lines (51 loc) · 2.29 KB
/
Copy pathdebug-frontend-routing.js
File metadata and controls
69 lines (51 loc) · 2.29 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
import { chromium } from 'playwright';
(async () => {
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
// Listen for console logs and errors
page.on('console', msg => console.log('CONSOLE:', msg.text()));
page.on('pageerror', error => console.log('ERROR:', error.message));
try {
console.log('1. Testing root URL (/)...');
await page.goto('http://localhost:5174/', { waitUntil: 'networkidle' });
await page.waitForTimeout(3000);
console.log('Current URL after redirect:', page.url());
console.log('Page title:', await page.title());
// Check if redirected to tenant URL
const url = page.url();
if (url.includes('/tenant/')) {
console.log('✓ Successfully redirected to tenant URL');
// Look for main navigation elements
const nav = await page.locator('nav').count();
console.log('Navigation elements found:', nav);
const dashboard = await page.getByText('Dashboard').count();
console.log('Dashboard links found:', dashboard);
const products = await page.getByText('Products').count();
console.log('Products links found:', products);
// Take screenshot
await page.screenshot({ path: 'debug-tenant-dashboard.png' });
console.log('Screenshot saved as debug-tenant-dashboard.png');
} else {
console.log('✗ Not redirected to tenant URL');
await page.screenshot({ path: 'debug-root-page.png' });
}
} catch (error) {
console.error('Error:', error);
}
try {
console.log('\n2. Testing direct tenant URL...');
await page.goto('http://localhost:5174/tenant/user0001_project0001/dashboard', { waitUntil: 'networkidle' });
await page.waitForTimeout(3000);
console.log('Direct tenant URL loaded, title:', await page.title());
console.log('URL:', page.url());
// Look for elements
const nav = await page.locator('nav').count();
const dashboard = await page.getByText('Dashboard').count();
const products = await page.getByText('Products').count();
console.log('Navigation:', nav, 'Dashboard:', dashboard, 'Products:', products);
await page.screenshot({ path: 'debug-direct-tenant.png' });
} catch (error) {
console.error('Error testing direct tenant URL:', error);
}
await browser.close();
})();