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