:electron: Desktop app tests for exporting budget file (#7494)

* tests for exporting budget file

* release notes

* Update VRT screenshots

Auto-generated by VRT workflow

PR: #7494

* ditch the vrt, it's done in the cdesktop-client

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Michael Clark
2026-04-14 08:51:45 +01:00
committed by GitHub
parent 4bc8ec876a
commit bf513ad11c
3 changed files with 55 additions and 0 deletions

View File

@@ -19,6 +19,11 @@ export class ConfigurationPage {
return new BudgetPage(this.page);
}
async createDemoFile() {
await this.page.getByRole('button', { name: 'View demo' }).click();
return new BudgetPage(this.page);
}
async clickOnNoServer() {
await this.page.getByRole('button', { name: "Don't use a server" }).click();
}

View File

@@ -0,0 +1,44 @@
// oxlint-disable no-restricted-imports --fix me
import fs from 'node:fs/promises';
import path from 'node:path';
import { ConfigurationPage } from '@actual-app/web/e2e/page-models/configuration-page';
import { Navigation } from '@actual-app/web/e2e/page-models/navigation';
import type { SettingsPage } from '@actual-app/web/e2e/page-models/settings-page';
import { expect } from '@playwright/test';
import { test } from './fixtures';
test.describe('Settings', () => {
let navigation: Navigation;
let settingsPage: SettingsPage;
let configurationPage: ConfigurationPage;
test.beforeEach(async ({ electronPage }) => {
navigation = new Navigation(electronPage);
configurationPage = new ConfigurationPage(electronPage);
await configurationPage.clickOnNoServer();
await configurationPage.createDemoFile();
settingsPage = await navigation.goToSettingsPage();
});
test('downloads the export of the budget', async ({ electronApp }) => {
const exportPath = path.resolve('e2e/data/export-test.zip');
// Mock the native save dialog to auto-return a known path
await electronApp.evaluate(async ({ dialog }, filePath) => {
dialog.showSaveDialog = () =>
Promise.resolve({ canceled: false, filePath });
}, exportPath);
await settingsPage.exportData();
// Wait for the file to appear on disk and check it's not empty
await expect(async () => {
const stats = await fs.stat(exportPath);
expect(stats.size).toBeGreaterThan(0);
}).toPass({ timeout: 10_000 });
});
});

View File

@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MikesGlitch]
---
Added desktop app tests to ensure budget export saves to disk