diff --git a/packages/desktop-client/e2e/page-models/account-page.js b/packages/desktop-client/e2e/page-models/account-page.js index 01fb45dbac261c718b7b1a6b32ecef5e05d9e147..b9d3ee05fe7552ca84102a284408922bf343656a 100644 --- a/packages/desktop-client/e2e/page-models/account-page.js +++ b/packages/desktop-client/e2e/page-models/account-page.js @@ -31,17 +31,29 @@ export class AccountPage { } /** - * Create a single transaction + * Enter details of a transaction */ - async createSingleTransaction(transaction) { + async enterSingleTransaction(transaction) { await this.addNewTransactionButton.click(); - await this._fillTransactionFields(this.newTransactionRow, transaction); + } + /** + * Finish adding a transaction + */ + async addEnteredTransaction() { await this.addTransactionButton.click(); await this.cancelTransactionButton.click(); } + /** + * Create a single transaction + */ + async createSingleTransaction(transaction) { + await this.enterSingleTransaction(transaction); + await this.addEnteredTransaction(); + } + /** * Create split transactions */ @@ -82,6 +94,15 @@ export class AccountPage { */ getNthTransaction(index) { const row = this.transactionTableRow.nth(index); + + return this._getTransactionDetails(row); + } + + getEnteredTransaction() { + return this._getTransactionDetails(this.newTransactionRow); + } + + _getTransactionDetails(row) { const account = row.getByTestId('account'); return { diff --git a/packages/desktop-client/e2e/transactions.test.js b/packages/desktop-client/e2e/transactions.test.js index f0ea08d796feba991c5dad6b0298cbbae59efc1d..dfb80ceacd9e42fdcfcaa9af510f1cef1f3e6db8 100644 --- a/packages/desktop-client/e2e/transactions.test.js +++ b/packages/desktop-client/e2e/transactions.test.js @@ -141,4 +141,26 @@ test.describe('Transactions', () => { await expect(thirdTransaction.credit).toHaveText(''); await expect(page).toMatchThemeScreenshots(); }); + + test('creates a transfer test transaction', async () => { + await accountPage.enterSingleTransaction({ + payee: 'Bank of America', + notes: 'Notes field', + debit: '12.34', + }); + + let transaction = accountPage.getEnteredTransaction(); + await expect(transaction.category.locator('input')).toHaveValue('Transfer'); + await expect(page).toMatchThemeScreenshots(); + + await accountPage.addEnteredTransaction(); + + transaction = accountPage.getNthTransaction(0); + await expect(transaction.payee).toHaveText('Bank of America'); + await expect(transaction.notes).toHaveText('Notes field'); + await expect(transaction.category).toHaveText('Transfer'); + await expect(transaction.debit).toHaveText('12.34'); + await expect(transaction.credit).toHaveText(''); + await expect(page).toMatchThemeScreenshots(); + }); }); diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-1-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-1-chromium-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..2a6dceb54750f98173d4c480012eb5eb2d63f648 Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-1-chromium-linux.png differ diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-2-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-2-chromium-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..fe93911f83aeef5c5ae804d94ec6b0acd4c72985 Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-2-chromium-linux.png differ diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-3-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-3-chromium-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..fb92925b5e35c1210f8b8ef8880040a08d767b0d Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-3-chromium-linux.png differ diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-4-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-4-chromium-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..ebe54fd96603f4ee1244f4a57f9be95a02619a39 Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-4-chromium-linux.png differ diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-5-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-5-chromium-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..9a48e369fe867e1da5dd83bf04c224eb76044968 Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-5-chromium-linux.png differ diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-6-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-6-chromium-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..8555e68f86f4a79c03f533937ef8524348ce0f42 Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-6-chromium-linux.png differ diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx index 21dc4e0e0970aec3a14556a3d3f4a2e26bbc5132..b5a445ea904ae52f9cf26a6561b07bee138e0c69 100644 --- a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx +++ b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx @@ -995,7 +995,9 @@ const Transaction = memo(function Transaction({ const account = accounts && accountId && getAccountsById(accounts)[accountId]; const isChild = transaction.is_child; - const transferAcct = transferAccountsByTransaction[id]; + const transferAcct = isTemporaryId(id) + ? getAccountsById(accounts)[payee?.transfer_acct] + : transferAccountsByTransaction[id]; const isBudgetTransfer = transferAcct && transferAcct.offbudget === 0; const isOffBudget = account && account.offbudget === 1; @@ -1353,7 +1355,7 @@ const Transaction = memo(function Transaction({ </View> </CellButton> </Cell> - ) : isBudgetTransfer || isOffBudget || isPreview ? ( + ) : isBudgetTransfer || isOffBudget ? ( <InputCell /* Category field for transfer and off-budget transactions (NOT preview, it is covered first) */ @@ -1361,7 +1363,7 @@ const Transaction = memo(function Transaction({ width="flex" exposed={focusedField === 'category'} focused={focusedField === 'category'} - onExpose={name => !isPreview && onEdit(id, name)} + onExpose={name => onEdit(id, name)} value={ isParent ? 'Split' diff --git a/upcoming-release-notes/3239.md b/upcoming-release-notes/3239.md new file mode 100644 index 0000000000000000000000000000000000000000..45cbcf6434e32d948ce993def66ec2d81fc52e08 --- /dev/null +++ b/upcoming-release-notes/3239.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [jfdoming] +--- + +Fix transfer category in temporary transactions