Skip to content

Commit

Permalink
Move back to test buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Jan 8, 2024
1 parent 2266b88 commit 303d9f8
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 27 deletions.
4 changes: 2 additions & 2 deletions packages/desktop-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ Next, navigate to the root of your project folder, run the standartised docker c

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

# If you receive 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.40.1-jammy /bin/bash
docker run --rm --network host -v ${pwd}:/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.37.1-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
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/accounts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test.describe('Accounts', () => {
configurationPage = new ConfigurationPage(page);

await page.goto('/');
await configurationPage.createDemoFile();
await configurationPage.createTestFile();
});

test.afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/budget.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test.describe('Budget', () => {
configurationPage = new ConfigurationPage(page);

await page.goto('/');
budgetPage = await configurationPage.createDemoFile();
budgetPage = await configurationPage.createTestFile();

// Move mouse to corner of the screen;
// sometimes the mouse hovers on a budget element thus rendering an input box
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 @@ -18,7 +18,7 @@ test.describe('Mobile', () => {
height: 600,
});
await page.goto('/');
await configurationPage.createDemoFile();
await configurationPage.createTestFile();
});

test.afterEach(async () => {
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/desktop-client/e2e/page-models/configuration-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export class ConfigurationPage {
this.heading = page.getByRole('heading');
}

async createDemoFile() {
await this.page.getByRole('button', { name: 'Create demo file' }).click();
async createTestFile() {
await this.page.getByRole('button', { name: 'Create test file' }).click();
return new BudgetPage(this.page);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/reports.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe('Reports', () => {
configurationPage = new ConfigurationPage(page);

await page.goto('/');
await configurationPage.createDemoFile();
await configurationPage.createTestFile();
});

test.afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/rules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe('Rules', () => {
configurationPage = new ConfigurationPage(page);

await page.goto('/');
await configurationPage.createDemoFile();
await configurationPage.createTestFile();
});

test.afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/schedules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe('Schedules', () => {
configurationPage = new ConfigurationPage(page);

await page.goto('/');
await configurationPage.createDemoFile();
await configurationPage.createTestFile();
});

test.afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe('Settings', () => {
configurationPage = new ConfigurationPage(page);

await page.goto('/');
await configurationPage.createDemoFile();
await configurationPage.createTestFile();
});

test.afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/transactions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe('Transactions', () => {
configurationPage = new ConfigurationPage(page);

await page.goto('/');
await configurationPage.createDemoFile();
await configurationPage.createTestFile();
});

test.afterAll(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useRef } from 'react';
import { useSelector } from 'react-redux';

import * as actions from 'loot-core/src/client/actions';
import { isNonProductionEnvironment } from 'loot-core/src/shared/environment';

import { useActions } from '../../hooks/useActions';
import { AnimatedLoading } from '../../icons/AnimatedLoading';
Expand Down Expand Up @@ -337,14 +338,16 @@ export function BudgetList() {
Create new file
</Button>

{isNonProductionEnvironment() && (
<Button
type="primary"
isSubmit={false}
onClick={() => onCreate({ testMode: true })}
style={{ marginLeft: 15 }}
>
Create demo file
Create test file
</Button>
)}
</View>
</View>
);
Expand Down
23 changes: 14 additions & 9 deletions packages/desktop-client/src/components/manager/ConfigServer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React, { useState, useEffect } from 'react';

import { isElectron } from 'loot-core/src/shared/environment';
import {
isNonProductionEnvironment,
isElectron,
} from 'loot-core/src/shared/environment';

import { useActions } from '../../hooks/useActions';
import { useNavigate } from '../../hooks/useNavigate';
Expand Down Expand Up @@ -79,7 +82,7 @@ export function ConfigServer() {
navigate('/');
}

async function oncreateDemoFile() {
async function onCreateTestFile() {
await setServerUrl(null);
await createBudget({ testMode: true });
window.__navigate('/');
Expand Down Expand Up @@ -194,13 +197,15 @@ export function ConfigServer() {
Don’t use a server
</Button>

<Button
type="primary"
style={{ marginLeft: 15 }}
onClick={oncreateDemoFile}
>
Create demo file
</Button>
{isNonProductionEnvironment() && (
<Button
type="primary"
style={{ marginLeft: 15 }}
onClick={onCreateTestFile}
>
Create test file
</Button>
)}
</>
)}
</View>
Expand Down
21 changes: 16 additions & 5 deletions packages/desktop-client/src/components/manager/WelcomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export function WelcomeScreen() {
</Paragraph>
<Paragraph style={{ color: theme.pageTextLight }}>
Get started by importing an existing budget file from Actual or
another budgeting app, or start fresh with an empty budget. You can
always create or import another budget later.
another budgeting app, create a demo budget file, or start fresh with
an empty budget. You can always create or import another budget later.
</Paragraph>
</View>
<View
Expand All @@ -63,9 +63,20 @@ export function WelcomeScreen() {
}}
>
<Button onClick={() => pushModal('import')}>Import my budget</Button>
<Button type="primary" onClick={() => createBudget()}>
Start fresh
</Button>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
gap: 10,
}}
>
<Button onClick={() => createBudget({ testMode: true })}>
View demo
</Button>
<Button type="primary" onClick={() => createBudget()}>
Start fresh
</Button>
</View>
</View>
</View>
);
Expand Down

0 comments on commit 303d9f8

Please sign in to comment.