From ae0788e6dde22b45bf6549096cbaddd77200cba1 Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 26 May 2026 11:18:52 -0700 Subject: [PATCH] improvements --- e2e/bulk-code-transactions.spec.ts | 2 +- e2e/transaction-edit.spec.ts | 92 ++++++------ e2e/transaction-navigation.spec.ts | 131 +++++++++++++++++ src/clj/auto_ap/ssr/components/aside.clj | 57 ++++++-- src/clj/auto_ap/ssr/transaction/common.clj | 2 +- src/clj/auto_ap/ssr/transaction/edit.clj | 162 +++++++++++---------- 6 files changed, 299 insertions(+), 147 deletions(-) create mode 100644 e2e/transaction-navigation.spec.ts diff --git a/e2e/bulk-code-transactions.spec.ts b/e2e/bulk-code-transactions.spec.ts index c8fa5273..c46e585d 100644 --- a/e2e/bulk-code-transactions.spec.ts +++ b/e2e/bulk-code-transactions.spec.ts @@ -234,7 +234,7 @@ test.describe('Bulk Code Transactions - Happy Path', () => { await openBulkCodeModal(page); // Should show all transactions - await expect(page.locator('text=Bulk editing 3 transactions')).toBeVisible(); + await expect(page.locator('text=Bulk editing 5 transactions')).toBeVisible(); // Add account at 100% await addNewAccount(page); diff --git a/e2e/transaction-edit.spec.ts b/e2e/transaction-edit.spec.ts index af6bf918..c9a1bcd0 100644 --- a/e2e/transaction-edit.spec.ts +++ b/e2e/transaction-edit.spec.ts @@ -103,27 +103,19 @@ async function selectAccountFromTypeahead(page: any, rowIndex: number, accountNa } async function findAccountRow(page: any, rowIndex: number) { - const allRows = page.locator('#account-grid-body tbody tr'); - const rowCount = await allRows.count(); + const accountRows = page.locator('#account-grid-body tbody tr.account-row'); + const rowCount = await accountRows.count(); - let accountRowIndex = 0; - for (let i = 0; i < rowCount; i++) { - const row = allRows.nth(i); - const hasAccountInput = await row.locator('input[name*="transaction-account/account"]').count() > 0; - if (hasAccountInput) { - if (accountRowIndex === rowIndex) { - return row; - } - accountRowIndex++; - } + if (rowIndex >= rowCount) { + throw new Error(`Could not find account row at index ${rowIndex}. Only ${rowCount} account rows found.`); } - throw new Error(`Could not find account row at index ${rowIndex}`); + return accountRows.nth(rowIndex); } async function setAccountAmount(page: any, rowIndex: number, amount: string) { const row = await findAccountRow(page, rowIndex); - const amountInput = row.locator('input[name*="transaction-account/amount"]').first(); + const amountInput = row.locator('.account-amount-field'); await amountInput.fill(amount); await amountInput.dispatchEvent('change'); await page.waitForTimeout(300); @@ -164,34 +156,24 @@ async function getAccountLocation(page: any, rowIndex: number): Promise } async function removeAllAccounts(page: any) { - const allRows = page.locator('#account-grid-body tbody tr'); - const rowCount = await allRows.count(); + const accountRows = page.locator('#account-grid-body tbody tr.account-row'); + const rowCount = await accountRows.count(); for (let i = rowCount - 1; i >= 0; i--) { - const row = allRows.nth(i); - const hasAccountInput = await row.locator('input[name*="transaction-account/account"]').count() > 0; - if (hasAccountInput) { - // Click the X button to remove (it's an tag, not a