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 0000000000000000000000000000000000000000..493160b55907ff8491887815f805795907761270 --- /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 00933b4699a892c9758a4958bf86ec3da4d8f59c..d6f6705268ae6ebe40374e3e17b7916ac6cc426b 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 1dc4b88047a0ae7328618b5ad08d471ad9fa5773..dc052e0698f8ac30963eff320e1fc45ec3039145 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 0000000000000000000000000000000000000000..e7583e1f79bb42339bde2c6811a90258a630dec8 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 0000000000000000000000000000000000000000..0b8a148c38411304cf15b4aa519c5201fc276651 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 0000000000000000000000000000000000000000..d1323d505ec85e53d59b0356dc7b663c9dde4ace 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 0000000000000000000000000000000000000000..4b716b2c6e429d7df38ae20210a826b4e1c44566 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 0000000000000000000000000000000000000000..b96890c51ee25d5d0a9469da0ff8cc5111714079 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 0000000000000000000000000000000000000000..4492d7a45e8e8c3f3e78b49e482f814700dc31e5 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 0000000000000000000000000000000000000000..0542f1345f6bfae194f7ba848f289749412b943a 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 0000000000000000000000000000000000000000..ca61d3446e74bfaca85d5e34f74cd34813aa2bbd 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 0000000000000000000000000000000000000000..605ea6845c4b9c4fa227d8a36b354b3ba424376e 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 0000000000000000000000000000000000000000..36533ee8584f85d8c42f17e710c597461cba0202 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 0000000000000000000000000000000000000000..9444c4a6506edeac7c638d485cd1e630d4e21ec6 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 0000000000000000000000000000000000000000..ad263db1c29921aac684bd86cf6784455069dede 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 0000000000000000000000000000000000000000..9e571511b6d2aa6db1a8c2a169728a29571db439 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 0000000000000000000000000000000000000000..11ce2c8377931f141ea04ddd7041a98bdb37f7cc 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 0000000000000000000000000000000000000000..051ddc64d52a7e09bf239dd76449af937c08fb5e 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 0000000000000000000000000000000000000000..c7f9ded996e8effacd3be9f01f77b74dbd4106e0 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 0000000000000000000000000000000000000000..af5816051705081c53155f20018dd9c90c485d15 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 0000000000000000000000000000000000000000..9be2b3a92c5cab2926d8129cc175f221c5efa782 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 0000000000000000000000000000000000000000..088bffbb80af67d3929391f0ca420d8f6608dbb3 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 0000000000000000000000000000000000000000..6a128879d50e4903d16e6c15a3ca157216af3006 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 0000000000000000000000000000000000000000..81f6ea2264f57293b9eb7fbfb84362c7b98c6430 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 0000000000000000000000000000000000000000..4e1278d1d5f8b122f2db9af9cf84cb6e8c5c5ebd 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 0000000000000000000000000000000000000000..795961cbb23e4026d3e23b146e0ab8dd3cfdc63e 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 0000000000000000000000000000000000000000..d9639fb249e48b5afafcb85d2ef3ef0217e649f4 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 9502d24a139c5cd89f454111cd5cc4f5396862c0..5b0120f63b6b74b636c59e9c450b4f3103bf2a9c 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 0000000000000000000000000000000000000000..d8686ab1bd727c43b7a417441008af7c280d74af --- /dev/null +++ b/upcoming-release-notes/3493.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MatissJanis] +--- + +Custom reports: added e2e tests to improve stability.