Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/actualbudget/actual into …
Browse files Browse the repository at this point in the history
…trivial-typescript-migrations
  • Loading branch information
jycrhl committed Apr 26, 2024
2 parents 301ca3b + f41d3f2 commit 540f85b
Show file tree
Hide file tree
Showing 343 changed files with 6,597 additions and 4,143 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/electron-master.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Electron
name: Electron Master

defaults:
run:
Expand All @@ -9,15 +9,18 @@ env:

on:
push:
branches:
- master
tags:
- v**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
# this is so the assets can be added to the release
permissions:
contents: write
strategy:
matrix:
os:
Expand All @@ -30,7 +33,19 @@ jobs:
- if: ${{ startsWith(matrix.os, 'windows') }}
run: pip.exe install setuptools
- if: ${{ ! startsWith(matrix.os, 'windows') }}
run: python3 -m pip install setuptools
run: |
mkdir .venv
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install setuptools
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get install flatpak -y
sudo apt-get install flatpak-builder -y
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install org.freedesktop.Sdk/x86_64/23.08 -y
sudo flatpak install org.freedesktop.Platform/x86_64/23.08 -y
sudo flatpak install org.electronjs.Electron2.BaseApp/x86_64/23.08 -y
- name: Set up environment
uses: ./.github/actions/setup
- name: Build Electron
Expand All @@ -48,3 +63,12 @@ jobs:
packages/desktop-electron/dist/*.dmg
packages/desktop-electron/dist/*.exe
packages/desktop-electron/dist/*.AppImage
packages/desktop-electron/dist/*.flatpak
- name: Add to Release
uses: softprops/action-gh-release@v2
with:
files: |
packages/desktop-electron/dist/*.dmg
packages/desktop-electron/dist/*.exe
packages/desktop-electron/dist/*.AppImage
packages/desktop-electron/dist/*.flatpak
15 changes: 14 additions & 1 deletion .github/workflows/electron-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@ jobs:
- if: ${{ startsWith(matrix.os, 'windows') }}
run: pip.exe install setuptools
- if: ${{ ! startsWith(matrix.os, 'windows') }}
run: python3 -m pip install setuptools
run: |
mkdir .venv
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install setuptools
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get install flatpak -y
sudo apt-get install flatpak-builder -y
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install org.freedesktop.Sdk/x86_64/23.08 -y
sudo flatpak install org.freedesktop.Platform/x86_64/23.08 -y
sudo flatpak install org.electronjs.Electron2.BaseApp/x86_64/23.08 -y
- name: Set up environment
uses: ./.github/actions/setup
- name: Build Electron
Expand All @@ -41,3 +53,4 @@ jobs:
packages/desktop-electron/dist/*.dmg
packages/desktop-electron/dist/*.exe
packages/desktop-electron/dist/*.AppImage
packages/desktop-electron/dist/*.flatpak
34 changes: 22 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# Sample Data
/data/*
!data/.gitkeep
/data2
Actual-*
**/xcuserdata/*
export-2020-01-10.csv

# Secrets
.secret-tokens

# MacOS
.DS_Store

# Logs
**/*.log

# JavaScript
node_modules
packages/api/dist
packages/api/@types
packages/crdt/dist
packages/desktop-electron/client-build
packages/desktop-electron/.electron-symbols
packages/desktop-electron/dist
packages/desktop-electron/loot-core
node_modules
.DS_Store
lerna-debug.log
Actual-*
.#*
**/xcuserdata/*
.secret-tokens
bundle.desktop.js
bundle.desktop.js.map
bundle.mobile.js
bundle.mobile.js.map
export-2020-01-10.csv
.idea
.vscode

**/*.log

# Yarn
.pnp.*
Expand All @@ -36,3 +40,9 @@ export-2020-01-10.csv

# VSCode
.vscode

# IntelliJ IDEA
.idea

