-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiagnostic.spec.ts
More file actions
45 lines (35 loc) · 1.63 KB
/
diagnostic.spec.ts
File metadata and controls
45 lines (35 loc) · 1.63 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
import { test, expect } from '@playwright/test';
import { APP_URLS } from '../config/test-config';
test('Diagnostic: Check Angular app behavior', async ({ page }) => {
console.log('\n=== DIAGNOSTIC TEST ===');
// Navigate to Angular
await page.goto('http://localhost:4200');
await page.waitForTimeout(3000);
const currentUrl = page.url();
console.log('Current URL:', currentUrl);
// Check if we're on IdentityServer or Angular
const idHost = new URL(APP_URLS.identityServer).host;
if (currentUrl.includes(idHost)) {
console.log('✅ Redirected to IdentityServer (AUTH ENABLED)');
} else if (currentUrl.includes('localhost:4200')) {
console.log('❌ Stayed on Angular app (AUTH DISABLED)');
}
// Check page title
const title = await page.title();
console.log('Page Title:', title);
// Check for login elements
const hasUsernameInput = await page.locator('input[name="Username"]').isVisible().catch(() => false);
const hasDashboard = await page.locator('text=Dashboard').isVisible().catch(() => false);
console.log('Has Login Form:', hasUsernameInput);
console.log('Has Dashboard:', hasDashboard);
// Check localStorage for tokens
const storage = await page.evaluate(() => {
const keys = Object.keys(localStorage);
return keys.filter(k => k.includes('token') || k.includes('oidc') || k.includes('auth'));
});
console.log('Auth keys in localStorage:', storage.length > 0 ? storage : 'None');
// Take screenshot
await page.screenshot({ path: 'diagnostic-screenshot.png', fullPage: true });
console.log('Screenshot saved: diagnostic-screenshot.png');
console.log('======================\n');
});