Skip to content

A local-first personal finance app

[AI] Fix timing-dependent flakiness in budget automations modal and notes tooltip test (#8993)

Yury Semikhatsky7f74953a5422
diff --git a/packages/desktop-client/e2e/transactions.test.ts b/packages/desktop-client/e2e/transactions.test.ts
index 1495fcfdaf..95b1e12892 100644
--- a/packages/desktop-client/e2e/transactions.test.ts
+++ b/packages/desktop-client/e2e/transactions.test.ts
@@ -304,8 +304,13 @@ test.describe('Transactions', () => {
notes: 'short note',
});
- const truncatedNotes = accountPage.getNthTransaction(1).notes;
- const shortNotes = accountPage.getNthTransaction(0).notes;
+ const truncatedTransaction = accountPage.getNthTransaction(1);
+ const shortTransaction = accountPage.getNthTransaction(0);
+ await expect(truncatedTransaction.payee).toHaveText('Home Depot');
+ await expect(shortTransaction.payee).toHaveText('Kroger');
+
+ const truncatedNotes = truncatedTransaction.notes;
+ const shortNotes = shortTransaction.notes;
// A short note that fits in the column never shows a tooltip, even
// after waiting past the tooltip's hover delay.
diff --git a/packages/desktop-client/src/components/modals/BudgetAutomationsModal/BudgetAutomationsModal.tsx b/packages/desktop-client/src/components/modals/BudgetAutomationsModal/BudgetAutomationsModal.tsx
index f2c0bf887c..cd60c2adfd 100644
--- a/packages/desktop-client/src/components/modals/BudgetAutomationsModal/BudgetAutomationsModal.tsx
+++ b/packages/desktop-client/src/components/modals/BudgetAutomationsModal/BudgetAutomationsModal.tsx
@@ -1,4 +1,4 @@
-import { useState } from 'react';
+import { useCallback, useMemo, useState } from 'react';
import { useResponsive } from '@actual-app/components/hooks/useResponsive';
import { AnimatedLoading } from '@actual-app/components/icons/AnimatedLoading';
@@ -39,9 +39,13 @@ export function BudgetAutomationsModal({
);
const effectiveMonth = month ?? currentMonth();
- const onLoaded = (result: Record<string, Template[]>) => {
- setParsedTemplates(result[categoryId] ?? []);
- };
+ const schedulesQuery = useMemo(() => q('schedules').select('*'), []);
+ const onLoaded = useCallback(
+ (result: Record<string, Template[]>) => {
+ setParsedTemplates(result[categoryId] ?? []);
+ },
+ [categoryId],
+ );
const { data: currentCategory } = useCategory(categoryId);
// default to 'ui' while the category is still resolving so we don't fire a
@@ -58,7 +62,7 @@ export function BudgetAutomationsModal({
});
const { schedules, isLoading: schedulesLoading } = useSchedules({
- query: q('schedules').select('*'),
+ query: schedulesQuery,
});
const categories = useBudgetAutomationCategories();
diff --git a/upcoming-release-notes/stabilize-e2e-timing.md b/upcoming-release-notes/stabilize-e2e-timing.md
new file mode 100644
index 0000000000..096e7bead5
--- /dev/null
+++ b/upcoming-release-notes/stabilize-e2e-timing.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [yury-s]
+---
+
+Fix timing-dependent flakiness in the budget automations modal and the transaction notes tooltip e2e test