Skip to content

Commit

Permalink
Feature branch for Intersolve Visa re-implementation (#5347)
Browse files Browse the repository at this point in the history
Intersolve Visa Re-implementation
  • Loading branch information
PeterSmallenbroek authored Nov 15, 2024
1 parent 2a103ee commit a18a1b1
Show file tree
Hide file tree
Showing 306 changed files with 11,112 additions and 5,510 deletions.
109 changes: 109 additions & 0 deletions e2e/pages/Payments/PaymentsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,115 @@ class PaymentsPage {
}
}

async verifyNonEurPaymentPopupValues({
numberOfPas,
defaultTransferValue,
defaultMaxTransferValue,
newTransferValue,
newMaxTransferValue,
paymentNumber = 1,
currency,
}: {
numberOfPas: number;
defaultTransferValue: number;
defaultMaxTransferValue: string;
newTransferValue?: number;
newMaxTransferValue?: number;
paymentNumber?: number;
currency: string;
}) {
// In case of UI delay page should refresh and do payment again with TableModule
const tableModule = new TableModule(this.page);
// --------------------------------------------------------------- //
const paIncludedLabel = includedLabel.replace(
'{{number}}',
numberOfPas.toString(),
);
let maximumAmountLabel = maxAmountLabel.replace(
'{{totalCost}}',
`${currency} ${defaultMaxTransferValue.toString()}`,
);

try {
await expect(this.page.getByText(paIncludedLabel)).toBeVisible();
await expect(this.page.getByText(maximumAmountLabel)).toBeVisible();
await expect(
this.paymentPopupMakePaymentAmountInput.locator('input'),
).toHaveValue(defaultTransferValue.toString());
if (
newTransferValue != defaultTransferValue &&
newTransferValue != undefined &&
newMaxTransferValue != undefined
) {
await this.updateTransferValue({
newTransferValue: newTransferValue.toString(),
});
maximumAmountLabel = maxAmountLabel.replace(
'{{totalCost}}',
`${currency} ${newMaxTransferValue.toString()}`,
);
const paIncluded = this.page.getByText(paIncludedLabel);
await expect(paIncluded).toBeVisible();
await paIncluded.click();
await expect(this.page.getByText(maximumAmountLabel)).toBeVisible();
}
} catch (error) {
await this.page.reload();
await tableModule.doPayment(paymentNumber);
await this.verifyNonEurPaymentPopupValues({
numberOfPas,
defaultTransferValue,
defaultMaxTransferValue,
newTransferValue,
currency,
});
}
}

async executeNonEurPayment({
numberOfPas,
defaultTransferValue,
defaultMaxTransferValue,
newTransferValue,
newMaxTransferValue,
currency,
}: {
numberOfPas: number;
defaultTransferValue: number;
defaultMaxTransferValue: string;
newTransferValue?: number;
newMaxTransferValue?: number;
currency: string;
}) {
await this.verifyNonEurPaymentPopupValues({
numberOfPas,
defaultTransferValue,
defaultMaxTransferValue,
newTransferValue,
newMaxTransferValue,
currency,
});

// execute payment
await this.paymentPopupMakePaymentButton.click();
// make sure the payment was successful
// need to split up the label to avoid issues with the <br> tag
const paSuccessfulLabel = succesfullLabel;
let paSuccessfulLabelChunk = paSuccessfulLabel.split('<br>')[0];
expect(paSuccessfulLabelChunk).toContain('{{nrPa}}');
paSuccessfulLabelChunk = paSuccessfulLabelChunk.replace(
'{{nrPa}}',
numberOfPas.toString(),
);
await expect(this.page.getByText(paSuccessfulLabelChunk)).toBeVisible();
// Close popup
await this.page
.getByRole('button', {
name: ok,
})
.click();
}

async updateTransferValue({
newTransferValue,
}: {
Expand Down
36 changes: 36 additions & 0 deletions e2e/pages/RegistrationDetails/RegistrationDetailsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,42 @@ class RegistrationDetails {
expect(await timeStampLocator.textContent()).toContain(date);
}

async validatePaymentDetails({
transferAmount,
fspName,
currency,
}: {
transferAmount: string;
fspName: string;
currency: string;
}) {
const fspPaymentActivityDetail =
this.tileInformationPlaceHolder.getByText('FSP: Safaricom');
const transferValueActivityDetail =
this.tileInformationPlaceHolder.getByText(
`Amount: ${currency}${transferAmount}`,
);

await this.tileDetailsDropdownIcon.nth(0).click();
expect(await fspPaymentActivityDetail.textContent()).toContain(fspName);
expect(await transferValueActivityDetail.textContent()).toContain(
transferAmount,
);
}

async validatePaymentErrorMessages({
messageContent,
}: {
messageContent: string;
}) {
const detailsButton = this.page.getByRole('button', { name: 'Details' });
const errorMessage = this.page.getByText('Error message: ');

await this.tileDetailsDropdownIcon.nth(0).click();
await detailsButton.click();
expect(await errorMessage.textContent()).toContain(messageContent);
}

async addNote(actions: string, addNote: string) {
await this.page.getByText(actions).click();
await this.page.getByText(addNote).click();
Expand Down
4 changes: 3 additions & 1 deletion e2e/pages/Table/TableModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const sendMessageAction =
englishTranslations.page.program['program-people-affected'].actions
.sendMessage;
const debitCardUsage =
englishTranslations.page.program['export-list']['card-balances']['btn-text'];
englishTranslations.page.program['export-list'][
'intersolve-visa-card-details'
]['btn-text'];
const paymentReport =
englishTranslations.page.program['export-list']['payment']['btn-text'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ test('[30579] All elements of Monitoring page display correct data for OCW', asy
shouldHaveIframe: true,
});
await projectMonitoring.assertValuesInMonitoringTab({
peopleIncluded: 4,
peopleRegistered: 4,
peopleIncluded: 5,
peopleRegistered: 5,
});
});
});
Expand Down
Loading

0 comments on commit a18a1b1

Please sign in to comment.