mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-30 10:14:53 -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.
179 lines
5.9 KiB
TypeScript
179 lines
5.9 KiB
TypeScript
import { type Page } from '@playwright/test';
|
|
|
|
import { expect, test } from './fixtures';
|
|
import { ConfigurationPage } from './page-models/configuration-page';
|
|
import { MobileNavigation } from './page-models/mobile-navigation';
|
|
|
|
test.describe('Mobile Transactions', () => {
|
|
let page: Page;
|
|
let navigation: MobileNavigation;
|
|
let configurationPage: ConfigurationPage;
|
|
|
|
test.beforeEach(async ({ browser }) => {
|
|
page = await browser.newPage();
|
|
navigation = new MobileNavigation(page);
|
|
configurationPage = new ConfigurationPage(page);
|
|
|
|
await page.setViewportSize({
|
|
width: 350,
|
|
height: 600,
|
|
});
|
|
await page.goto('/');
|
|
await configurationPage.createTestFile();
|
|
});
|
|
|
|
test.afterEach(async () => {
|
|
await page?.close();
|
|
});
|
|
|
|
test('creates a transaction via footer button', async () => {
|
|
const transactionEntryPage = await navigation.goToTransactionEntryPage();
|
|
await expect(page).toMatchThemeScreenshots();
|
|
|
|
await expect(transactionEntryPage.header).toHaveText('New Transaction');
|
|
|
|
await transactionEntryPage.amountField.fill('12.34');
|
|
// Click anywhere to cancel active edit.
|
|
await transactionEntryPage.header.click();
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('payee-field'),
|
|
'Kroger',
|
|
);
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('category-field'),
|
|
'Clothing',
|
|
);
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('account-field'),
|
|
'Ally Savings',
|
|
);
|
|
await expect(page).toMatchThemeScreenshots();
|
|
|
|
await transactionEntryPage.createTransaction();
|
|
await expect(page.getByLabel('Transaction list')).toHaveCount(0);
|
|
await expect(page).toMatchThemeScreenshots();
|
|
});
|
|
|
|
test('prefills a new transaction with URL search params', async () => {
|
|
const transactionEntryPage = await navigation.goToTransactionEntryPage();
|
|
await page.goto(
|
|
transactionEntryPage.page.url() +
|
|
'?category=Food&amount=23.42&account=HSBC&date=2025-10-31&cleared=true&payee=Kroger¬es=just+a+note',
|
|
);
|
|
// Note: no easy way to test cleared checkbox
|
|
await expect(page.getByTestId('transaction-form'))
|
|
.toMatchAriaSnapshot(`- text: Amount
|
|
- textbox
|
|
- text: 23.42 Payee
|
|
- button "Kroger" [disabled]
|
|
- text: Category
|
|
- button "Food" [disabled]
|
|
- button "Split" [disabled]:
|
|
- img
|
|
- text: Split
|
|
- text: Account
|
|
- button "HSBC" [disabled]
|
|
- text: Date
|
|
- textbox [disabled]: 2025-10-31
|
|
- text: Cleared Notes
|
|
- textbox [disabled]: just a note`);
|
|
});
|
|
|
|
test('creates a transaction from `/accounts/:id` page', async () => {
|
|
const accountsPage = await navigation.goToAccountsPage();
|
|
const accountPage = await accountsPage.openNthAccount(2);
|
|
const transactionEntryPage = await accountPage.clickCreateTransaction();
|
|
|
|
await expect(transactionEntryPage.header).toHaveText('New Transaction');
|
|
await expect(page).toMatchThemeScreenshots();
|
|
|
|
await transactionEntryPage.amountField.fill('12.34');
|
|
// Click anywhere to cancel active edit.
|
|
await transactionEntryPage.header.click();
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('payee-field'),
|
|
'Kroger',
|
|
);
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('category-field'),
|
|
'Clothing',
|
|
);
|
|
|
|
await transactionEntryPage.createTransaction();
|
|
|
|
await expect(accountPage.transactions.nth(0)).toHaveText(
|
|
'KrogerClothing-12.34',
|
|
);
|
|
});
|
|
|
|
test('creates an uncategorized transaction from `/categories/uncategorized` page', async () => {
|
|
// Create uncategorized transaction
|
|
let transactionEntryPage = await navigation.goToTransactionEntryPage();
|
|
await transactionEntryPage.amountField.fill('12.35');
|
|
// Click anywhere to cancel active edit.
|
|
await transactionEntryPage.header.click();
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('account-field'),
|
|
'Ally Savings',
|
|
);
|
|
await transactionEntryPage.createTransaction();
|
|
|
|
const uncategorizedPage = await navigation.goToUncategorizedPage();
|
|
transactionEntryPage = await uncategorizedPage.clickCreateTransaction();
|
|
|
|
await expect(transactionEntryPage.header).toHaveText('New Transaction');
|
|
|
|
await transactionEntryPage.amountField.fill('12.34');
|
|
// Click anywhere to cancel active edit.
|
|
await transactionEntryPage.header.click();
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('payee-field'),
|
|
'Kroger',
|
|
);
|
|
|
|
await transactionEntryPage.createTransaction();
|
|
|
|
await expect(uncategorizedPage.transactions.nth(0)).toHaveText(
|
|
'KrogerUncategorized-12.34',
|
|
);
|
|
await expect(page).toMatchThemeScreenshots();
|
|
});
|
|
|
|
test('creates a categorized transaction from `/categories/uncategorized` page', async () => {
|
|
// Create uncategorized transaction
|
|
let transactionEntryPage = await navigation.goToTransactionEntryPage();
|
|
await transactionEntryPage.amountField.fill('12.35');
|
|
// Click anywhere to cancel active edit.
|
|
await transactionEntryPage.header.click();
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('account-field'),
|
|
'Ally Savings',
|
|
);
|
|
await transactionEntryPage.createTransaction();
|
|
|
|
const uncategorizedPage = await navigation.goToUncategorizedPage();
|
|
transactionEntryPage = await uncategorizedPage.clickCreateTransaction();
|
|
|
|
await expect(transactionEntryPage.header).toHaveText('New Transaction');
|
|
|
|
await transactionEntryPage.amountField.fill('12.34');
|
|
// Click anywhere to cancel active edit.
|
|
await transactionEntryPage.header.click();
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('payee-field'),
|
|
'Kroger',
|
|
);
|
|
await transactionEntryPage.fillField(
|
|
page.getByTestId('category-field'),
|
|
'Clothing',
|
|
);
|
|
|
|
await transactionEntryPage.createTransaction();
|
|
|
|
await expect(uncategorizedPage.transactions.nth(0)).toHaveText(
|
|
'(No payee)Uncategorized-12.35',
|
|
);
|
|
await expect(page).toMatchThemeScreenshots();
|
|
});
|
|
});
|