mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 12:43:09 -05:00
* Show activity changes * notes * adjust filter loading * switch back * adjust test * lint fix * budget test * lint fix * Filtered Balance * flicker fix * VRT updates * remove test variables * default category * categoryId separated
68 lines
2.2 KiB
JavaScript
68 lines
2.2 KiB
JavaScript
import { test, expect } from '@playwright/test';
|
|
|
|
import { ConfigurationPage } from './page-models/configuration-page';
|
|
|
|
test.describe('Budget', () => {
|
|
let page;
|
|
let configurationPage;
|
|
let budgetPage;
|
|
|
|
test.beforeAll(async ({ browser }) => {
|
|
page = await browser.newPage();
|
|
configurationPage = new ConfigurationPage(page);
|
|
|
|
await page.goto('/');
|
|
budgetPage = await configurationPage.createTestFile();
|
|
|
|
// Move mouse to corner of the screen;
|
|
// sometimes the mouse hovers on a budget element thus rendering an input box
|
|
// and this breaks screenshot tests
|
|
await page.mouse.move(0, 0);
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
await page.close();
|
|
});
|
|
|
|
test('renders the summary information: available funds, overspent, budgeted and for next month', async () => {
|
|
const summary = budgetPage.budgetSummary.first();
|
|
|
|
await expect(summary.getByText('Available Funds')).toBeVisible({
|
|
timeout: 10000,
|
|
});
|
|
await expect(summary.getByText(/^Overspent in /)).toBeVisible();
|
|
await expect(summary.getByText('Budgeted')).toBeVisible();
|
|
await expect(summary.getByText('For Next Month')).toBeVisible();
|
|
await expect(page).toMatchThemeScreenshots();
|
|
});
|
|
|
|
test('transfer funds to another category', async () => {
|
|
const currentFundsA = await budgetPage.getBalanceForRow(1);
|
|
const currentFundsB = await budgetPage.getBalanceForRow(2);
|
|
|
|
await budgetPage.transferAllBalance(1, 2);
|
|
await page.waitForTimeout(1000);
|
|
|
|
expect(await budgetPage.getBalanceForRow(2)).toEqual(
|
|
currentFundsA + currentFundsB,
|
|
);
|
|
await expect(page).toMatchThemeScreenshots();
|
|
});
|
|
|
|
test('budget table is rendered', async () => {
|
|
await expect(budgetPage.budgetTable).toBeVisible();
|
|
expect(await budgetPage.getTableTotals()).toEqual({
|
|
budgeted: expect.any(Number),
|
|
spent: expect.any(Number),
|
|
balance: expect.any(Number),
|
|
});
|
|
});
|
|
|
|
test('clicking on spent amounts opens a transaction page', async () => {
|
|
const accountPage = await budgetPage.clickOnSpentAmountForRow(1);
|
|
expect(page.url()).toContain('/accounts');
|
|
expect(await accountPage.accountName.textContent()).toMatch('All Accounts');
|
|
await page.getByRole('button', { name: 'Back' }).click();
|
|
});
|
|
});
|