Files
actual/packages/desktop-client/e2e/onboarding.test.ts
Joel Jeremy Marquez 012cfd09ea [TypeScript] Convert playwright config and tests to TS (#4217)
* Convert playwright config and tests to TS

* Release notes

* Update VRT

* Dummy commit

* Delete js snapshots

* Fix call to expect

* Move extended expect and test to fixtures

* Fix wrong commit

* Fix typecheck error

* Update VRT

* Dummy commit to run GH actions

* Delete mobile budget test JS

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-01-22 09:00:10 -08:00

107 lines
3.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import path from 'path';
import { type Page } from '@playwright/test';
import { expect, test } from './fixtures';
import { AccountPage } from './page-models/account-page';
import { ConfigurationPage } from './page-models/configuration-page';
import { Navigation } from './page-models/navigation';
test.describe('Onboarding', () => {
let page: Page;
let navigation: Navigation;
let configurationPage: ConfigurationPage;
test.beforeEach(async ({ browser }) => {
page = await browser.newPage();
navigation = new Navigation(page);
configurationPage = new ConfigurationPage(page);
await page.goto('/');
});
test.afterEach(async () => {
await page.close();
});
test('checks the page visuals', async () => {
await expect(configurationPage.heading).toHaveText('Wheres the server?');
await expect(page).toMatchThemeScreenshots();
await configurationPage.clickOnNoServer();
await expect(page).toMatchThemeScreenshots();
});
test('creates a new budget file by importing YNAB4 budget', async () => {
await configurationPage.clickOnNoServer();
const budgetPage = await configurationPage.importBudget(
'YNAB4',
path.resolve(__dirname, 'data/ynab4-demo-budget.zip'),
);
await expect(budgetPage.budgetTable).toBeVisible({ timeout: 30000 });
const accountPage = await navigation.goToAccountPage(
'Account1 with Starting Balance',
);
await expect(accountPage.accountBalance).toHaveText('-400.00');
await navigation.goToAccountPage('Account2 no Starting Balance');
await expect(accountPage.accountBalance).toHaveText('2,607.00');
});
test('creates a new budget file by importing nYNAB budget', async () => {
await configurationPage.clickOnNoServer();
const budgetPage = await configurationPage.importBudget(
'nYNAB',
path.resolve(__dirname, 'data/ynab5-demo-budget.json'),
);
await expect(budgetPage.budgetTable).toBeVisible({ timeout: 30000 });
const accountPage = await navigation.goToAccountPage('Checking');
await expect(accountPage.accountBalance).toHaveText('2,600.00');
await navigation.goToAccountPage('Saving');
await expect(accountPage.accountBalance).toHaveText('250.00');
});
test('creates a new budget file by importing Actual budget', async () => {
await configurationPage.clickOnNoServer();
const budgetPage = await configurationPage.importBudget(
'Actual',
path.resolve(__dirname, 'data/actual-demo-budget.zip'),
);
await expect(budgetPage.budgetTable).toBeVisible({ timeout: 20_000 });
const accountPage = await navigation.goToAccountPage('Ally Savings');
await expect(accountPage.accountBalance).toHaveText('1,772.80');
await navigation.goToAccountPage('Roth IRA');
await expect(accountPage.accountBalance).toHaveText('2,745.81');
});
test('creates a new empty budget file', async () => {
await configurationPage.clickOnNoServer();
await configurationPage.startFresh();
const accountPage = new AccountPage(page);
await expect(accountPage.accountName).toBeVisible();
await expect(accountPage.accountName).toHaveText('All Accounts');
await expect(accountPage.accountBalance).toHaveText('0.00');
});
test('navigates back to start page by clicking on “no server” in an empty budget file', async () => {
await configurationPage.clickOnNoServer();
const accountPage = await configurationPage.startFresh();
await expect(accountPage.transactionTable).toBeVisible();
await navigation.clickOnNoServer();
await page.getByRole('button', { name: 'Start using a server' }).click();
await expect(configurationPage.heading).toHaveText('Wheres the server?');
});
});