# Misc
.#*
1 change: 1 addition & 0 deletions packages/api/tsconfig.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"outDir": "dist",
"declarationDir": "@types",
"paths": {
"loot-core/src/*": ["./loot-core/*"],
"loot-core/*": ["./@types/loot-core/*"],
}
},
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions packages/desktop-client/e2e/data/ynab5-demo-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -1704,8 +1704,8 @@
"payee_id": "",
"category_id": null,
"transfer_account_id": "bc1d862f-bab0-41c3-bd1e-6cee8c688e32",
"transfer_transaction_id": "213526fc-ba49-4790-8a96-cc2a50182728",
"matched_transaction_id": "",
"transfer_transaction_id": null,
"matched_transaction_id": null,
"import_id": null,
"import_payee_name": null,
"import_payee_name_original": null,
Expand All @@ -1729,7 +1729,7 @@
"transaction_id": "213526fc-ba49-4790-8a96-cc2a50182728",
"amount": -50000,
"memo": "split part b",
"payee_id": "2a20470a-634f-4efa-a7f6-f1c0b0bdda41",
"payee_id": "8d3017e0-2aa6-4fe2-b011-c53c9f147eb6",
"category_id": null,
"transfer_account_id": "125f339b-2a63-481e-84c0-f04d898905d2",
"deleted": false
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions packages/desktop-client/e2e/page-models/account-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ export class AccountPage {
}

async _fillTransactionFields(transactionRow, transaction) {
if (transaction.debit) {
await transactionRow.getByTestId('debit').click();
await this.page.keyboard.type(transaction.debit);
await this.page.keyboard.press('Tab');
}

if (transaction.credit) {
await transactionRow.getByTestId('credit').click();
await this.page.keyboard.type(transaction.credit);
await this.page.keyboard.press('Tab');
}

if (transaction.account) {
await transactionRow.getByTestId('account').click();
await this.page.keyboard.type(transaction.account);
Expand Down Expand Up @@ -169,18 +181,6 @@ export class AccountPage {
await this.page.keyboard.press('Tab');
}
}

if (transaction.debit) {
await transactionRow.getByTestId('debit').click();
await this.page.keyboard.type(transaction.debit);
await this.page.keyboard.press('Tab');
}

if (transaction.credit) {
await transactionRow.getByTestId('credit').click();
await this.page.keyboard.type(transaction.credit);
await this.page.keyboard.press('Tab');
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class MobileAccountPage {
this.page = page;

this.heading = page.getByRole('heading');
this.balance = page.getByTestId('account-balance');
this.balance = page.getByTestId('transactions-balance');
this.noTransactionsFoundError = page.getByText('No transactions');
this.searchBox = page.getByPlaceholder(/^Search/);
this.transactionList = page.getByLabel('transaction list');
Expand Down
21 changes: 21 additions & 0 deletions packages/desktop-client/e2e/page-models/rules-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,27 @@ export class RulesPage {
this.page.getByTestId('action-list'),
);
}

if (data.splits) {
if (data.splits.beforeSplitActions) {
await this._fillEditorFields(
data.splits.beforeSplitActions,
this.page.getByTestId('action-list'),
);
}

if (data.splits.splitActions) {
let idx = data.splits?.beforeSplitActions.length ?? 0;
for (const splitActions of data.splits.splitActions) {
await this.page.getByTestId('add-split-transactions').click();
await this._fillEditorFields(
splitActions,
this.page.getByTestId('action-list').nth(idx),
);
idx++;
}
}
}
}

async _fillEditorFields(data, rootElement) {
Expand Down
6 changes: 6 additions & 0 deletions packages/desktop-client/e2e/page-models/settings-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ export class SettingsPage {
async exportData() {
await this.page.getByRole('button', { name: 'Export data' }).click();
}

async enableExperimentalFeature(featureName) {
await this.page.getByTestId('advanced-settings').click();
await this.page.getByTestId('experimental-settings').click();
await this.page.getByLabel(featureName).check();
}
}
74 changes: 74 additions & 0 deletions packages/desktop-client/e2e/rules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,78 @@ test.describe('Rules', () => {
await expect(transaction.debit).toHaveText('12.34');
await expect(page).toMatchThemeScreenshots();
});

test('creates a split transaction rule and makes sure it is applied when creating a transaction', async () => {
const settingsPage = await navigation.goToSettingsPage();
await settingsPage.enableExperimentalFeature('splits in rules');

await expect(settingsPage.page.getByLabel('splits in rules')).toBeChecked();

rulesPage = await navigation.goToRulesPage();

await rulesPage.createRule({
conditions: [
{
field: 'payee',
op: 'is',
value: 'Ikea',
},
],
splits: {
beforeSplitActions: [
{
field: 'notes',
value: 'food / entertainment',
},
],
splitActions: [
[
{
field: 'a fixed percent',
value: '90',
},
{
field: 'category',
value: 'Entertainment',
},
],
[
{
field: 'an equal portion of the remainder',
},
{
field: 'category',
value: 'Food',
},
],
],
},
});

const accountPage = await navigation.goToAccountPage(
'Capital One Checking',
);

await accountPage.createSingleTransaction({
debit: '100.00',
payee: 'Ikea',
});

const transaction = accountPage.getNthTransaction(0);
await expect(transaction.payee).toHaveText('Ikea');
await expect(transaction.notes).toHaveText('food / entertainment');
await expect(transaction.category).toHaveText('Split');
await expect(transaction.debit).toHaveText('100.00');
await expect(page).toMatchThemeScreenshots();

const firstSplitTransaction = accountPage.getNthTransaction(1);
await expect(firstSplitTransaction.payee).toHaveText('Ikea');
await expect(firstSplitTransaction.debit).toHaveText('90.00');
await expect(firstSplitTransaction.category).toHaveText('Entertainment');

const secondSplitTransaction = accountPage.getNthTransaction(2);
await expect(secondSplitTransaction.payee).toHaveText('Ikea');
await expect(secondSplitTransaction.debit).toHaveText('10.00');
await expect(secondSplitTransaction.category).toHaveText('Food');
});
});
4 changes: 3 additions & 1 deletion packages/desktop-client/e2e/schedules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ test.describe('Schedules', () => {
});

