A local-first personal finance app
tweak testing framework for templates/automations (#8528)
Matt Fiddamana81408595c43
diff --git a/packages/desktop-client/e2e/budget.mobile.test.ts b/packages/desktop-client/e2e/budget.mobile.test.tsindex 4859bbd8b8..e2430a2ed2 100644--- a/packages/desktop-client/e2e/budget.mobile.test.ts+++ b/packages/desktop-client/e2e/budget.mobile.test.ts@@ -417,6 +417,13 @@ budgetTypes.forEach(budgetType => {test(`applies budget template`, async () => {const settingsPage = await navigation.goToSettingsPage();await settingsPage.enableExperimentalFeature('Goal templates');+ const uiToggle = page.getByRole('checkbox', {+ name: 'Budget automations UI',+ });+ await uiToggle.waitFor({ state: 'visible' });+ if (!(await uiToggle.isChecked())) {+ await uiToggle.click();+ }const budgetPage = await navigation.goToBudgetPage();@@ -425,10 +432,23 @@ budgetTypes.forEach(budgetType => {const amountToTemplate = 123;const categoryMenuModal = await budgetPage.openCategoryMenu(categoryName);- const editNotesModal = await categoryMenuModal.editNotes();- const templateNotes = `#template ${amountToTemplate}`;- await editNotesModal.updateNotes(templateNotes);- await editNotesModal.close();+ const automationsModal = await categoryMenuModal.editAutomations();+ await automationsModal+ .getByRole('button', { name: 'Add an automation' })+ .click();+ const amountField = automationsModal.locator('#amount-field');+ await amountField.fill(String(amountToTemplate));+ await amountField.press('Enter');+ await automationsModal+ .getByRole('spinbutton', { name: 'Priority' })+ .fill('0');+ await automationsModal+ .getByRole('button', { name: 'Back', exact: true })+ .click();+ await automationsModal+ .getByRole('button', { name: 'Save', exact: true })+ .click();+ await expect(automationsModal).toBeHidden();const budgetedButton =await budgetPage.getButtonForBudgeted(categoryName);@@ -440,8 +460,6 @@ budgetTypes.forEach(budgetType => {await expect(budgetedButton).toHaveText(amountToCurrency(amountToTemplate),);- const templateNotification = page.getByRole('alert').nth(1);- await expect(templateNotification).toContainText(templateNotes);await expect(page).toMatchThemeScreenshots();});diff --git a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-1-chromium-linux.png b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-1-chromium-linux.pngindex 84b52839f5..5d987af43a 100644Binary files a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-1-chromium-linux.png and b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-1-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-2-chromium-linux.png b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-2-chromium-linux.pngindex 5e6000de4b..8bd30b87e6 100644Binary files a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-2-chromium-linux.png and b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-2-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-3-chromium-linux.png b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-3-chromium-linux.pngindex 20cb3b1318..09b2868097 100644Binary files a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-3-chromium-linux.png and b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Envelope-applies-budget-template-3-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-1-chromium-linux.png b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-1-chromium-linux.pngindex 47290d11d2..46a69cd6f0 100644Binary files a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-1-chromium-linux.png and b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-1-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-2-chromium-linux.png b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-2-chromium-linux.pngindex 379739126d..85424b11d4 100644Binary files a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-2-chromium-linux.png and b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-2-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-3-chromium-linux.png b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-3-chromium-linux.pngindex 694eaf15ad..786799d3a8 100644Binary files a/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-3-chromium-linux.png and b/packages/desktop-client/e2e/budget.mobile.test.ts-snapshots/Mobile-Budget-Tracking-applies-budget-template-3-chromium-linux.png differdiff --git a/packages/desktop-client/src/components/budget/goals/automationExamples.ts b/packages/desktop-client/src/components/budget/goals/automationExamples.tsindex 46e0e3a08a..187229c1a7 100644--- a/packages/desktop-client/src/components/budget/goals/automationExamples.ts+++ b/packages/desktop-client/src/components/budget/goals/automationExamples.ts@@ -1,5 +1,6 @@import {addMonths,+ currentDate,dayFromDate,firstDayOfMonth,monthFromDate,@@ -43,7 +44,7 @@ export function getAutomationExamples(): AutomationExample[] {type: 'periodic',amount: 100,period: { period: 'month', amount: 1 },- starting: dayFromDate(firstDayOfMonth(new Date())),+ starting: dayFromDate(firstDayOfMonth(currentDate())),priority: DEFAULT_PRIORITY,},'fixed',@@ -59,7 +60,7 @@ export function getAutomationExamples(): AutomationExample[] {amount: 1200,// Always 12 months out so users in late-year months don't get a// target that's already passed.- month: addMonths(monthFromDate(new Date()), 12),+ month: addMonths(monthFromDate(currentDate()), 12),annual: true,repeat: 1,priority: DEFAULT_PRIORITY,diff --git a/packages/desktop-client/src/components/modals/BudgetAutomationsModal/AutomationEditorPane.tsx b/packages/desktop-client/src/components/modals/BudgetAutomationsModal/AutomationEditorPane.tsxindex 9301a913a0..3e3efe8e3c 100644--- a/packages/desktop-client/src/components/modals/BudgetAutomationsModal/AutomationEditorPane.tsx+++ b/packages/desktop-client/src/components/modals/BudgetAutomationsModal/AutomationEditorPane.tsx@@ -348,6 +348,7 @@ export function AutomationEditorPane({</Text><Inputtype="number"+ aria-label={t('Priority')}style={{ width: 64 }}value={String(state.template.priority)}onChangeValue={value => {diff --git a/packages/desktop-client/src/components/modals/BudgetAutomationsModal/migrateTemplatesToAutomations.ts b/packages/desktop-client/src/components/modals/BudgetAutomationsModal/migrateTemplatesToAutomations.tsindex 9ebf0e224f..13dc890f67 100644--- a/packages/desktop-client/src/components/modals/BudgetAutomationsModal/migrateTemplatesToAutomations.ts+++ b/packages/desktop-client/src/components/modals/BudgetAutomationsModal/migrateTemplatesToAutomations.ts@@ -1,4 +1,8 @@-import { dayFromDate, firstDayOfMonth } from '@actual-app/core/shared/months';+import {+ currentDate,+ dayFromDate,+ firstDayOfMonth,+} from '@actual-app/core/shared/months';import type { ScheduleEntity } from '@actual-app/core/types/models';import type {ScheduleTemplate,@@ -129,7 +133,7 @@ export function migrateTemplatesToAutomations(type: 'periodic',amount: contribution,period: { period: 'month', amount: 1 },- starting: dayFromDate(firstDayOfMonth(new Date())),+ starting: dayFromDate(firstDayOfMonth(currentDate())),directive: 'template',priority: template.priority,...(description ? { description } : {}),diff --git a/upcoming-release-notes/automations-ui-prep.md b/upcoming-release-notes/automations-ui-prep.mdnew file mode 100644index 0000000000..457007a325--- /dev/null+++ b/upcoming-release-notes/automations-ui-prep.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [matt-fidd]+---++Tweak testing framework for templates/automations