Skip to content

Commit e5620fa

Browse files
Fix remaining test timeouts - increase to 60s across the board
Sketch Tests: - navigate to sketches from job: 10s → 60s - create new sketch from job: 10s → 60s + waitForDesignerReady - Increased job row visibility timeout to 30s Ledger Tests: - All ledger pages: 30s → 60s timeouts - Added 2s buffer for Blazor hydration on each page - Covers: journal entries, trial balance, P&L, VAT summary, invoices Accounting Blazor Tests: - dashboard loads: 30s → 60s + 3s buffer - navigate to companies: 30s → 60s + 3s buffer + 2s post-nav - create modal: 30s → 60s + 3s buffer + 1s animation Pattern: Blazor pages need longer initial load times due to WASM Expected: ~15-20 more tests to pass
1 parent efcfe4e commit e5620fa

File tree

3 files changed

+57
-44
lines changed

3 files changed

+57
-44
lines changed

tests/accounting-blazor.spec.ts

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,22 @@ test.describe('Accounting Blazor UI', () => {
1313
test('accounting dashboard loads and shows stats', async ({ page }) => {
1414
await page.click('a[href="accounting"]');
1515
await page.waitForLoadState('networkidle');
16+
await page.waitForTimeout(3000); // Extra buffer for Blazor page load
1617

1718
// Check page title (may take time to load)
18-
await expect(page.locator('h3')).toContainText('Accounting Dashboard', { timeout: 30000 });
19+
await expect(page.locator('h3')).toContainText('Accounting Dashboard', { timeout: 60000 });
1920

2021
// Check stats grid is present
21-
await expect(page.locator('.stats-grid')).toBeVisible({ timeout: 30000 });
22+
await expect(page.locator('.stats-grid')).toBeVisible({ timeout: 60000 });
2223

2324
// Check for stat cards
24-
await expect(page.locator('.stat-card')).toHaveCount(4, { timeout: 30000 });
25+
await expect(page.locator('.stat-card')).toHaveCount(4, { timeout: 60000 });
2526

2627
// Verify stat labels
27-
await expect(page.getByText('Companies')).toBeVisible({ timeout: 30000 });
28-
await expect(page.getByText('Invoices')).toBeVisible({ timeout: 30000 });
29-
await expect(page.getByText('Revenue (YTD)')).toBeVisible({ timeout: 30000 });
30-
await expect(page.getByText('Books Status')).toBeVisible({ timeout: 30000 });
28+
await expect(page.getByText('Companies')).toBeVisible({ timeout: 60000 });
29+
await expect(page.getByText('Invoices')).toBeVisible({ timeout: 60000 });
30+
await expect(page.getByText('Revenue (YTD)')).toBeVisible({ timeout: 60000 });
31+
await expect(page.getByText('Books Status')).toBeVisible({ timeout: 60000 });
3132

3233
// Check action grid
3334
await expect(page.locator('.action-grid')).toBeVisible();
@@ -40,31 +41,35 @@ test.describe('Accounting Blazor UI', () => {
4041
test('can navigate to companies page', async ({ page }) => {
4142
await page.goto('/accounting');
4243
await page.waitForLoadState('networkidle');
44+
await page.waitForTimeout(3000); // Extra buffer for Blazor page load
4345

44-
await page.click('text=Manage Companies', { timeout: 30000 });
46+
await page.click('text=Manage Companies', { timeout: 60000 });
4547
await page.waitForLoadState('networkidle');
48+
await page.waitForTimeout(2000); // Extra buffer after navigation
4649

47-
await expect(page.locator('h3')).toContainText('Companies', { timeout: 30000 });
48-
await expect(page.locator('.companies-page')).toBeVisible({ timeout: 30000 });
49-
await expect(page.getByText('New Company')).toBeVisible({ timeout: 30000 });
50+
await expect(page.locator('h3')).toContainText('Companies', { timeout: 60000 });
51+
await expect(page.locator('.companies-page')).toBeVisible({ timeout: 60000 });
52+
await expect(page.getByText('New Company')).toBeVisible({ timeout: 60000 });
5053
});
5154

5255
test('companies page shows create modal', async ({ page }) => {
5356
await page.goto('/accounting/companies');
5457
await page.waitForLoadState('networkidle');
58+
await page.waitForTimeout(3000); // Extra buffer for Blazor page load
5559

56-
await page.click('button:has-text("New Company")', { timeout: 30000 });
60+
await page.click('button:has-text("New Company")', { timeout: 60000 });
61+
await page.waitForTimeout(1000); // Wait for modal animation
5762

5863
// Check modal is visible
5964
const modal = page.locator('#create-company-modal');
60-
await expect(modal).toBeVisible({ timeout: 30000 });
61-
await expect(modal).toContainText('Create New Company', { timeout: 30000 });
65+
await expect(modal).toBeVisible({ timeout: 60000 });
66+
await expect(modal).toContainText('Create New Company', { timeout: 60000 });
6267

6368
// Check form fields
64-
await expect(page.locator('input[name="registrationNumber"]')).toBeVisible({ timeout: 30000 });
65-
await expect(page.locator('input[name="name"]')).toBeVisible({ timeout: 30000 });
66-
await expect(page.locator('input[name="legalName"]')).toBeVisible({ timeout: 30000 });
67-
await expect(page.locator('input[type="checkbox"]#vat-registered')).toBeVisible({ timeout: 30000 });
69+
await expect(page.locator('input[name="registrationNumber"]')).toBeVisible({ timeout: 60000 });
70+
await expect(page.locator('input[name="name"]')).toBeVisible({ timeout: 60000 });
71+
await expect(page.locator('input[name="legalName"]')).toBeVisible({ timeout: 60000 });
72+
await expect(page.locator('input[type="checkbox"]#vat-registered')).toBeVisible({ timeout: 60000 });
6873
});
6974

7075
test('can close company create modal', async ({ page }) => {

tests/ledger-integration.spec.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ test.describe('Ledger API Integration', () => {
1313
test('journal entries page loads with company selector', async ({ page }) => {
1414
await page.goto('/accounting/gl-entries');
1515
await page.waitForLoadState('networkidle');
16+
await page.waitForTimeout(2000); // Extra buffer for Blazor hydration
1617

17-
// Check page title
18-
await expect(page.locator('h3')).toContainText('Journal Entries', { timeout: 30000 });
18+
// Check page title (may take time to load)
19+
await expect(page.locator('h3')).toContainText('Journal Entries', { timeout: 60000 });
1920

2021
// Check company selector is visible (may take time to load)
21-
await expect(page.locator('select#company-select')).toBeVisible({ timeout: 30000 });
22+
await expect(page.locator('select#company-select')).toBeVisible({ timeout: 60000 });
2223

2324
// Check date filters are visible after company selection
2425
const companySelect = page.locator('select#company-select');
@@ -38,12 +39,13 @@ test.describe('Ledger API Integration', () => {
3839
test('trial balance page shows company selector and validation', async ({ page }) => {
3940
await page.goto('/accounting/trial-balance');
4041
await page.waitForLoadState('networkidle');
42+
await page.waitForTimeout(2000); // Extra buffer for Blazor hydration
4143

42-
// Check page title
43-
await expect(page.locator('h3')).toContainText('Trial Balance', { timeout: 30000 });
44+
// Check page title (may take time to load)
45+
await expect(page.locator('h3')).toContainText('Trial Balance', { timeout: 60000 });
4446

4547
// Company selector should be visible (may take time to load)
46-
await expect(page.locator('select#company-select')).toBeVisible({ timeout: 30000 });
48+
await expect(page.locator('select#company-select')).toBeVisible({ timeout: 60000 });
4749

4850
// Select a company if available
4951
const companySelect = page.locator('select#company-select');
@@ -88,12 +90,13 @@ test.describe('Ledger API Integration', () => {
8890
test('profit and loss page has company selector and date range', async ({ page }) => {
8991
await page.goto('/accounting/reports/pl');
9092
await page.waitForLoadState('networkidle');
93+
await page.waitForTimeout(2000); // Extra buffer for Blazor hydration
9194

92-
// Check page title
93-
await expect(page.locator('h3')).toContainText('Profit & Loss', { timeout: 30000 });
95+
// Check page title (may take time to load)
96+
await expect(page.locator('h3')).toContainText('Profit & Loss', { timeout: 60000 });
9497

9598
// Company selector should be visible (may take time to load)
96-
await expect(page.locator('select')).toBeVisible({ timeout: 30000 });
99+
await expect(page.locator('select')).toBeVisible({ timeout: 60000 });
97100

98101
// Select a company if available
99102
const companySelect = page.locator('select').first();
@@ -139,12 +142,13 @@ test.describe('Ledger API Integration', () => {
139142
test('VAT summary page shows MTD boxes', async ({ page }) => {
140143
await page.goto('/accounting/vat-summary');
141144
await page.waitForLoadState('networkidle');
145+
await page.waitForTimeout(2000); // Extra buffer for Blazor hydration
142146

143-
// Check page title
144-
await expect(page.locator('h3')).toContainText('VAT Summary', { timeout: 30000 });
147+
// Check page title (may take time to load)
148+
await expect(page.locator('h3')).toContainText('VAT Summary', { timeout: 60000 });
145149

146150
// Company selector should be visible (may take time to load)
147-
await expect(page.locator('select#company-select')).toBeVisible({ timeout: 30000 });
151+
await expect(page.locator('select#company-select')).toBeVisible({ timeout: 60000 });
148152

149153
const companySelect = page.locator('select#company-select');
150154
const optionCount = await companySelect.locator('option').count();
@@ -196,12 +200,13 @@ test.describe('Ledger API Integration', () => {
196200
test('ledger invoices page has create modal', async ({ page }) => {
197201
await page.goto('/accounting/invoices');
198202
await page.waitForLoadState('networkidle');
203+
await page.waitForTimeout(2000); // Extra buffer for Blazor hydration
199204

200205
// Check page title
201-
await expect(page.locator('h3')).toContainText('Ledger Invoices', { timeout: 30000 });
206+
await expect(page.locator('h3')).toContainText('Ledger Invoices', { timeout: 60000 });
202207

203208
const companySelect = page.locator('select#company-select');
204-
await expect(companySelect).toBeVisible({ timeout: 30000 });
209+
await expect(companySelect).toBeVisible({ timeout: 60000 });
205210
const optionCount = await companySelect.locator('option').count();
206211

207212
if (optionCount > 1) {
@@ -291,10 +296,11 @@ test.describe('Ledger API Integration', () => {
291296
for (const url of pages) {
292297
await page.goto(url);
293298
await page.waitForLoadState('networkidle');
299+
await page.waitForTimeout(2000); // Extra buffer for Blazor hydration
294300

295301
// Company selector should always be visible (may take time to load)
296302
const companySelect = page.locator('select#company-select, select');
297-
await expect(companySelect.first()).toBeVisible({ timeout: 30000 });
303+
await expect(companySelect.first()).toBeVisible({ timeout: 60000 });
298304

299305
// Should have at least the "Select Company..." option
300306
const options = companySelect.first().locator('option');

tests/ui.sketches.spec.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test.describe('Sketch/Designer Functionality', () => {
4949

5050
test('navigate to sketches from job', async ({ page, request }) => {
5151
// Create a test job
52-
const jobTitle = `Sketch Test Job ${Date.now()}`;
52+
const jobTitle = `Sketch Nav Job ${Date.now()}`;
5353
const jobId = await createTestJob(request, jobTitle);
5454

5555
// Go to jobs page
@@ -58,14 +58,15 @@ test.describe('Sketch/Designer Functionality', () => {
5858

5959
// Find the job and click "Sketches" button
6060
const jobRow = page.locator('.list-item', { hasText: jobTitle }).first();
61-
await expect(jobRow).toBeVisible({ timeout: 10000 });
61+
await expect(jobRow).toBeVisible({ timeout: 30000 });
6262

63-
const sketchesLink = jobRow.locator('a', { hasText: 'Sketches' });
64-
await sketchesLink.click();
63+
const sketchesButton = jobRow.locator('button', { hasText: 'Sketches' });
64+
await sketchesButton.click();
6565

66-
// Verify we're on the sketches page
67-
await page.waitForURL(`**/job-sketches/${jobId}`, { timeout: 10000 });
68-
await expect(page.locator('h3', { hasText: `Sketches for Job ${jobId}` })).toBeVisible();
66+
// Verify navigation to sketches list (may take time)
67+
await page.waitForURL(`**/job-sketches/${jobId}`, { timeout: 60000 });
68+
await page.waitForLoadState('networkidle');
69+
await expect(page.locator('h3', { hasText: `Sketches for Job ${jobId}` })).toBeVisible({ timeout: 30000 });
6970
});
7071

7172
test('create new sketch from job', async ({ page, request }) => {
@@ -78,14 +79,15 @@ test.describe('Sketch/Designer Functionality', () => {
7879
await page.waitForLoadState('networkidle');
7980

8081
const jobRow = page.locator('.list-item', { hasText: jobTitle }).first();
81-
await expect(jobRow).toBeVisible({ timeout: 10000 });
82+
await expect(jobRow).toBeVisible({ timeout: 30000 });
8283

8384
const newSketchLink = jobRow.locator('a', { hasText: 'New Sketch' });
8485
await newSketchLink.click();
8586

86-
// Verify we're on the designer page
87-
await page.waitForURL(`**/designer/${jobId}`, { timeout: 10000 });
88-
await expect(page.locator('h3', { hasText: 'Sketch Designer' })).toBeVisible();
87+
// Verify we're on the designer page (may take time to load)
88+
await page.waitForURL(`**/designer/${jobId}`, { timeout: 60000 });
89+
await waitForDesignerReady(page);
90+
await expect(page.locator('h3', { hasText: 'Sketch Designer' })).toBeVisible({ timeout: 30000 });
8991
});
9092

9193
test('designer toolbar loads correctly', async ({ page, request }) => {

0 commit comments

Comments
 (0)