diff --git a/e2e/portalicious/tests/ViewPayment/ImportReconciliationDataForExcelFsp.spec.ts b/e2e/portalicious/tests/ViewPayment/ImportReconciliationDataForExcelFsp.spec.ts new file mode 100644 index 0000000000..acf49fea30 --- /dev/null +++ b/e2e/portalicious/tests/ViewPayment/ImportReconciliationDataForExcelFsp.spec.ts @@ -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); + }); +}); diff --git a/e2e/portalicious/tests/ViewPayment/RetryPaymentWithExcelFsp.spec.ts b/e2e/portalicious/tests/ViewPayment/RetryPaymentWithExcelFsp.spec.ts index fb94b76712..e493b29867 100644 --- a/e2e/portalicious/tests/ViewPayment/RetryPaymentWithExcelFsp.spec.ts +++ b/e2e/portalicious/tests/ViewPayment/RetryPaymentWithExcelFsp.spec.ts @@ -73,7 +73,7 @@ test('[32304] Retry payments should put failed transactions back in pending and await paymentsPage.validatePaymentsDetailsPageByDate(lastPaymentDate); }); - await test.step('Upload payment reconciliation data & Retry Payment', async () => { + await test.step('Upload payment reconciliation data', async () => { await paymentsPage.importReconciliationData(reconciliationData); });