Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotrk39 committed Feb 14, 2025
1 parent 0918c28 commit 6fd66dd
Showing 1 changed file with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { test } from '@playwright/test';
import { format } from 'date-fns';
import path from 'path';

import { SeedScript } from '@121-service/src/scripts/enum/seed-script.enum';
import NLRCProgramPV from '@121-service/src/seed-data/program/program-nlrc-pv.json';
import { seedIncludedRegistrations } from '@121-service/test/helpers/registration.helper';
import {
getAccessToken,
resetDB,
} from '@121-service/test/helpers/utility.helper';
import {
programIdPV,
registrationsPvExcel,
} from '@121-service/test/registrations/pagination/pagination-data';

import LoginPage from '@121-e2e/portalicious/pages/LoginPage';
import PaymentsPage from '@121-e2e/portalicious/pages/PaymentsPage';

test.beforeEach(async ({ page }) => {
await resetDB(SeedScript.nlrcMultiple);
const accessToken = await getAccessToken();
await seedIncludedRegistrations(
registrationsPvExcel,
programIdPV,
accessToken,
);

// Login
const loginPage = new LoginPage(page);
await page.goto('/');
await loginPage.login(
process.env.USERCONFIG_121_SERVICE_EMAIL_ADMIN,
process.env.USERCONFIG_121_SERVICE_PASSWORD_ADMIN,
);
});

test('[32303] [Excel fsp]: Import reconciliation data should work similar to import registration data', async ({
page,
}) => {
const paymentsPage = new PaymentsPage(page);

const projectTitle = NLRCProgramPV.titlePortal.en;
const lastPaymentDate = `${format(new Date(), 'dd/MM/yyyy')}`;
const reconciliationData = path.resolve(
__dirname,
'../../../test-registration-data/test-reconciliation-Excel-pv.csv',
);

await test.step('Navigate to Program payments', async () => {
await paymentsPage.selectProgram(projectTitle);

await paymentsPage.navigateToProgramPage('Payments');
});

await test.step('Start payment', async () => {
await paymentsPage.createPayment();
await paymentsPage.startPayment();
// Assert redirection to payment overview page
await page.waitForURL((url) =>
url.pathname.startsWith(`/en-GB/project/${programIdPV}/payments/1`),
);
// Assert payment overview page by payment date/ title
await paymentsPage.validatePaymentsDetailsPageByDate(lastPaymentDate);
});

await test.step('Upload payment reconciliation data via UI', async () => {
await paymentsPage.importReconciliationData(reconciliationData);
});
});

0 comments on commit 6fd66dd

Please sign in to comment.