mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-21 15:36:50 -05:00
* fix: use start:browser for playwright webServer to load correct browser-preload The playwright webServer was running 'yarn start' which doesn't set IS_GENERIC_BROWSER, causing Vite to not resolve .browser.js files. This resulted in browser-preload.js (empty electron stub) being loaded instead of browser-preload.browser.js, making window.Actual undefined. Changed to 'yarn start:browser' which properly sets IS_GENERIC_BROWSER=1 via the watch-browser script. * chore: update Playwright configuration and add blob-report to .gitignore - Modified Playwright config to use 'yarn start' with the correct working directory for local builds. - Added 'blob-report' to .gitignore to exclude it from version control. - Created release notes for running e2e tests against a local build instead of Netlify. * chore: update transaction test snapshots for split and transfer transactions - Updated binary snapshots for split and transfer test transactions in the e2e tests. - Ensured that the latest visual changes are reflected in the test suite for accurate regression testing. * chore: update transaction test snapshots for split and transfer transactions - Updated binary snapshots for split and transfer test transactions in the e2e tests to reflect recent changes. - Ensured visual consistency for accurate regression testing. * refactor: change test lifecycle hooks from beforeAll/afterAll to beforeEach/afterEach - Updated test files to use beforeEach and afterEach hooks for better isolation of tests. - This change ensures that each test starts with a fresh state, improving reliability and reducing side effects across tests. * chore: update e2e test workflow to disable translation downloads - Modified the e2e test workflow to include a new input parameter `download-translations` set to 'false' for the setup action. - This change aims to streamline the testing process by preventing unnecessary translation downloads during the test runs. * chore: update e2e test snapshots for settings page visuals - Updated binary snapshots for the settings page in e2e tests to reflect recent visual changes. - Ensured that the latest visual updates are accurately represented for regression testing. * fix: safely close page in e2e tests - Updated all e2e test files to use optional chaining when closing the page, ensuring that the close method is only called if the page is defined. - This change improves the robustness of the tests by preventing potential errors when the page object is not available.
70 lines
2.4 KiB
TypeScript
70 lines
2.4 KiB
TypeScript
import { type Page } from '@playwright/test';
|
|
|
|
import { expect, test } from './fixtures';
|
|
import { type BudgetPage } from './page-models/budget-page';
|
|
import { ConfigurationPage } from './page-models/configuration-page';
|
|
|
|
test.describe('Budget', () => {
|
|
let page: Page;
|
|
let configurationPage: ConfigurationPage;
|
|
let budgetPage: BudgetPage;
|
|
|
|
test.beforeEach(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.afterEach(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();
|
|
});
|
|
});
|