Skip to content

A local-first personal finance app

:test_tube: (tests) adding custom report e2e tests (#3493)

Matiss Janis Aboltins48cdffbc03c0
diff --git a/packages/desktop-client/e2e/page-models/custom-report-page.js b/packages/desktop-client/e2e/page-models/custom-report-page.js
new file mode 100644
index 0000000000..493160b559
--- /dev/null
+++ b/packages/desktop-client/e2e/page-models/custom-report-page.js
@@ -0,0 +1,33 @@
+export class CustomReportPage {
+ constructor(page) {
+ this.page = page;
+ this.pageContent = page.getByTestId('reports-page');
+
+ this.showLegendButton = this.pageContent.getByRole('button', {
+ name: 'Show Legend',
+ });
+ this.showSummaryButton = this.pageContent.getByRole('button', {
+ name: 'Show Summary',
+ });
+ this.showLabelsButton = this.pageContent.getByRole('button', {
+ name: 'Show Labels',
+ });
+ }
+
+ async selectViz(vizName) {
+ await this.pageContent.getByRole('button', { name: vizName }).click();
+ }
+
+ async selectMode(mode) {
+ switch (mode) {
+ case 'total':
+ await this.pageContent.getByRole('button', { name: 'Total' }).click();
+ break;
+ case 'time':
+ await this.pageContent.getByRole('button', { name: 'Time' }).click();
+ break;
+ default:
+ throw new Error(`Unrecognized mode: ${mode}`);
+ }
+ }
+}
diff --git a/packages/desktop-client/e2e/page-models/reports-page.js b/packages/desktop-client/e2e/page-models/reports-page.js
index 00933b4699..d6f6705268 100644
--- a/packages/desktop-client/e2e/page-models/reports-page.js
+++ b/packages/desktop-client/e2e/page-models/reports-page.js
@@ -1,3 +1,5 @@
+import { CustomReportPage } from './custom-report-page';
+
export class ReportsPage {
constructor(page) {
this.page = page;
@@ -18,6 +20,13 @@ export class ReportsPage {
return new ReportsPage(this.page);
}
+ async goToCustomReportPage() {
+ await this.pageContent
+ .getByRole('button', { name: 'Create new custom report' })
+ .click();
+ return new CustomReportPage(this.page);
+ }
+
async getAvailableReportList() {
return this.pageContent
.getByRole('button')
diff --git a/packages/desktop-client/e2e/reports.test.js b/packages/desktop-client/e2e/reports.test.js
index 1dc4b88047..dc052e0698 100644
--- a/packages/desktop-client/e2e/reports.test.js
+++ b/packages/desktop-client/e2e/reports.test.js
@@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test';
import { ConfigurationPage } from './page-models/configuration-page';
import { Navigation } from './page-models/navigation';
-test.describe('Reports', () => {
+test.describe.parallel('Reports', () => {
let page;
let navigation;
let reportsPage;
@@ -43,4 +43,66 @@ test.describe('Reports', () => {
await reportsPage.goToCashFlowPage();
await expect(page).toMatchThemeScreenshots();
});
+
+ test.describe.parallel('custom reports', () => {
+ let customReportPage;
+
+ test.beforeEach(async () => {
+ customReportPage = await reportsPage.goToCustomReportPage();
+ });
+
+ test('Switches to Data Table and checks the visuals', async () => {
+ await customReportPage.selectMode('time');
+ await customReportPage.selectViz('Data Table');
+ await expect(page).toMatchThemeScreenshots();
+ });
+
+ test('Switches to Bar Graph and checks the visuals', async () => {
+ await customReportPage.selectMode('time');
+ await customReportPage.selectViz('Bar Graph');
+ await expect(page).toMatchThemeScreenshots();
+ });
+
+ test('Switches to Line Graph and checks the visuals', async () => {
+ await customReportPage.selectMode('time');
+ await customReportPage.selectViz('Line Graph');
+ await expect(page).toMatchThemeScreenshots();
+ });
+
+ test('Switches to Area Graph and checks the visuals', async () => {
+ await customReportPage.selectMode('total');
+ await customReportPage.selectViz('Area Graph');
+ await expect(page).toMatchThemeScreenshots();
+ });
+
+ test('Switches to Donut Graph and checks the visuals', async () => {
+ await customReportPage.selectMode('total');
+ await customReportPage.selectViz('Donut Graph');
+ await expect(page).toMatchThemeScreenshots();
+ });
+
+ test('Validates that "show legend" button shows the legend side-bar', async () => {
+ await customReportPage.selectViz('Bar Graph');
+ await customReportPage.showLegendButton.click();
+ await expect(page).toMatchThemeScreenshots();
+
+ await customReportPage.showLegendButton.click();
+ });
+
+ test('Validates that "show summary" button shows the summary', async () => {
+ await customReportPage.selectViz('Bar Graph');
+ await customReportPage.showSummaryButton.click();
+ await expect(page).toMatchThemeScreenshots();
+
+ await customReportPage.showSummaryButton.click();
+ });
+
+ test('Validates that "show labels" button shows the labels', async () => {
+ await customReportPage.selectViz('Bar Graph');
+ await customReportPage.showLabelsButton.click();
+ await expect(page).toMatchThemeScreenshots();
+
+ await customReportPage.showLabelsButton.click();
+ });
+ });
});
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-1-chromium-linux.png
new file mode 100644
index 0000000000..e7583e1f79
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-2-chromium-linux.png
new file mode 100644
index 0000000000..0b8a148c38
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-3-chromium-linux.png
new file mode 100644
index 0000000000..d1323d505e
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-1-chromium-linux.png
new file mode 100644
index 0000000000..4b716b2c6e
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-2-chromium-linux.png
new file mode 100644
index 0000000000..b96890c51e
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-3-chromium-linux.png
new file mode 100644
index 0000000000..4492d7a45e
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png
new file mode 100644
index 0000000000..0542f1345f
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-2-chromium-linux.png
new file mode 100644
index 0000000000..ca61d3446e
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-3-chromium-linux.png
new file mode 100644
index 0000000000..605ea6845c
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-1-chromium-linux.png
new file mode 100644
index 0000000000..36533ee858
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-2-chromium-linux.png
new file mode 100644
index 0000000000..9444c4a650
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-3-chromium-linux.png
new file mode 100644
index 0000000000..ad263db1c2
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-1-chromium-linux.png
new file mode 100644
index 0000000000..9e571511b6
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-2-chromium-linux.png
new file mode 100644
index 0000000000..11ce2c8377
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-3-chromium-linux.png
new file mode 100644
index 0000000000..051ddc64d5
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-1-chromium-linux.png
new file mode 100644
index 0000000000..c7f9ded996
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-2-chromium-linux.png
new file mode 100644
index 0000000000..af58160517
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-3-chromium-linux.png
new file mode 100644
index 0000000000..9be2b3a92c
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-1-chromium-linux.png
new file mode 100644
index 0000000000..088bffbb80
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-2-chromium-linux.png
new file mode 100644
index 0000000000..6a128879d5
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-3-chromium-linux.png
new file mode 100644
index 0000000000..81f6ea2264
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-1-chromium-linux.png
new file mode 100644
index 0000000000..4e1278d1d5
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-2-chromium-linux.png
new file mode 100644
index 0000000000..795961cbb2
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-3-chromium-linux.png
new file mode 100644
index 0000000000..d9639fb249
Binary files /dev/null and b/packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-3-chromium-linux.png differ
diff --git a/packages/desktop-client/src/components/reports/GraphButton.tsx b/packages/desktop-client/src/components/reports/GraphButton.tsx
index 9502d24a13..5b0120f63b 100644
--- a/packages/desktop-client/src/components/reports/GraphButton.tsx
+++ b/packages/desktop-client/src/components/reports/GraphButton.tsx
@@ -37,6 +37,7 @@ export const GraphButton = ({
}}
onPress={onSelect}
isDisabled={disabled}
+ aria-label={title}
>
{children}
</Button>
diff --git a/upcoming-release-notes/3493.md b/upcoming-release-notes/3493.md
new file mode 100644
index 0000000000..d8686ab1bd
--- /dev/null
+++ b/upcoming-release-notes/3493.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MatissJanis]
+---
+
+Custom reports: added e2e tests to improve stability.