test('creates a new schedule, posts the transaction and later completes it', async () => {
test.setTimeout(40000);

await schedulesPage.addNewSchedule({
payee: 'Home Depot',
account: 'HSBC',
Expand Down Expand Up @@ -79,7 +81,7 @@ test.describe('Schedules', () => {
await expect(page).toMatchThemeScreenshots();

// Schedules search shouldn't shrink with many schedules
for (let i = 0; i < 15; i++) {
for (let i = 0; i < 10; i++) {
await schedulesPage.addNewSchedule({
payee: 'Home Depot',
account: 'HSBC',
Expand Down
2 changes: 2 additions & 0 deletions packages/desktop-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@swc/plugin-react-remove-properties": "^1.5.108",
"@testing-library/react": "14.1.2",
"@testing-library/user-event": "14.5.2",
"@types/promise-retry": "^1.1.6",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.1",
"@types/react-modal": "^3.16.0",
Expand All @@ -43,6 +44,7 @@
"mdast-util-newline-to-break": "^2.0.0",
"memoize-one": "^6.0.0",
"pikaday": "1.8.2",
"promise-retry": "^2.0.1",
"react": "18.2.0",
"react-aria-components": "^1.1.1",
"react-dnd": "^16.0.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/desktop-client/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ expect.extend({
return darkmode;
}

// Switch to midnight theme and check
await locator.evaluate(() => window.Actual.setTheme('midnight'));
const midnightMode = await expect(locator).toHaveScreenshot(config);

// Assert on
if (midnightMode && !midnightMode.pass) {
return midnightMode;
}

// Switch back to lightmode
await locator.evaluate(() => window.Actual.setTheme('light'));
return {
Expand Down

0 comments on commit 540f85b

Please sign in to comment.