A local-first personal finance app
Bug/5679 payee filter (#6594)
RMcGheecf3a42792fe1
diff --git a/packages/desktop-client/e2e/transactions.test.ts b/packages/desktop-client/e2e/transactions.test.tsindex 1fa812511b..00653a231f 100644--- a/packages/desktop-client/e2e/transactions.test.ts+++ b/packages/desktop-client/e2e/transactions.test.ts@@ -84,6 +84,78 @@ test.describe('Transactions', () => {);await expect(page).toMatchThemeScreenshots();});++ test('by payee', async () => {+ accountPage = await navigation.goToAccountPage('Capital One Checking');+ const filterTooltip = await accountPage.filterBy('Payee');+ const filtersMenuTooltip = page.getByTestId('filters-menu-tooltip');+ await expect(filterTooltip.locator).toMatchThemeScreenshots();++ // Type in the autocomplete box+ const autocomplete = filtersMenuTooltip.getByLabel('Payee');+ await expect(autocomplete).toMatchThemeScreenshots();++ // Open the textbox, auto-open is currently broken for anything that's not "is not"+ await autocomplete.click();++ await page.getByTestId('Kroger-payee-item').click();+ await filterTooltip.applyButton.click();++ // Assert that all Payees are Kroger+ for (let i = 0; i < 10; i++) {+ await expect(accountPage.getNthTransaction(i).payee).toHaveText(+ 'Kroger',+ );+ }+ await accountPage.removeFilter(0);++ await accountPage.filterBy('Payee');+ await filtersMenuTooltip+ .getByRole('button', { name: 'contains' })+ .click();+ const textInput = filtersMenuTooltip.getByPlaceholder('nothing');++ await textInput.fill('De');+ await filterTooltip.applyButton.click();+ // Assert that all Payees are Deposit+ for (let i = 0; i < 9; i++) {+ await expect(accountPage.getNthTransaction(i).payee).toHaveText(+ 'Deposit',+ );+ }++ await accountPage.removeFilter(0);++ await accountPage.filterBy('Payee');+ await filtersMenuTooltip+ .getByRole('button', { name: 'contains' })+ .click();++ await textInput.fill('l');+ await filterTooltip.applyButton.click();+ // Assert that both Payees contain the letter 'l'+ for (let i = 0; i < 2; i++) {+ await expect(accountPage.getNthTransaction(i).payee).toHaveText(/l/);+ }++ await accountPage.removeFilter(0);++ await accountPage.filterBy('Payee');+ await filtersMenuTooltip+ .getByRole('button', { name: 'does not contain' })+ .click();++ await textInput.fill('l');+ await filterTooltip.applyButton.click();+ // Assert that all Payees DO NOT contain the letter 'l'+ for (let i = 0; i < 19; i++) {+ await expect(accountPage.getNthTransaction(i).payee).not.toHaveText(+ /l/,+ );+ }++ await expect(page).toMatchThemeScreenshots();+ });});test('creates a test transaction', async () => {diff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-1-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-1-chromium-linux.pngnew file mode 100644index 0000000000..d44a37edcbBinary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-1-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-2-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-2-chromium-linux.pngnew file mode 100644index 0000000000..dafbb41437Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-2-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-3-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-3-chromium-linux.pngnew file mode 100644index 0000000000..0be48f1eb0Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-3-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-4-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-4-chromium-linux.pngnew file mode 100644index 0000000000..56afbdef4fBinary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-4-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-5-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-5-chromium-linux.pngnew file mode 100644index 0000000000..ca571fd405Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-5-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-6-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-6-chromium-linux.pngnew file mode 100644index 0000000000..d3632604c4Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-6-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-7-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-7-chromium-linux.pngnew file mode 100644index 0000000000..dfcc7b6245Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-7-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-8-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-8-chromium-linux.pngnew file mode 100644index 0000000000..a68af04602Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-8-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-9-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-9-chromium-linux.pngnew file mode 100644index 0000000000..2d0ca3dc8bBinary files /dev/null and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-payee-9-chromium-linux.png differdiff --git a/packages/desktop-client/src/components/filters/FiltersMenu.tsx b/packages/desktop-client/src/components/filters/FiltersMenu.tsxindex 5bffa43126..32e3df9fac 100644--- a/packages/desktop-client/src/components/filters/FiltersMenu.tsx+++ b/packages/desktop-client/src/components/filters/FiltersMenu.tsx@@ -126,6 +126,10 @@ function ConfigureField<T extends RuleConditionEntity>({return value;}, [value, field, subfield, dateFormat]);+ // For ops that filter based on payeeId, those use PayeeFilter, otherwise we use GenericInput+ const isPayeeIdOp = (op: T['op']) =>+ ['is', 'is not', 'one of', 'not one of'].includes(op);+return (<FocusScope><View style={{ marginBottom: 10 }}>@@ -260,7 +264,7 @@ function ConfigureField<T extends RuleConditionEntity>({});}}>- {type !== 'boolean' && field !== 'payee' && (+ {type !== 'boolean' && (field !== 'payee' || !isPayeeIdOp(op)) && (<GenericInputref={inputRef}// @ts-expect-error - fix me@@ -292,7 +296,7 @@ function ConfigureField<T extends RuleConditionEntity>({/>)}- {field === 'payee' && (+ {field === 'payee' && isPayeeIdOp(op) && (<PayeeFilter// @ts-expect-error - fix mevalue={formattedValue}diff --git a/upcoming-release-notes/6594.md b/upcoming-release-notes/6594.mdnew file mode 100644index 0000000000..f7e31d0f60--- /dev/null+++ b/upcoming-release-notes/6594.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [RMcGhee]+---++Fix payee filter functionality to improve transaction filtering in the application.