This commit is contained in:
@@ -5,15 +5,11 @@ import { captureEvidence } from './helpers/evidence';
|
||||
test('production: verify all admin pages load correctly', async ({ page }) => {
|
||||
const baseUrl = (process.env.E2E_BASE_URL || 'https://www.taxbaik.com').replace(/\/$/, '');
|
||||
|
||||
// Login
|
||||
console.log('🔐 Logging in...');
|
||||
await loginThroughAdminUi(page, baseUrl, 'admin', 'Admin123!@#456');
|
||||
console.log('✓ Login successful\n');
|
||||
await loginThroughAdminUi(page, baseUrl, 'test_admin', 'TestAdmin@123456');
|
||||
|
||||
const pageHero = page.locator('.admin-page-hero').first();
|
||||
const loadingOverlay = page.locator('#blazor-loading');
|
||||
|
||||
// List of all admin pages to test (using direct URLs)
|
||||
const pages = [
|
||||
{ name: '📊 Dashboard', url: `${baseUrl}/admin/dashboard`, hasData: false },
|
||||
{ name: '👥 Clients', url: `${baseUrl}/admin/clients`, hasData: true },
|
||||
@@ -27,69 +23,48 @@ test('production: verify all admin pages load correctly', async ({ page }) => {
|
||||
];
|
||||
|
||||
for (const pageInfo of pages) {
|
||||
console.log(`${'─'.repeat(60)}`);
|
||||
console.log(`Testing: ${pageInfo.name}`);
|
||||
console.log(`URL: ${pageInfo.url}`);
|
||||
console.log(`${'─'.repeat(60)}`);
|
||||
|
||||
const startTime = Date.now();
|
||||
|
||||
try {
|
||||
// Navigate to page
|
||||
await navigateInBlazor(page, pageInfo.url);
|
||||
|
||||
// Wait for page hero or basic element
|
||||
try {
|
||||
await pageHero.waitFor({ state: 'visible', timeout: 3000 });
|
||||
console.log(` ✓ Page hero visible`);
|
||||
} catch {
|
||||
// Some pages might not have page hero, that's OK
|
||||
}
|
||||
} catch {}
|
||||
|
||||
// Check if page loaded successfully by looking for content
|
||||
const pageContent = page.locator('body').first();
|
||||
await pageContent.waitFor({ state: 'visible', timeout: 5000 });
|
||||
|
||||
// Wait for data if expected
|
||||
if (pageInfo.hasData) {
|
||||
try {
|
||||
// Try to find table rows
|
||||
await page.waitForSelector('tbody tr', { timeout: 8000 });
|
||||
const rowCount = await page.locator('tbody tr').count();
|
||||
if (rowCount > 0) {
|
||||
console.log(` ✓ Data loaded: ${rowCount} rows`);
|
||||
} else {
|
||||
console.log(` ⚠️ Table found but no rows`);
|
||||
}
|
||||
} catch {
|
||||
console.log(` ℹ️ No table data (may not have table)`);
|
||||
console.log(` ℹ️ No table data`);
|
||||
}
|
||||
}
|
||||
|
||||
// Verify overlay is hidden
|
||||
const overlayShown = await loadingOverlay.evaluate((el: HTMLElement) =>
|
||||
el.classList.contains('show')
|
||||
).catch(() => false);
|
||||
|
||||
if (!overlayShown) {
|
||||
console.log(` ✓ Loading overlay hidden`);
|
||||
} else {
|
||||
console.log(` ⚠️ Loading overlay still visible`);
|
||||
}
|
||||
|
||||
const totalTime = Date.now() - startTime;
|
||||
console.log(` ⏱️ Load time: ${totalTime}ms`);
|
||||
console.log(` ✅ PAGE LOADED SUCCESSFULLY\n`);
|
||||
await captureEvidence(page, test.info(), pageInfo.name.replace(/[^a-zA-Z0-9]+/g, '_').toLowerCase());
|
||||
} catch (error) {
|
||||
const totalTime = Date.now() - startTime;
|
||||
console.log(` ❌ FAILED: ${error}`);
|
||||
console.log(` ⏱️ Time: ${totalTime}ms\n`);
|
||||
console.log(` ⏱️ Time: ${totalTime}ms`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`${'═'.repeat(60)}`);
|
||||
console.log('✅ ALL PAGES VERIFIED SUCCESSFULLY');
|
||||
console.log(`${'═'.repeat(60)}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user