mirror of
https://github.com/actualbudget/actual.git
synced 2026-05-06 07:01:45 -05:00
: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:
@@ -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();
|
||||
}
|
||||
|
||||
44
packages/desktop-electron/e2e/settings.test.ts
Normal file
44
packages/desktop-electron/e2e/settings.test.ts
Normal 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 });
|
||||
});
|
||||
});
|
||||
6
upcoming-release-notes/7494.md
Normal file
6
upcoming-release-notes/7494.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Maintenance
|
||||
authors: [MikesGlitch]
|
||||
---
|
||||
|
||||
Added desktop app tests to ensure budget export saves to disk
|
||||
Reference in New Issue
Block a user