Skip to content

A local-first personal finance app

:electron: Playwright test to verify sync server starts (#7484)

Michael Clark4fa658b91e21
diff --git a/packages/desktop-client/e2e/page-models/bootstrap-page.ts b/packages/desktop-client/e2e/page-models/bootstrap-page.ts
new file mode 100644
index 0000000000..43c3df3fe0
--- /dev/null
+++ b/packages/desktop-client/e2e/page-models/bootstrap-page.ts
@@ -0,0 +1,13 @@
+import type { Page } from '@playwright/test';
+
+export class BootstrapPage {
+ readonly page: Page;
+
+ constructor(page: Page) {
+ this.page = page;
+ }
+
+ getHeading() {
+ return this.page.getByRole('heading');
+ }
+}
diff --git a/packages/desktop-client/e2e/page-models/configuration-page.ts b/packages/desktop-client/e2e/page-models/configuration-page.ts
index 01801e5620..5329fcdfa0 100644
--- a/packages/desktop-client/e2e/page-models/configuration-page.ts
+++ b/packages/desktop-client/e2e/page-models/configuration-page.ts
@@ -1,6 +1,7 @@
import type { Locator, Page } from '@playwright/test';
import { AccountPage } from './account-page';
+import { BootstrapPage } from './bootstrap-page';
import { BudgetPage } from './budget-page';
export class ConfigurationPage {
@@ -22,6 +23,12 @@ export class ConfigurationPage {
await this.page.getByRole('button', { name: "Don't use a server" }).click();
}
+ async clickOnStartSyncServer() {
+ await this.page.getByRole('button', { name: 'Start' }).click();
+ await this.page.waitForURL('**/bootstrap');
+ return new BootstrapPage(this.page);
+ }
+
async startFresh() {
await this.page.getByRole('button', { name: 'Start fresh' }).click();
diff --git a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-starts-the-sync-server-and-navigates-to-bootstrap-page-1-linux.png b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-starts-the-sync-server-and-navigates-to-bootstrap-page-1-linux.png
new file mode 100644
index 0000000000..46723845fa
Binary files /dev/null and b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-starts-the-sync-server-and-navigates-to-bootstrap-page-1-linux.png differ
diff --git a/packages/desktop-electron/e2e/onboarding.test.ts b/packages/desktop-electron/e2e/onboarding.test.ts
index 0a5157e467..cd4307d9a0 100644
--- a/packages/desktop-electron/e2e/onboarding.test.ts
+++ b/packages/desktop-electron/e2e/onboarding.test.ts
@@ -16,4 +16,13 @@ test.describe('Onboarding', () => {
await configurationPage.clickOnNoServer();
await expect(electronPage).toHaveScreenshot();
});
+
+ test('starts the sync server and navigates to bootstrap page', async ({
+ electronPage,
+ }) => {
+ const bootstrapPage = await configurationPage.clickOnStartSyncServer();
+
+ await expect(bootstrapPage.getHeading()).toHaveText('Welcome to Actual!');
+ await expect(electronPage).toHaveScreenshot();
+ });
});
diff --git a/packages/desktop-electron/index.ts b/packages/desktop-electron/index.ts
index 987cb26419..6cceb8f2ad 100644
--- a/packages/desktop-electron/index.ts
+++ b/packages/desktop-electron/index.ts
@@ -222,7 +222,7 @@ async function startSyncServer() {
const syncServerConfig = {
port: globalPrefs.syncServerConfig?.port || 5007,
- hostname: 'localhost',
+ hostname: '127.0.0.1',
ACTUAL_SERVER_DATA_DIR: path.resolve(
process.env.ACTUAL_DATA_DIR!,
'actual-server',
diff --git a/upcoming-release-notes/7484.md b/upcoming-release-notes/7484.md
new file mode 100644
index 0000000000..3a77978e6f
--- /dev/null
+++ b/upcoming-release-notes/7484.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MikesGlitch]
+---
+
+Add desktop app test to check sync server status