Files
actual/packages/desktop-client/e2e/payees.test.ts
Alvaro Crespo 0d60da5ba9 Payees functional tests (#4766)
* add PayeesPage model for searching payees in e2e tests

* add navigation method to go to PayeesPage in e2e tests

* add e2e tests for Payees page

* update release notes

* Run prettier to fix lint

* clean imports

* fix imports

* Add snapshots for visual tests

* Remove unused import in payees test

* Update VRT

* Update 4766.md

Dummy commit

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com>
2025-05-05 09:26:17 -07:00

63 lines
2.0 KiB
TypeScript

import { type Page } from '@playwright/test';
import { expect, test } from './fixtures';
import { ConfigurationPage } from './page-models/configuration-page';
import { Navigation } from './page-models/navigation';
import { type PayeesPage } from './page-models/payees-page';
test.describe('Payees', () => {
let page: Page;
let configurationPage: ConfigurationPage;
let navigation: Navigation;
let payeesPage: PayeesPage;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
navigation = new Navigation(page);
configurationPage = new ConfigurationPage(page);
// Navigate to the root URL and create a fresh test file
await page.goto('/');
await configurationPage.createTestFile();
});
test.afterAll(async () => {
await page.close();
});
test.beforeEach(async () => {
// Navigate to the Payees page before each test
payeesPage = await navigation.goToPayeesPage();
});
test('checks the payees page visuals', async () => {
// This is a simple visual check to ensure the page loads
await expect(page).toMatchThemeScreenshots();
// Try searching for “Fast Internet” or “Home Depot,” etc.
await payeesPage.searchFor('Fast Internet');
// Screenshot check after searching
await expect(page).toMatchThemeScreenshots();
});
test('shows Fast Internet in the payee list', async () => {
await payeesPage.searchFor('Fast Internet');
await expect(page.getByText('Fast Internet')).toBeVisible();
});
test('shows "Create rule" text for a payee', async () => {
await payeesPage.searchFor('Deposit');
await expect(page.getByText('Create rule')).toBeVisible();
});
test('filters out unrelated payees', async () => {
await payeesPage.searchFor('asdfasdf-nonsense');
// Get the text 'No payees' matching the search from the page
const noPayeesMessage = page.locator('text=No payees').first();
// Assert it is visible
await expect(noPayeesMessage).toBeVisible();
});
});