Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
th3c0d3br34ker authored Sep 15, 2023
2 parents fb5c87a + 3d29cfb commit 97f49d7
Show file tree
Hide file tree
Showing 92 changed files with 1,276 additions and 707 deletions.
43 changes: 1 addition & 42 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ module.exports = {
{
//This is temporary. We will remove these as dark theme gets ported
files: [
'./packages/desktop-client/public/index.html',
'./packages/desktop-client/src/components/BankSyncStatus.*',
'./packages/desktop-client/src/components/LoggedInUser.*',
'./packages/desktop-client/src/components/MobileWebMessage.*',
'./packages/desktop-client/src/components/NotesButton.*',
Expand All @@ -242,57 +240,18 @@ module.exports = {
'./packages/desktop-client/src/components/budget/SidebarCategory.*',
'./packages/desktop-client/src/components/budget/SidebarGroup.*',
'./packages/desktop-client/src/components/budget/constants.*',
'./packages/desktop-client/src/components/budget/misc.*',
'./packages/desktop-client/src/components/budget/report/BudgetSummary.*',
'./packages/desktop-client/src/components/budget/report/components.*',
'./packages/desktop-client/src/components/budget/rollover/BudgetSummary.*',
'./packages/desktop-client/src/components/budget/rollover/rollover-components.*',
'./packages/desktop-client/src/components/budget/util.*',
'./packages/desktop-client/src/components/common.*',
'./packages/desktop-client/src/components/common/Card.*',
'./packages/desktop-client/src/components/common/Label.*',
'./packages/desktop-client/src/components/common/View.*',
'./packages/desktop-client/src/components/common/ExternalLink.*',
'./packages/desktop-client/src/components/manager/BudgetList.*',
'./packages/desktop-client/src/components/manager/ConfigServer.*',
'./packages/desktop-client/src/components/manager/DeleteFile.*',
'./packages/desktop-client/src/components/manager/Import.*',
'./packages/desktop-client/src/components/manager/ImportActual.*',
'./packages/desktop-client/src/components/manager/ImportYNAB4.*',
'./packages/desktop-client/src/components/manager/ImportYNAB5.*',
'./packages/desktop-client/src/components/manager/WelcomeScreen.*',
'./packages/desktop-client/src/components/modals/BudgetSummary.*',
'./packages/desktop-client/src/components/modals/ConfirmCategoryDelete.*',
'./packages/desktop-client/src/components/modals/CreateEncryptionKey.*',
'./packages/desktop-client/src/components/modals/EditField.*',
'./packages/desktop-client/src/components/modals/FixEncryptionKey.*',
'./packages/desktop-client/src/components/modals/GoCardlessExternalMsg.*',
'./packages/desktop-client/src/components/modals/ImportTransactions.*',
'./packages/desktop-client/src/components/modals/LoadBackup.*',
'./packages/desktop-client/src/components/modals/PlaidExternalMsg.*',
'./packages/desktop-client/src/components/modals/SelectLinkedAccounts.*',
'./packages/desktop-client/src/components/payees/index.*',
'./packages/desktop-client/src/components/reports/CashFlow.*',
'./packages/desktop-client/src/components/reports/Change.*',
'./packages/desktop-client/src/components/reports/DateRange.*',
'./packages/desktop-client/src/components/reports/Header.*',
'./packages/desktop-client/src/components/reports/NetWorth.*',
'./packages/desktop-client/src/components/reports/Overview.*',
'./packages/desktop-client/src/components/reports/Tooltip.*',
'./packages/desktop-client/src/components/reports/chart-theme.*',
'./packages/desktop-client/src/components/reports/graphs/CashFlowGraph.*',
'./packages/desktop-client/src/components/reports/graphs/NetWorthGraph.*',
'./packages/desktop-client/src/components/settings/Encryption.*',
'./packages/desktop-client/src/components/settings/Experimental.*',
'./packages/desktop-client/src/components/settings/FixSplits.*',
'./packages/desktop-client/src/components/settings/Format.*',
'./packages/desktop-client/src/components/settings/Global.*',
'./packages/desktop-client/src/components/settings/UI.*',
'./packages/desktop-client/src/components/settings/index.*',
'./packages/desktop-client/src/components/transactions/MobileTransaction.*',
'./packages/desktop-client/src/components/transactions/TransactionsTable.*',
'./packages/desktop-client/src/components/util/AmountInput.*',
'./packages/desktop-client/src/components/util/DisplayId.*',
'./packages/desktop-client/src/components/util/LoadComponent.*',
'./packages/desktop-client/src/style/*',
],
rules: {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
api:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
analyze:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/electron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
build:
Expand Down
9 changes: 7 additions & 2 deletions packages/desktop-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,20 @@ First start the dev server:
```sh
HTTPS=true yarn start
```

Next, run the standartised docker container and launch the visual regression tests from within it.
Next, navigate to the root of your project folder, run the standartised docker container, and launch the visual regression tests from within it.

```sh
# Run docker container
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.37.0-jammy /bin/bash

# If you recieve an error such as "docker: invalid reference format", please instead use the following command:
docker run --rm --network host -v ${pwd}:/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.37.0-jammy /bin/bash

# Run the VRT tests: important - they MUST be ran against a HTTPS server
E2E_START_URL=https://192.168.0.178:3001 yarn vrt

# To update snapshots, use the following command:
E2E_START_URL=https://192.168.0.178:3001 yarn vrt --update-snapshots
```

#### Running against a remote server
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/mobile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ test.describe('Mobile', () => {

test('creates a transaction from `/accounts/:id` page', async () => {
const accountsPage = await navigation.goToAccountsPage();
const accountPage = await accountsPage.openNthAccount(1);
const accountPage = await accountsPage.openNthAccount(2);
const transactionEntryPage = await accountPage.clickCreateTransaction();

await expect(transactionEntryPage.header).toHaveText('New Transaction');
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 8 additions & 7 deletions packages/desktop-client/e2e/page-models/rules-page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export class RulesPage {
constructor(page) {
this.page = page;
this.searchBox = page.getByPlaceholder('Filter rules...');
}

/**
Expand All @@ -22,19 +23,19 @@ export class RulesPage {
* Retrieve the data for the nth-rule.
* 0-based index
*/
async getNthRule(index) {
getNthRule(index) {
const row = this.page.getByTestId('table').getByTestId('row').nth(index);

return {
conditions: await row
.getByTestId('conditions')
.evaluate(el => [...el.children].map(c => c.textContent)),
actions: await row
.getByTestId('actions')
.evaluate(el => [...el.children].map(c => c.textContent)),
conditions: row.getByTestId('conditions').locator(':scope > div'),
actions: row.getByTestId('actions').locator(':scope > div'),
};
}

async searchFor(text) {
await this.searchBox.fill(text);
}

async _fillRuleFields(data) {
if (data.conditionsOp) {
await this.page
Expand Down
12 changes: 6 additions & 6 deletions packages/desktop-client/e2e/page-models/schedules-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ export class SchedulesPage {
* Retrieve the data for the nth-schedule.
* 0-based index
*/
async getNthSchedule(index) {
getNthSchedule(index) {
const row = this.getNthScheduleRow(index);

return {
payee: await row.getByTestId('payee').textContent(),
account: await row.getByTestId('account').textContent(),
date: await row.getByTestId('date').textContent(),
status: await row.getByTestId('status').textContent(),
amount: await row.getByTestId('amount').textContent(),
payee: row.getByTestId('payee'),
account: row.getByTestId('account'),
date: row.getByTestId('date'),
status: row.getByTestId('status'),
amount: row.getByTestId('amount'),
};
}

Expand Down
11 changes: 6 additions & 5 deletions packages/desktop-client/e2e/rules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ test.describe('Rules', () => {
});

test('checks the page visuals', async () => {
await rulesPage.searchFor('Dominion');
await expect(page).toHaveScreenshot(screenshotConfig(page));
});

Expand All @@ -48,13 +49,13 @@ test.describe('Rules', () => {
],
});

expect(await rulesPage.getNthRule(0)).toMatchObject({
conditions: ['payee is Fast Internet'],
actions: ['set category to General'],
});
await rulesPage.searchFor('Fast Internet');
const rule = rulesPage.getNthRule(0);
await expect(rule.conditions).toHaveText(['payee is Fast Internet']);
await expect(rule.actions).toHaveText(['set category to General']);
await expect(page).toHaveScreenshot(screenshotConfig(page));

const accountPage = await navigation.goToAccountPage('Bank of America');
const accountPage = await navigation.goToAccountPage('HSBC');

await accountPage.createSingleTransaction({
payee: 'Fast Internet',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 21 additions & 26 deletions packages/desktop-client/e2e/schedules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,15 @@ test.describe('Schedules', () => {
amount: 25,
});

expect(await schedulesPage.getNthSchedule(0)).toMatchObject({
payee: 'Home Depot',
account: 'HSBC',
amount: '~25.00',
status: 'Due',
});
const schedule = schedulesPage.getNthSchedule(2);
await expect(schedule.payee).toHaveText('Home Depot');
await expect(schedule.account).toHaveText('HSBC');
await expect(schedule.amount).toHaveText('~25.00');
await expect(schedule.status).toHaveText('Due');
await expect(page).toHaveScreenshot(screenshotConfig(page));

await schedulesPage.postNthSchedule(0);
expect(await schedulesPage.getNthSchedule(0)).toMatchObject({
status: 'Paid',
});
await schedulesPage.postNthSchedule(2);
await expect(schedulesPage.getNthSchedule(2).status).toHaveText('Paid');
await expect(page).toHaveScreenshot(screenshotConfig(page));

// Go to transactions page
Expand All @@ -62,26 +59,24 @@ test.describe('Schedules', () => {

// go to rules page
const rulesPage = await navigation.goToRulesPage();
expect(await rulesPage.getNthRule(0)).toMatchObject({
// actions: ['link schedule Home Depot (2023-02-28)'],
actions: [
expect.stringMatching(
/^link schedule Home Depot \(\d{4}-\d{2}-\d{2}\)$/,
),
],
conditions: [
'payee is Home Depot',
'and account is HSBC',
expect.stringMatching(/^and date is approx Every month on the/),
'and amount is approx -25.00',
],
});
await rulesPage.searchFor('Home Depot');
const rule = rulesPage.getNthRule(0);
await expect(rule.actions).toHaveText([
'link schedule Home Depot (2017-01-01)',
]);
await expect(rule.conditions).toHaveText([
'payee is Home Depot',
'and account is HSBC',
'and date is approx Every month on the 1st',
'and amount is approx -25.00',
]);

// Go back to schedules page
await navigation.goToSchedulesPage();
await schedulesPage.completeNthSchedule(0);
expect(await schedulesPage.getNthScheduleRow(0)).toHaveText(
await schedulesPage.completeNthSchedule(2);
await expect(schedulesPage.getNthScheduleRow(4)).toHaveText(
'Show completed schedules',
);
await expect(page).toHaveScreenshot(screenshotConfig(page));
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions packages/desktop-client/src/components/BankSyncStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { useSelector } from 'react-redux';
import { useTransition, animated } from 'react-spring';

import { colors, styles } from '../style';
import { theme, styles } from '../style';

import AnimatedRefresh from './AnimatedRefresh';
import Text from './common/Text';
Expand Down Expand Up @@ -43,8 +43,8 @@ export default function BankSyncStatus() {
<View
style={{
borderRadius: 4,
backgroundColor: colors.b9,
color: colors.b1,
backgroundColor: theme.pillBackgroundSelected,
color: theme.pillTextSelected,
padding: '5px 13px',
flexDirection: 'row',
alignItems: 'center',
Expand All @@ -53,7 +53,7 @@ export default function BankSyncStatus() {
>
<AnimatedRefresh
animating={true}
iconStyle={{ color: colors.b1 }}
iconStyle={{ color: theme.pillTextSelected }}
/>
<Text>Syncing {item}</Text>
</View>
Expand Down
10 changes: 1 addition & 9 deletions packages/desktop-client/src/components/ManageRules.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import React, {
useState,
useEffect,
useRef,
useCallback,
useMemo,
} from 'react';
import React, { useState, useEffect, useCallback, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';

import { pushModal } from 'loot-core/src/client/actions/modals';
Expand Down Expand Up @@ -116,7 +110,6 @@ function ManageRulesContent({ isModal, payeeId, setLoading }) {
);
let selectedInst = useSelected('manage-rules', allRules, []);
let [hoveredRule, setHoveredRule] = useState(null);
let tableRef = useRef(null);

async function loadRules() {
setLoading(true);
Expand Down Expand Up @@ -283,7 +276,6 @@ function ManageRulesContent({ isModal, payeeId, setLoading }) {
<View style={{ flex: 1 }}>
<RulesHeader />
<SimpleTable
ref={tableRef}
data={filteredRules}
loadMore={loadMore}
// Hide the last border of the item in the table
Expand Down
4 changes: 1 addition & 3 deletions packages/desktop-client/src/components/PrivacyFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import React, {

import usePrivacyMode from 'loot-core/src/client/privacy';

import useFeatureFlag from '../hooks/useFeatureFlag';
import { useResponsive } from '../ResponsiveProvider';

import View from './common/View';
Expand Down Expand Up @@ -53,7 +52,6 @@ export default function PrivacyFilter({
children,
...props
}: PrivacyFilterProps) {
let privacyModeFeatureFlag = useFeatureFlag('privacyMode');
let privacyMode = usePrivacyMode();
// Limit mobile support for now.
let { isNarrowWidth } = useResponsive();
Expand All @@ -67,7 +65,7 @@ export default function PrivacyFilter({

let blurAmount = blurIntensity != null ? `${blurIntensity}px` : '3px';

return !privacyModeFeatureFlag || !activate ? (
return !activate ? (
<>{Children.toArray(children)}</>
) : (
<BlurredOverlay blurIntensity={blurAmount} {...props}>
Expand Down
3 changes: 1 addition & 2 deletions packages/desktop-client/src/components/Titlebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ export default function Titlebar({ style }) {
state => state.prefs.global.floatingSidebar,
);

let privacyModeFeatureFlag = useFeatureFlag('privacyMode');
let themesFlag = useFeatureFlag('themes');

return isNarrowWidth ? null : (
Expand Down Expand Up @@ -369,7 +368,7 @@ export default function Titlebar({ style }) {
<View style={{ flex: 1 }} />
<UncategorizedButton />
{themesFlag && <ThemeSelector />}
{privacyModeFeatureFlag && <PrivacyButton />}
<PrivacyButton />
{serverURL ? <SyncButton style={{ marginLeft: 10 }} /> : null}
<LoggedInUser style={{ marginLeft: 10 }} />
</View>
Expand Down
Loading

0 comments on commit 97f49d7

Please sign in to comment.