Files
actual/packages/desktop-client/e2e/command-bar.test.ts
Michael Clark 3fafb898d0 🧪 Fix flaky VRT test and prevent downloading translations where not needed (#6429)
* this is a test

* [autofix.ci] apply automated fixes

* dot reporter for line by line

* [autofix.ci] apply automated fixes

* ok...

* list reporter

* Update VRT screenshots

Auto-generated by VRT workflow

PR: #6429

* fix couple of issues

* Revert "Update VRT screenshots"

This reverts commit 0124b13475.

* putting text change back

* release notes

* skipping translations on the desktop app

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-16 23:03:09 +00:00

80 lines
2.4 KiB
TypeScript

import { type Page } from '@playwright/test';
import { expect, test } from './fixtures';
import { ConfigurationPage } from './page-models/configuration-page';
test.describe('Command bar', () => {
let page: Page;
let configurationPage: ConfigurationPage;
test.beforeEach(async ({ browser }) => {
page = await browser.newPage();
configurationPage = new ConfigurationPage(page);
await page.goto('/');
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);
// ensure page is loaded
await expect(page.getByTestId('budget-table')).toBeVisible();
await expect(page.getByRole('button', { name: 'Add group' })).toBeVisible({
timeout: 10000,
});
});
test.afterEach(async () => {
await page?.close();
});
test('Check the command bar visuals', async () => {
// Open the command bar
await page.keyboard.press('ControlOrMeta+k');
const commandBar = page.getByRole('combobox', {
name: 'Command Bar',
});
await expect(commandBar).toBeVisible();
await expect(page).toMatchThemeScreenshots();
// Close the command bar
await page.keyboard.press('Escape');
await expect(commandBar).not.toBeVisible();
});
test('Check the command bar search works correctly', async () => {
await page.keyboard.press('ControlOrMeta+k');
const commandBar = page.getByRole('combobox', {
name: 'Command Bar',
});
await expect(commandBar).toBeVisible();
await expect(commandBar).toHaveValue('');
// Search and navigate to reports
await commandBar.fill('reports');
await page.keyboard.press('Enter');
await expect(page.getByTestId('reports-page')).toBeVisible();
await expect(page.getByText('Loading reports...')).not.toBeVisible({
timeout: 10000, // Wait for 10 seconds max for reports to load
}); // wait for screen to load
// Navigate to schedule page
await page.keyboard.press('ControlOrMeta+k');
await page.keyboard.press('ArrowDown');
await page.keyboard.press('ArrowDown'); // Select second suggestion - Schedules
await expect(page).toMatchThemeScreenshots();
await page.keyboard.press('Enter');
await expect(
page.getByRole('button', {
name: 'Add new schedule',
}),
).toBeVisible();
});
});