diff --git a/test-automation/pages/manage-eft-payments-page.js b/test-automation/pages/manage-eft-payments-page.js index 68eede36..cf6e21a4 100644 --- a/test-automation/pages/manage-eft-payments-page.js +++ b/test-automation/pages/manage-eft-payments-page.js @@ -31,6 +31,18 @@ export class ManageEFTPaymentsPage { this.selectAccountToLink = page.locator('[role="option"]') this.linkAccountButtonOnConfirmationPopup = page.getByText(' Link Account ') this.cancelPaymentButton = page.getByText(' Cancel Payment ') + this.initiateRefundButton = page.getByText(' Initiate Refund ') + this.issueACheckButton = page.getByText('Issue a cheque') + this.nextButton = page.getByText('Next') + this.refundAmountInput = page.locator('[data-test="refundAmount"]') + this.streetAddressInput = page.locator('[id="street-address-1"]') + this.firstAddressOption = page.getByText('1st-290 Dupuis St') + this.emailInput = page.locator('[data-test="email"]') + this.entityNameInput = page.locator('[data-test="entityName"]') + this.refundReasonInput = page.locator('[data-test="staffComment"]') + this.submitRefundRequestButton = page.getByText('Submit Refund Request') + this.declineButton = page.getByText(' Decline ') + this.declineBtnOnConfirmationPopup = page.locator('[data-test="btn-confirm-confirmation-dialog"]') } async accountUnlinkAndLink() { @@ -55,4 +67,32 @@ export class ManageEFTPaymentsPage { await this.confirmButton.click({timeout: 60000}) await this.page.waitForTimeout(2000) } + + async initiateRefund() { + await this.manageEFTPaymentsButton.click({timeout: 60000}) + await this.page.waitForTimeout(8000) + await this.bankShortNameFilterInput.first().pressSequentially('KENLI013') + await this.page.waitForTimeout(5000) // wait for filter to apply + await this.viewDetailsButton.click({timeout: 60000}) + await this.initiateRefundButton.click({timeout: 60000}) + await this.issueACheckButton.click({timeout: 60000}) + await this.nextButton.click({timeout: 60000}) + await this.refundAmountInput.fill('5') + await this.page.waitForTimeout(1000) + await this.streetAddressInput.fill('1 street') + await this.page.waitForTimeout(1000) + await this.page.keyboard.press('Space') + await this.page.waitForTimeout(1000) + await this.firstAddressOption.click({timeout: 10000}) + await this.page.waitForTimeout(1000) + await this.emailInput.fill('anish@test.com') + await this.entityNameInput.fill('anishTestEntity') + await this.refundReasonInput.fill('Test Refund') + await this.submitRefundRequestButton.click({timeout: 60000}) + await this.page.waitForTimeout(2000) + await expect(this.declineButton).toBeVisible({timeout: 60000}) + await this.declineButton.click({timeout: 60000}) + await this.declineBtnOnConfirmationPopup.click({timeout: 60000}) + await this.page.waitForTimeout(2000) + } } \ No newline at end of file diff --git a/test-automation/tests/eft-initiate-refund.spec.js b/test-automation/tests/eft-initiate-refund.spec.js new file mode 100644 index 00000000..22123fc9 --- /dev/null +++ b/test-automation/tests/eft-initiate-refund.spec.js @@ -0,0 +1,33 @@ +/** + * ============================================================================ + * Manage EFT Payments Page Tests + * ============================================================================ + * + * File: tests/manage-eft-refund.spec.js + * Purpose: End-to-end regression tests for Manage EFT Refund page + * Created: May 06, 2026 + * author: Anish Batra + * Tagged: @regression (runs in npm run e2e:regression:test) + * + * Description: + * This test suite validates the Manage EFT Refund page functionality including: + * - Page navigation and URL verification + * - Element visibility (deactivate button) + * ============================================================================ + */ + +import { test } from '../fixtures.js' + +test.describe('Manage EFT Refund Page Tests', () => { + + //use login type as idir to run this test + test.use({ storageState: { cookies: [], origins: [] } }) // clears saved cookies + // eslint-disable-next-line max-len + test('should validate EFT Refund(using Check) correctly', async ({ page, loginPage, manageEFTPaymentsPage }) => { + console.log('Test: Current URL before navigation:', page.url()) + console.log('Test: Cookies loaded:', (await page.context().cookies()).length) + await page.goto(process.env.EFT_PAYMENTS_URL,{timeout: 180000}) + await loginPage.loginWithIDIR('','') + await manageEFTPaymentsPage.initiateRefund() + }) +}) \ No newline at end of file