Skip to content

Commit

Permalink
🧪 (tests) adding custom report e2e tests (#3493)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis authored Sep 23, 2024
1 parent 37d201b commit 48cdffb
Show file tree
Hide file tree
Showing 29 changed files with 112 additions and 1 deletion.
33 changes: 33 additions & 0 deletions packages/desktop-client/e2e/page-models/custom-report-page.js
Original file line number Diff line number Diff line change
@@ -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}`);
}
}
}
9 changes: 9 additions & 0 deletions packages/desktop-client/e2e/page-models/reports-page.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CustomReportPage } from './custom-report-page';

export class ReportsPage {
constructor(page) {
this.page = page;
Expand All @@ -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')
Expand Down
64 changes: 63 additions & 1 deletion packages/desktop-client/e2e/reports.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const GraphButton = ({
}}
onPress={onSelect}
isDisabled={disabled}
aria-label={title}
>
{children}
</Button>
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3493.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MatissJanis]
---

Custom reports: added e2e tests to improve stability.

0 comments on commit 48cdffb

Please sign in to comment.