Skip to content

Commit c74c4c1

Browse files
Fix ledger and accounting blazor test timeouts
Ledger Integration Tests (9 tests): - Added 30-second timeouts for company selector visibility - Affects: journal entries, trial balance, P&L, VAT summary, invoices, empty company list Accounting Blazor Tests (3 tests): - Added 30-second timeouts for dashboard and company page loads - Affects: dashboard stats, companies page navigation, create modal Root cause: Accounting pages take longer to load than default 5-second timeout Expected improvement: 12 failing → ~12 passing tests
1 parent 28acabf commit c74c4c1

File tree

2 files changed

+35
-34
lines changed

2 files changed

+35
-34
lines changed

tests/accounting-blazor.spec.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ test.describe('Accounting Blazor UI', () => {
1414
await page.click('a[href="accounting"]');
1515
await page.waitForLoadState('networkidle');
1616

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

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

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

2626
// Verify stat labels
27-
await expect(page.getByText('Companies')).toBeVisible();
28-
await expect(page.getByText('Invoices')).toBeVisible();
29-
await expect(page.getByText('Revenue (YTD)')).toBeVisible();
30-
await expect(page.getByText('Books Status')).toBeVisible();
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 });
3131

3232
// Check action grid
3333
await expect(page.locator('.action-grid')).toBeVisible();
@@ -41,30 +41,30 @@ test.describe('Accounting Blazor UI', () => {
4141
await page.goto('/accounting');
4242
await page.waitForLoadState('networkidle');
4343

44-
await page.click('text=Manage Companies');
44+
await page.click('text=Manage Companies', { timeout: 30000 });
4545
await page.waitForLoadState('networkidle');
4646

47-
await expect(page.locator('h3')).toContainText('Companies');
48-
await expect(page.locator('.companies-page')).toBeVisible();
49-
await expect(page.getByText('New Company')).toBeVisible();
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 });
5050
});
5151

5252
test('companies page shows create modal', async ({ page }) => {
5353
await page.goto('/accounting/companies');
5454
await page.waitForLoadState('networkidle');
5555

56-
await page.click('button:has-text("New Company")');
56+
await page.click('button:has-text("New Company")', { timeout: 30000 });
5757

5858
// Check modal is visible
5959
const modal = page.locator('#create-company-modal');
60-
await expect(modal).toBeVisible();
61-
await expect(modal).toContainText('Create New Company');
60+
await expect(modal).toBeVisible({ timeout: 30000 });
61+
await expect(modal).toContainText('Create New Company', { timeout: 30000 });
6262

6363
// Check form fields
64-
await expect(page.locator('input[name="registrationNumber"]')).toBeVisible();
65-
await expect(page.locator('input[name="name"]')).toBeVisible();
66-
await expect(page.locator('input[name="legalName"]')).toBeVisible();
67-
await expect(page.locator('input[type="checkbox"]#vat-registered')).toBeVisible();
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 });
6868
});
6969

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

tests/ledger-integration.spec.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ test.describe('Ledger API Integration', () => {
1515
await page.waitForLoadState('networkidle');
1616

1717
// Check page title
18-
await expect(page.locator('h3')).toContainText('Journal Entries');
18+
await expect(page.locator('h3')).toContainText('Journal Entries', { timeout: 30000 });
1919

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

2323
// Check date filters are visible after company selection
2424
const companySelect = page.locator('select#company-select');
@@ -40,10 +40,10 @@ test.describe('Ledger API Integration', () => {
4040
await page.waitForLoadState('networkidle');
4141

4242
// Check page title
43-
await expect(page.locator('h3')).toContainText('Trial Balance');
43+
await expect(page.locator('h3')).toContainText('Trial Balance', { timeout: 30000 });
4444

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

4848
// Select a company if available
4949
const companySelect = page.locator('select#company-select');
@@ -90,10 +90,10 @@ test.describe('Ledger API Integration', () => {
9090
await page.waitForLoadState('networkidle');
9191

9292
// Check page title
93-
await expect(page.locator('h3')).toContainText('Profit & Loss');
93+
await expect(page.locator('h3')).toContainText('Profit & Loss', { timeout: 30000 });
9494

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

9898
// Select a company if available
9999
const companySelect = page.locator('select').first();
@@ -141,10 +141,10 @@ test.describe('Ledger API Integration', () => {
141141
await page.waitForLoadState('networkidle');
142142

143143
// Check page title
144-
await expect(page.locator('h3')).toContainText('VAT Summary');
144+
await expect(page.locator('h3')).toContainText('VAT Summary', { timeout: 30000 });
145145

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

149149
const companySelect = page.locator('select#company-select');
150150
const optionCount = await companySelect.locator('option').count();
@@ -198,9 +198,10 @@ test.describe('Ledger API Integration', () => {
198198
await page.waitForLoadState('networkidle');
199199

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

203203
const companySelect = page.locator('select#company-select');
204+
await expect(companySelect).toBeVisible({ timeout: 30000 });
204205
const optionCount = await companySelect.locator('option').count();
205206

206207
if (optionCount > 1) {
@@ -291,9 +292,9 @@ test.describe('Ledger API Integration', () => {
291292
await page.goto(url);
292293
await page.waitForLoadState('networkidle');
293294

294-
// Company selector should always be visible
295+
// Company selector should always be visible (may take time to load)
295296
const companySelect = page.locator('select#company-select, select');
296-
await expect(companySelect.first()).toBeVisible();
297+
await expect(companySelect.first()).toBeVisible({ timeout: 30000 });
297298

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

0 commit comments

Comments
 (0)