A local-first personal finance app
Fix transfer category in temporary transactions (#3239)
Julian Dominguez-Schatz411a6791b2f3
diff --git a/packages/desktop-client/e2e/page-models/account-page.js b/packages/desktop-client/e2e/page-models/account-page.jsindex 01fb45dbac..b9d3ee05fe 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.jsindex f0ea08d796..dfb80ceacd 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.pngnew file mode 100644index 0000000000..2a6dceb547Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-1-chromium-linux.png differdiff --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.pngnew file mode 100644index 0000000000..fe93911f83Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-2-chromium-linux.png differdiff --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.pngnew file mode 100644index 0000000000..fb92925b5eBinary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-3-chromium-linux.png differdiff --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.pngnew file mode 100644index 0000000000..ebe54fd966Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-4-chromium-linux.png differdiff --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.pngnew file mode 100644index 0000000000..9a48e369feBinary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-5-chromium-linux.png differdiff --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.pngnew file mode 100644index 0000000000..8555e68f86Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-transfer-test-transaction-6-chromium-linux.png differdiff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.jsxindex 21dc4e0e09..b5a445ea90 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.mdnew file mode 100644index 0000000000..45cbcf6434--- /dev/null+++ b/upcoming-release-notes/3239.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [jfdoming]+---++Fix transfer category in temporary transactions