Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 30 additions & 31 deletions e2etests/tests/anomalies-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { debugLog } from '../utils/debug-logging';
import { deleteAnomalyPolicy } from '../utils/teardown-utils';
import { expect, request } from '@playwright/test';
import { test } from '../fixtures/page.fixture';
import path from 'path';

test.describe('[MPT-14737] Anomalies Tests', { tag: ['@ui', '@anomalies'] }, () => {
test.use({ restoreSession: true });
Expand Down Expand Up @@ -279,10 +280,10 @@ test.describe('[MPT-14737] Mocked Anomalies Tests', { tag: ['@ui', '@anomalies']
});

test('[231435] Verify Chart export for each category by comparing downloaded png', async ({ anomaliesPage }) => {
test.fixme(process.env.CI === '1', 'Tests do not work in CI. It appears that the png comparison is unsupported on linux');
let actualPath = 'tests/downloads/anomaly-expenses-region-daily-chart-export.png';
let expectedPath = 'tests/expected/expected-anomaly-expenses-region-daily-chart-export.png';
let diffPath = 'tests/downloads/diff-anomaly-expenses-region-daily-chart-export.png';
// test.fixme(process.env.CI === '1', 'Tests do not work in CI. It appears that the png comparison is unsupported on linux');
let actualPath = path.resolve('tests', 'downloads', 'anomaly-expenses-region-daily-chart-export.png');
let expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-region-daily-chart-export.png');
let diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-region-daily-chart-export.png');
let match: boolean;

await anomaliesPage.page.clock.setFixedTime(new Date('2025-11-13T12:45:00Z'));
Expand All @@ -300,9 +301,9 @@ test.describe('[MPT-14737] Mocked Anomalies Tests', { tag: ['@ui', '@anomalies']
});

await test.step('Category: Resource type', async () => {
actualPath = 'tests/downloads/anomaly-expenses-resource-type-daily-chart-export.png';
expectedPath = 'tests/expected/expected-anomaly-expenses-resource-type-daily-chart-export.png';
diffPath = 'tests/downloads/diff-anomaly-expenses-resource-type-daily-chart-export.png';
actualPath = path.resolve('tests', 'downloads', 'anomaly-expenses-resource-type-daily-chart-export.png');
expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-resource-type-daily-chart-export.png');
diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-resource-type-daily-chart-export.png');

await anomaliesPage.selectCategorizeBy('Resource type');
await anomaliesPage.downloadFile(anomaliesPage.exportChartBtn, actualPath);
Expand All @@ -311,9 +312,9 @@ test.describe('[MPT-14737] Mocked Anomalies Tests', { tag: ['@ui', '@anomalies']
});

await test.step('Category: Data source', async () => {
actualPath = 'tests/downloads/anomaly-expenses-data-source-daily-chart-export.png';
expectedPath = 'tests/expected/expected-anomaly-expenses-data-source-daily-chart-export.png';
diffPath = 'tests/downloads/diff-anomaly-expenses-data-source-daily-chart-export.png';
actualPath = path.resolve('tests', 'downloads', 'anomaly-expenses-data-source-daily-chart-export.png');
expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-data-source-daily-chart-export.png');
diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-data-source-daily-chart-export.png');

await anomaliesPage.selectCategorizeBy('Data source');
await anomaliesPage.downloadFile(anomaliesPage.exportChartBtn, actualPath);
Expand All @@ -322,9 +323,9 @@ test.describe('[MPT-14737] Mocked Anomalies Tests', { tag: ['@ui', '@anomalies']
});

await test.step('Category: Owner', async () => {
actualPath = 'tests/downloads/anomaly-expenses-owner-daily-chart-export.png';
expectedPath = 'tests/expected/expected-anomaly-expenses-owner-daily-chart-export.png';
diffPath = 'tests/downloads/diff-anomaly-expenses-owner-daily-chart-export.png';
actualPath = path.resolve('tests', 'downloads/anomaly-expenses-owner-daily-chart-export.png');
expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-owner-daily-chart-export.png');
diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-owner-daily-chart-export.png');

await anomaliesPage.selectCategorizeBy('Owner');
await anomaliesPage.downloadFile(anomaliesPage.exportChartBtn, actualPath);
Expand All @@ -333,9 +334,9 @@ test.describe('[MPT-14737] Mocked Anomalies Tests', { tag: ['@ui', '@anomalies']
});

await test.step('Category: Pool', async () => {
actualPath = 'tests/downloads/anomaly-expenses-pool-daily-chart-export.png';
expectedPath = 'tests/expected/expected-anomaly-expenses-pool-daily-chart-export.png';
diffPath = 'tests/downloads/diff-anomaly-expenses-pool-daily-chart-export.png';
actualPath = path.resolve('tests', 'downloads', 'anomaly-expenses-pool-daily-chart-export.png');
expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-pool-daily-chart-export.png');
diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-pool-daily-chart-export.png');

await anomaliesPage.selectCategorizeBy('Pool');
await anomaliesPage.downloadFile(anomaliesPage.exportChartBtn, actualPath);
Expand All @@ -345,10 +346,10 @@ test.describe('[MPT-14737] Mocked Anomalies Tests', { tag: ['@ui', '@anomalies']
});

test('[231436] Verify Chart export for each expenses option by comparing downloaded png', async ({ anomaliesPage }) => {
test.fixme(process.env.CI === '1', 'Tests do not work in CI. It appears that the png comparison is unsupported on linux');
let actualPath = 'tests/downloads/anomaly-expenses-service-daily-chart-export.png';
let expectedPath = 'tests/expected/expected-anomaly-expenses-service-daily-chart-export.png';
let diffPath = 'tests/downloads/diff-anomaly-expenses-service-daily-chart-export.png';
// test.fixme(process.env.CI === '1', 'Tests do not work in CI. It appears that the png comparison is unsupported on linux');
let actualPath = path.resolve('tests', 'downloads', 'anomaly-expenses-service-daily-chart-export.png');
let expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-service-daily-chart-export.png');
let diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-service-daily-chart-export.png');
let match: boolean;

await anomaliesPage.page.clock.setFixedTime(new Date('2025-11-11T14:11:00Z'));
Expand All @@ -361,35 +362,34 @@ test.describe('[MPT-14737] Mocked Anomalies Tests', { tag: ['@ui', '@anomalies']
match = await comparePngImages(expectedPath, actualPath, diffPath);
expect.soft(match).toBe(true);

actualPath = 'tests/downloads/anomaly-expenses-service-daily-chart-no-legend-export.png';
expectedPath = 'tests/expected/expected-anomaly-expenses-service-daily-chart-no-legend-export.png';
diffPath = 'tests/downloads/diff-anomaly-expenses-service-daily-chart-no-legend-export.png';
actualPath = path.resolve('tests', 'downloads', 'anomaly-expenses-service-daily-chart-no-legend-export.png');
expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-service-daily-chart-no-legend-export.png');
diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-service-daily-chart-no-legend-export.png');

await anomaliesPage.clickShowLegend();
await anomaliesPage.downloadFile(anomaliesPage.exportChartBtn, actualPath);
match = await comparePngImages(expectedPath, actualPath, diffPath);
expect.soft(match).toBe(true);

actualPath = 'tests/downloads/anomaly-expenses-service-weekly-chart-export.png';
expectedPath = 'tests/expected/expected-anomaly-expenses-service-weekly-chart-export.png';
diffPath = 'tests/downloads/diff-anomaly-expenses-service-weekly-chart-export.png';
actualPath = path.resolve('tests', 'downloads', 'anomaly-expenses-service-weekly-chart-export.png');
expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-service-weekly-chart-export.png');
diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-service-weekly-chart-export.png');

await anomaliesPage.clickShowLegend();
await anomaliesPage.selectExpenses('Weekly');
await anomaliesPage.downloadFile(anomaliesPage.exportChartBtn, actualPath);
match = await comparePngImages(expectedPath, actualPath, diffPath);
expect.soft(match).toBe(true);

actualPath = 'tests/downloads/anomaly-expenses-service-monthly-chart-export.png';
expectedPath = 'tests/expected/expected-anomaly-expenses-service-monthly-chart-export.png';
diffPath = 'tests/downloads/diff-anomaly-expenses-service-monthly-chart-export.png';
actualPath = path.resolve('tests', 'downloads', 'anomaly-expenses-service-monthly-chart-export.png');
expectedPath = path.resolve('tests', 'expected', 'expected-anomaly-expenses-service-monthly-chart-export.png');
diffPath = path.resolve('tests', 'downloads', 'diff-anomaly-expenses-service-monthly-chart-export.png');

await anomaliesPage.selectExpenses('Monthly');
await anomaliesPage.downloadFile(anomaliesPage.exportChartBtn, actualPath);
match = await comparePngImages(expectedPath, actualPath, diffPath);
expect.soft(match).toBe(true);
});

test('[231439] Verify detected anomalies are displayed in the table correctly', async ({ anomaliesPage }) => {
await anomaliesPage.page.clock.setFixedTime(new Date('2025-11-11T14:11:00Z'));
await anomaliesPage.navigateToURL();
Expand Down Expand Up @@ -421,4 +421,3 @@ test.describe('[MPT-14737] Mocked Anomalies Tests', { tag: ['@ui', '@anomalies']
await expect(resourcesPage.heading).toBeVisible();
});
});

23 changes: 11 additions & 12 deletions e2etests/tests/expenses-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ExpensesDefaultResponse } from '../mocks/expenses-page-mocks';
import { comparePdfFiles } from '../utils/pdf-comparison';
import { isWithinRoundingDrift } from '../utils/custom-assertions';
import { getEnvironmentTestOrgName } from '../utils/environment-util';
import path from 'path';

test.describe('[MPT-12859] Expenses Page default view Tests', { tag: ['@ui', '@expenses'] }, () => {
test.describe.configure({ mode: 'default' });
Expand Down Expand Up @@ -94,7 +95,7 @@ test.describe('[MPT-12859] Expenses Page default view Tests', { tag: ['@ui', '@e
});

test.describe('[MPT-12859] Expenses page default view mocked tests', { tag: ['@ui', '@expenses'] }, () => {
test.fixme(process.env.CI === '1', 'Tests do not work in CI. It appears that the png comparison is unsupported on linux');
// test.fixme(process.env.CI === '1', 'Tests do not work in CI. It appears that the png comparison is unsupported on linux');
test.describe.configure({ mode: 'default' });

const apiInterceptions: InterceptionEntry[] = [
Expand All @@ -118,11 +119,10 @@ test.describe('[MPT-12859] Expenses page default view mocked tests', { tag: ['@u
await expensesPage.clickDailyBtnIfNotSelected();
});
});

test('[231183] Verify expenses chart download', { tag: '@p1' }, async ({ expensesPage }) => {
let actualPath = 'tests/downloads/expenses-page-daily-chart.pdf';
let expectedPath = 'tests/expected/expected-expenses-page-daily-chart.pdf';
let diffPath = 'tests/downloads/expenses-page-daily-chart-diff.png';
let actualPath = path.resolve('tests', 'downloads', 'expenses-page-daily-chart.pdf');
let expectedPath = path.resolve('tests', 'expected', 'expected-expenses-page-daily-chart.pdf');
let diffPath = path.resolve('tests', 'downloads', 'expenses-page-daily-chart-diff.png');
let match: boolean;

await test.step('Download the default chart', async () => {
Expand All @@ -132,9 +132,9 @@ test.describe('[MPT-12859] Expenses page default view mocked tests', { tag: ['@u
});

await test.step('Download weekly chart and compare', async () => {
actualPath = 'tests/downloads/expenses-page-weekly-chart.pdf';
expectedPath = 'tests/expected/expected-expenses-page-weekly-chart.pdf';
diffPath = 'tests/downloads/expenses-page-weekly-chart-diff.png';
actualPath = path.resolve('tests', 'downloads', 'expenses-page-weekly-chart.pdf');
expectedPath = path.resolve('tests', 'expected', 'expected-expenses-page-weekly-chart.pdf');
diffPath = path.resolve('tests', 'downloads', 'expenses-page-weekly-chart-diff.png');

await expensesPage.clickWeeklyBtn();
await expensesPage.downloadFile(expensesPage.downloadButton, actualPath);
Expand All @@ -143,9 +143,9 @@ test.describe('[MPT-12859] Expenses page default view mocked tests', { tag: ['@u
});

await test.step('Download monthly chart and compare', async () => {
actualPath = 'tests/downloads/expenses-page-monthly-chart.pdf';
expectedPath = 'tests/expected/expected-expenses-page-monthly-chart.pdf';
diffPath = 'tests/downloads/expenses-page-monthly-chart-diff.png';
actualPath = path.resolve('tests', 'downloads', 'expenses-page-monthly-chart.pdf');
expectedPath = path.resolve('tests', 'expected', 'expected-expenses-page-monthly-chart.pdf');
diffPath = path.resolve('tests', 'downloads', 'expenses-page-monthly-chart-diff.png');

await expensesPage.clickMonthlyBtn();
await expensesPage.downloadFile(expensesPage.downloadButton, actualPath);
Expand All @@ -154,7 +154,6 @@ test.describe('[MPT-12859] Expenses page default view mocked tests', { tag: ['@u
});
});
});

test.describe('[MPT-12859] Expenses Page Source Breakdown Tests', { tag: ['@ui', '@expenses'] }, () => {
test.describe.configure({ mode: 'default' });
test.use({ restoreSession: true });
Expand Down
Loading