Skip to content

A local-first personal finance app

:white_check_mark: (vrt) increased strictness, added datepicker test (#1605)

Matiss Janis Aboltins940af6d36710
diff --git a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png
index 2134f58218..d68feec03e 100644
Binary files a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png and b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png
index 412753803f..9b92493eb4 100644
Binary files a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png and b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-creates-a-new-account-and-views-the-initial-balance-transaction-1-chromium-linux.png b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-creates-a-new-account-and-views-the-initial-balance-transaction-1-chromium-linux.png
index f91b967e00..a5bb844083 100644
Binary files a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-creates-a-new-account-and-views-the-initial-balance-transaction-1-chromium-linux.png and b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-creates-a-new-account-and-views-the-initial-balance-transaction-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-1-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-1-chromium-linux.png
index 8eeb47f986..6b22419340 100644
Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-1-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png
index 9e0dc62aa7..656b6485c9 100644
Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-from-accounts-id-page-1-chromium-linux.png b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-from-accounts-id-page-1-chromium-linux.png
index 722e9b77a3..8898769c0b 100644
Binary files a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-from-accounts-id-page-1-chromium-linux.png and b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-from-accounts-id-page-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-1-chromium-linux.png b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-1-chromium-linux.png
index aa0d6f8c86..0cfdffe0d7 100644
Binary files a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-1-chromium-linux.png and b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-2-chromium-linux.png b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-2-chromium-linux.png
index d8a7a694ec..08644ff837 100644
Binary files a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-2-chromium-linux.png and b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-3-chromium-linux.png b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-3-chromium-linux.png
index cb2f733857..2dd2bdc648 100644
Binary files a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-3-chromium-linux.png and b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-creates-a-transaction-via-footer-button-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-loads-the-budget-page-with-budgeted-amounts-1-chromium-linux.png b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-loads-the-budget-page-with-budgeted-amounts-1-chromium-linux.png
index 2fc9d8e70a..4e52ef1c12 100644
Binary files a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-loads-the-budget-page-with-budgeted-amounts-1-chromium-linux.png and b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-loads-the-budget-page-with-budgeted-amounts-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-opens-individual-account-page-and-checks-that-filtering-is-working-1-chromium-linux.png b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-opens-individual-account-page-and-checks-that-filtering-is-working-1-chromium-linux.png
index 06a183b0da..7fcb3d43a4 100644
Binary files a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-opens-individual-account-page-and-checks-that-filtering-is-working-1-chromium-linux.png and b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-opens-individual-account-page-and-checks-that-filtering-is-working-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-opens-individual-account-page-and-checks-that-filtering-is-working-3-chromium-linux.png b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-opens-individual-account-page-and-checks-that-filtering-is-working-3-chromium-linux.png
index d239e73fe1..f448161452 100644
Binary files a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-opens-individual-account-page-and-checks-that-filtering-is-working-3-chromium-linux.png and b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-opens-individual-account-page-and-checks-that-filtering-is-working-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/page-models/account-page.js b/packages/desktop-client/e2e/page-models/account-page.js
index 9f0127bd07..cabd83f953 100644
--- a/packages/desktop-client/e2e/page-models/account-page.js
+++ b/packages/desktop-client/e2e/page-models/account-page.js
@@ -20,9 +20,11 @@ export class AccountPage {
name: 'Menu',
});
- this.transactionTableRow = this.page
- .getByTestId('table')
- .getByTestId('row');
+ this.transactionTable = this.page.getByTestId('transaction-table');
+ this.transactionTableRow = this.transactionTable.getByTestId('row');
+
+ this.filterButton = this.page.getByRole('button', { name: 'Filter' });
+ this.filterSelectTooltip = this.page.getByTestId('filters-select-tooltip');
}
/**
@@ -94,6 +96,26 @@ export class AccountPage {
);
}
+ /**
+ * Open the filtering popover.
+ */
+ async filterBy(field) {
+ await this.filterButton.click();
+ await this.filterSelectTooltip.getByRole('button', { name: field }).click();
+
+ return new FilterTooltip(this.page.getByTestId('filters-menu-tooltip'));
+ }
+
+ /**
+ * Remove the nth filter
+ */
+ async removeFilter(idx) {
+ await this.page
+ .getByRole('button', { name: 'Delete filter' })
+ .nth(idx)
+ .click();
+ }
+
async _fillTransactionFields(transactionRow, transaction) {
if (transaction.payee) {
await transactionRow.getByTestId('payee').click();
@@ -131,3 +153,10 @@ export class AccountPage {
}
}
}
+
+class FilterTooltip {
+ constructor(page) {
+ this.page = page;
+ this.applyButton = page.getByRole('button', { name: 'Apply' });
+ }
+}
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png
index f2eaf9cd86..a4dfae2a10 100644
Binary files a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/rules.test.js-snapshots/Rules-creates-a-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-2-chromium-linux.png b/packages/desktop-client/e2e/rules.test.js-snapshots/Rules-creates-a-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-2-chromium-linux.png
index 7fe56db1ab..3d70dd3cea 100644
Binary files a/packages/desktop-client/e2e/rules.test.js-snapshots/Rules-creates-a-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-2-chromium-linux.png and b/packages/desktop-client/e2e/rules.test.js-snapshots/Rules-creates-a-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/schedules.test.js-snapshots/Schedules-creates-a-new-schedule-posts-the-transaction-and-later-completes-it-1-chromium-linux.png b/packages/desktop-client/e2e/schedules.test.js-snapshots/Schedules-creates-a-new-schedule-posts-the-transaction-and-later-completes-it-1-chromium-linux.png
index 6ce00637e0..5f8cab638d 100644
Binary files a/packages/desktop-client/e2e/schedules.test.js-snapshots/Schedules-creates-a-new-schedule-posts-the-transaction-and-later-completes-it-1-chromium-linux.png and b/packages/desktop-client/e2e/schedules.test.js-snapshots/Schedules-creates-a-new-schedule-posts-the-transaction-and-later-completes-it-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/schedules.test.js-snapshots/Schedules-creates-a-new-schedule-posts-the-transaction-and-later-completes-it-2-chromium-linux.png b/packages/desktop-client/e2e/schedules.test.js-snapshots/Schedules-creates-a-new-schedule-posts-the-transaction-and-later-completes-it-2-chromium-linux.png
index ef78d4a770..101f551f8b 100644
Binary files a/packages/desktop-client/e2e/schedules.test.js-snapshots/Schedules-creates-a-new-schedule-posts-the-transaction-and-later-completes-it-2-chromium-linux.png and b/packages/desktop-client/e2e/schedules.test.js-snapshots/Schedules-creates-a-new-schedule-posts-the-transaction-and-later-completes-it-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/transactions.test.js b/packages/desktop-client/e2e/transactions.test.js
index a9e4975feb..c103805f0a 100644
--- a/packages/desktop-client/e2e/transactions.test.js
+++ b/packages/desktop-client/e2e/transactions.test.js
@@ -31,6 +31,31 @@ test.describe('Transactions', () => {
await expect(page).toHaveScreenshot(screenshotConfig(page));
});
+ test.describe('filters transactions', () => {
+ // Reset filters
+ test.afterEach(async () => {
+ await accountPage.removeFilter(0);
+ });
+
+ test('by date', async () => {
+ const filterTooltip = await accountPage.filterBy('Date');
+ await expect(filterTooltip.page).toHaveScreenshot(screenshotConfig(page));
+
+ // Open datepicker
+ await page.keyboard.press('Space');
+ const datepicker = page.getByTestId('date-select-tooltip');
+ await expect(datepicker).toHaveScreenshot(screenshotConfig(page));
+
+ // Select "is xxxxx"
+ await datepicker.getByRole('button', { name: '20' }).click();
+ await filterTooltip.applyButton.click();
+
+ // Assert that there are no transactions
+ await expect(accountPage.transactionTable).toHaveText('No transactions');
+ await expect(page).toHaveScreenshot(screenshotConfig(page));
+ });
+ });
+
test('creates a test transaction', async () => {
await accountPage.createSingleTransaction({
payee: 'Home Depot',
diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-checks-the-page-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-checks-the-page-visuals-1-chromium-linux.png
index fa44cbe525..b3fcea04b4 100644
Binary files a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-checks-the-page-visuals-1-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-checks-the-page-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-split-test-transaction-1-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-split-test-transaction-1-chromium-linux.png
index ad87197944..fe5a46e052 100644
Binary files a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-split-test-transaction-1-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-split-test-transaction-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-test-transaction-1-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-test-transaction-1-chromium-linux.png
index b4e9668975..e8a596b7a7 100644
Binary files a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-test-transaction-1-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-creates-a-test-transaction-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-1-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-1-chromium-linux.png
new file mode 100644
index 0000000000..c20a4937f1
Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-2-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-2-chromium-linux.png
new file mode 100644
index 0000000000..a5b72beb8d
Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-3-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-3-chromium-linux.png
new file mode 100644
index 0000000000..72a73b2d82
Binary files /dev/null and b/packages/desktop-client/e2e/transactions.test.js-snapshots/Transactions-filters-transactions-by-date-3-chromium-linux.png differ
diff --git a/packages/desktop-client/playwright.config.js b/packages/desktop-client/playwright.config.js
index b3c1455417..87b854e79a 100644
--- a/packages/desktop-client/playwright.config.js
+++ b/packages/desktop-client/playwright.config.js
@@ -26,14 +26,4 @@ export default defineConfig({
trace: 'on-first-retry',
ignoreHTTPSErrors: true,
},
- expect: {
- toHaveScreenshot: {
- // Approx. 2% difference (1000 pixels)
- maxDiffPixels: 1000,
- },
- toMatchSnapshot: {
- // 2% difference is acceptable
- maxDiffPixelRatio: 0.02,
- },
- },
});
diff --git a/packages/desktop-client/src/components/budget/MobileBudgetTable.js b/packages/desktop-client/src/components/budget/MobileBudgetTable.js
index 964ff3e72c..39c065ba58 100644
--- a/packages/desktop-client/src/components/budget/MobileBudgetTable.js
+++ b/packages/desktop-client/src/components/budget/MobileBudgetTable.js
@@ -1081,7 +1081,6 @@ function BudgetHeader({
// zIndex: -1
},
]}
- data-vrt-mask
>
{/* eslint-disable-next-line rulesdir/typography */}
{monthUtils.format(currentMonth, "MMMM ''yy")}
diff --git a/packages/desktop-client/src/components/budget/MonthPicker.js b/packages/desktop-client/src/components/budget/MonthPicker.js
index a3bd54791f..c9520fadbb 100644
--- a/packages/desktop-client/src/components/budget/MonthPicker.js
+++ b/packages/desktop-client/src/components/budget/MonthPicker.js
@@ -1,6 +1,5 @@
import { useState } from 'react';
-import * as Platform from 'loot-core/src/client/platform';
import * as monthUtils from 'loot-core/src/shared/months';
import useResizeObserver from '../../hooks/useResizeObserver';
@@ -141,10 +140,9 @@ export const MonthPicker = ({
onClick={() => onSelect(month)}
onMouseEnter={() => setHoverId(idx)}
onMouseLeave={() => setHoverId(null)}
- data-vrt-mask
>
{size === 'small' ? monthName[0] : monthName}
- {!Platform.isPlaywright && showYearHeader && (
+ {showYearHeader && (
<View
style={[
{
diff --git a/packages/desktop-client/src/components/budget/report/BudgetSummary.tsx b/packages/desktop-client/src/components/budget/report/BudgetSummary.tsx
index be98787908..6bf2f341eb 100644
--- a/packages/desktop-client/src/components/budget/report/BudgetSummary.tsx
+++ b/packages/desktop-client/src/components/budget/report/BudgetSummary.tsx
@@ -374,7 +374,6 @@ export function BudgetSummary({ month }: BudgetSummaryProps) {
},
currentMonth === month && { textDecoration: 'underline' },
])}
- data-vrt-mask
>
{monthUtils.format(month, 'MMMM')}
</div>
diff --git a/packages/desktop-client/src/components/budget/rollover/BudgetSummary.tsx b/packages/desktop-client/src/components/budget/rollover/BudgetSummary.tsx
index 9bbe6fe9db..c67b4fa8eb 100644
--- a/packages/desktop-client/src/components/budget/rollover/BudgetSummary.tsx
+++ b/packages/desktop-client/src/components/budget/rollover/BudgetSummary.tsx
@@ -134,7 +134,7 @@ function TotalsList({ prevMonthName, collapsed }: TotalsListProps) {
<View>
<Block>Available Funds</Block>
- <Block data-vrt-mask>Overspent in {prevMonthName}</Block>
+ <Block>Overspent in {prevMonthName}</Block>
<Block>Budgeted</Block>
<Block>For Next Month</Block>
</View>
@@ -347,7 +347,6 @@ export function BudgetSummary({
},
currentMonth === month && { fontWeight: 'bold' },
])}
- data-vrt-mask
>
{monthUtils.format(month, 'MMMM')}
</div>
diff --git a/packages/desktop-client/src/components/filters/FiltersMenu.js b/packages/desktop-client/src/components/filters/FiltersMenu.js
index 3e73d8c0ce..e548532324 100644
--- a/packages/desktop-client/src/components/filters/FiltersMenu.js
+++ b/packages/desktop-client/src/components/filters/FiltersMenu.js
@@ -176,6 +176,7 @@ function ConfigureField({
style={{ padding: 15, color: theme.altmenuItemTextHeader }}
width={275}
onClose={() => dispatch({ type: 'close' })}
+ data-testid="filters-menu-tooltip"
>
<FocusScope>
<View style={{ marginBottom: 10 }}>
@@ -427,6 +428,7 @@ export function FilterButton({ onApply }) {
position="bottom-left"
style={{ padding: 0 }}
onClose={() => dispatch({ type: 'close' })}
+ data-testid="filters-select-tooltip"
>
<Menu
onMenuSelect={name => {
@@ -536,7 +538,7 @@ function FilterExpression({
)}
</div>
</Button>
- <Button type="bare" onClick={onDelete}>
+ <Button type="bare" onClick={onDelete} aria-label="Delete filter">
<DeleteIcon
style={{
width: 8,
diff --git a/packages/desktop-client/src/components/reports/DateRange.js b/packages/desktop-client/src/components/reports/DateRange.js
index 1d31a02fa3..927d5784ee 100644
--- a/packages/desktop-client/src/components/reports/DateRange.js
+++ b/packages/desktop-client/src/components/reports/DateRange.js
@@ -26,11 +26,7 @@ function DateRange({ start, end }) {
content = d.format(end, 'MMMM yyyy');
}
- return (
- <Block style={{ color: colors.n6 }} data-vrt-mask>
- {content}
- </Block>
- );
+ return <Block style={{ color: colors.n6 }}>{content}</Block>;
}
export default DateRange;
diff --git a/packages/desktop-client/src/components/schedules/SchedulesTable.js b/packages/desktop-client/src/components/schedules/SchedulesTable.js
index d8d4414a94..c40fc0d127 100644
--- a/packages/desktop-client/src/components/schedules/SchedulesTable.js
+++ b/packages/desktop-client/src/components/schedules/SchedulesTable.js
@@ -215,7 +215,7 @@ export function SchedulesTable({
<Field width="flex" name="account">
<DisplayId type="accounts" id={item._account} />
</Field>
- <Field width={110} name="date" data-vrt-mask>
+ <Field width={110} name="date">
{item.next_date
? monthUtils.format(item.next_date, dateFormat)
: null}
diff --git a/packages/desktop-client/src/components/select/DateSelect.js b/packages/desktop-client/src/components/select/DateSelect.js
index b321fc375f..8554025ac6 100644
--- a/packages/desktop-client/src/components/select/DateSelect.js
+++ b/packages/desktop-client/src/components/select/DateSelect.js
@@ -19,6 +19,7 @@ import {
getDayMonthRegex,
getShortYearFormat,
getShortYearRegex,
+ currentDate,
} from 'loot-core/src/shared/months';
import { stringToInteger } from 'loot-core/src/shared/util';
@@ -115,8 +116,8 @@ let DatePicker = forwardRef(
keyboardInput: false,
firstDay: stringToInteger(firstDayOfWeekIdx),
defaultDate: value
- ? d.parse(value, dateFormat, new Date())
- : new Date(),
+ ? d.parse(value, dateFormat, currentDate())
+ : currentDate(),
setDefaultDate: true,
toString(date) {
return d.format(date, dateFormat);
@@ -293,6 +294,7 @@ export default function DateSelect({
position="bottom-left"
offset={2}
style={[{ padding: 0, minWidth: 225 }, tooltipStyle]}
+ data-testid="date-select-tooltip"
>
{content}
</Tooltip>
diff --git a/packages/desktop-client/src/components/tooltips.js b/packages/desktop-client/src/components/tooltips.js
index 059558b2b7..eaf62195ed 100644
--- a/packages/desktop-client/src/components/tooltips.js
+++ b/packages/desktop-client/src/components/tooltips.js
@@ -45,6 +45,7 @@ export class Tooltip extends Component {
// kind of things can be click that shouldn't close a tooltip?
if (
node.dataset.testid === 'tooltip' ||
+ node.dataset.testid === this.props['data-testid'] ||
node.dataset.reachPopover != null
) {
break;
@@ -318,7 +319,7 @@ export class Tooltip extends Component {
<div
{...css(contentStyle, style, styles.darkScrollbar)}
ref={this.contentRef}
- data-testid="tooltip"
+ data-testid={this.props['data-testid'] || 'tooltip'}
onClick={e => {
// Click events inside a tooltip (e.g. when selecting a menu item) will bubble up
// through the portal to parents in the React tree (as opposed to DOM parents).
diff --git a/packages/desktop-client/src/components/transactions/MobileTransaction.js b/packages/desktop-client/src/components/transactions/MobileTransaction.js
index d0cacc150f..7dcf4007aa 100644
--- a/packages/desktop-client/src/components/transactions/MobileTransaction.js
+++ b/packages/desktop-client/src/components/transactions/MobileTransaction.js
@@ -553,7 +553,6 @@ class TransactionEditInner extends PureComponent {
),
)
}
- data-vrt-mask
/>
</View>
@@ -1075,7 +1074,7 @@ export class TransactionList extends Component {
return (
<Section
title={
- <span data-vrt-mask>
+ <span>
{monthUtils.format(section.date, 'MMMM dd, yyyy')}
</span>
}
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.js b/packages/desktop-client/src/components/transactions/TransactionsTable.js
index 41249a2b6c..cc4073925f 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.js
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.js
@@ -925,7 +925,6 @@ const Transaction = memo(function Transaction(props) {
onUpdate={value => {
onUpdate('date', value);
}}
- data-vrt-mask
>
{({
onBlur,
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.test.js b/packages/desktop-client/src/components/transactions/TransactionsTable.test.js
index c65229e2ff..b859327ccc 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.test.js
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.test.js
@@ -431,7 +431,7 @@ describe('Transactions', () => {
const { container } = renderTransactions();
let input = await editField(container, 'category', 2);
- let tooltip = container.querySelector('[data-testid="tooltip"]');
+ let tooltip = container.querySelector('[data-testid="autocomplete"]');
expect(tooltip).toBeTruthy();
expect(
[...tooltip.querySelectorAll('[data-testid*="category-item"]')].length,
@@ -465,7 +465,7 @@ describe('Transactions', () => {
const { container, getTransactions } = renderTransactions();
let input = await editField(container, 'category', 2);
- let tooltip = container.querySelector('[data-testid="tooltip"]');
+ let tooltip = container.querySelector('[data-testid="autocomplete"]');
// No item should be highlighted
let highlighted = tooltip.querySelector(
@@ -497,7 +497,7 @@ describe('Transactions', () => {
// The category field should still be editing
expectToBeEditingField(container, 'category', 2);
// No dropdown should be open
- expect(container.querySelector('[data-testid="tooltip"]')).toBe(null);
+ expect(container.querySelector('[data-testid="autocomplete"]')).toBe(null);
// Pressing enter should now move down
await userEvent.type(input, '[Enter]');
@@ -509,7 +509,7 @@ describe('Transactions', () => {
await editField(container, 'category', 2);
- let tooltip = container.querySelector('[data-testid="tooltip"]');
+ let tooltip = container.querySelector('[data-testid="autocomplete"]');
// Make sure none of the items are highlighted
let items = tooltip.querySelectorAll('[data-testid="category-item"]');
@@ -539,7 +539,7 @@ describe('Transactions', () => {
);
// It should still be editing the category
- tooltip = container.querySelector('[data-testid="tooltip"]');
+ tooltip = container.querySelector('[data-testid="autocomplete"]');
expect(tooltip).toBe(null);
expectToBeEditingField(container, 'category', 2);
});
@@ -549,7 +549,7 @@ describe('Transactions', () => {
let input = await editField(container, 'category', 2);
let oldCategory = getTransactions()[2].category;
- let tooltip = container.querySelector('[data-testid="tooltip"]');
+ let tooltip = container.querySelector('[data-testid="autocomplete"]');
let items = tooltip.querySelectorAll('[data-testid="category-item"]');
@@ -624,7 +624,7 @@ describe('Transactions', () => {
expect(input.value).toBe(oldValue);
// The tooltip be closed
- let tooltip = container.querySelector('[data-testid="tooltip"]');
+ let tooltip = container.querySelector('[data-testid="autocomplete"]');
expect(tooltip).toBeNull();
});
@@ -674,7 +674,7 @@ describe('Transactions', () => {
await editNewField(container, 'category');
let splitButton = document.body.querySelector(
- '[data-testid="tooltip"] [data-testid="split-transaction-button"]',
+ '[data-testid="autocomplete"] [data-testid="split-transaction-button"]',
);
await userEvent.click(splitButton);
await waitForAutocomplete();
@@ -795,7 +795,7 @@ describe('Transactions', () => {
}
let input = await editField(container, 'category', 0);
- let tooltip = container.querySelector('[data-testid="tooltip"]');
+ let tooltip = container.querySelector('[data-testid="autocomplete"]');
let splitButton = tooltip.querySelector(
'[data-testid="split-transaction-button"]',
);
@@ -911,7 +911,7 @@ describe('Transactions', () => {
const { container, getTransactions } = renderTransactions();
let input = await editField(container, 'category', 0);
- let tooltip = container.querySelector('[data-testid="tooltip"]');
+ let tooltip = container.querySelector('[data-testid="autocomplete"]');
let splitButton = tooltip.querySelector(
'[data-testid="split-transaction-button"',
);
diff --git a/packages/loot-core/src/shared/months.ts b/packages/loot-core/src/shared/months.ts
index da230dfe09..1233a7a331 100644
--- a/packages/loot-core/src/shared/months.ts
+++ b/packages/loot-core/src/shared/months.ts
@@ -98,6 +98,14 @@ export function currentMonth(): string {
}
}
+export function currentDate(): Date {
+ if (global.IS_TESTING || Platform.isPlaywright) {
+ return d.parse(currentDay(), 'yyyy-MM-dd', new Date());
+ }
+
+ return new Date();
+}
+
export function currentDay(): string {
if (global.IS_TESTING || Platform.isPlaywright) {
return '2017-01-01';
diff --git a/upcoming-release-notes/1605.md b/upcoming-release-notes/1605.md
new file mode 100644
index 0000000000..f08426cbbf
--- /dev/null
+++ b/upcoming-release-notes/1605.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MatissJanis]
+---
+
+VRT: increasing strictness and adding datepicker test