diff --git a/test-automation/fixtures.js b/test-automation/fixtures.js index a20dbfa8..b73f23c7 100644 --- a/test-automation/fixtures.js +++ b/test-automation/fixtures.js @@ -24,6 +24,7 @@ import { TransactionsPage } from './pages/transactions-page.js' import { GovmAccountCreationPage } from './pages/govm-account-creation-page.js' import { StatementsPage } from './pages/statements-page.js' import { BcrosAccountCreationPage } from './pages/bcros-account-creation-page.js' +import { ManageEFTPaymentsPage } from './pages/manage-eft-payments-page.js' const test = base.extend({ loginPage: async ({ page }, use) => { @@ -53,6 +54,9 @@ const test = base.extend({ }, bcrosAccountCreationPage: async ({ page }, use) => { await use(new BcrosAccountCreationPage(page)) + }, + manageEFTPaymentsPage: async ({ page }, use) => { + await use(new ManageEFTPaymentsPage(page)) } }) diff --git a/test-automation/pages/manage-eft-payments-page.js b/test-automation/pages/manage-eft-payments-page.js new file mode 100644 index 00000000..68eede36 --- /dev/null +++ b/test-automation/pages/manage-eft-payments-page.js @@ -0,0 +1,58 @@ +/** + * ============================================================================ + * Manage EFT Payments Page - Page Object Model + * ============================================================================ + * + * File: pages/manage-eft-payments-page.js + * Purpose: Encapsulates Manage EFT Payments page interactions and selectors + * author: Anish Batra + * Created: May 01, 2026 + * + * Description: + * This page object provides methods and locators for the Manage EFT Payments page. + * It follows the Page Object Model (POM) pattern for maintainable test code. + * ============================================================================ + */ + +import { expect } from '@playwright/test' + +export class ManageEFTPaymentsPage { + constructor(page) { + this.page = page + this.manageEFTPaymentsButton = page.getByText('Manage EFT Payments') + this.bankShortNameFilterInput = page.locator('[placeholder="Bank Short Name"]') + this.viewDetailsButton = page.getByText(' View Details ') + this.unlinkAccountButton = page.getByText('Unlink Account') + this.unlinkAccountConfirmationText = page.getByText(' The link with this account will be removed. ') + this.confirmButton = page.getByText(' Confirm ') + this.linkToAccountButton = page.getByText(' Link to Account ') + this.accountID = page.locator('[class="v-select__selections"]>input') + this.arrowWithApplyPaymentButton = page.locator('[class="more-actions"]') + this.selectAccountToLink = page.locator('[role="option"]') + this.linkAccountButtonOnConfirmationPopup = page.getByText(' Link Account ') + this.cancelPaymentButton = page.getByText(' Cancel Payment ') + } + + async accountUnlinkAndLink() { + 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.arrowWithApplyPaymentButton.click({timeout: 60000}) + await this.unlinkAccountButton.click({timeout: 60000}) + await expect(this.unlinkAccountConfirmationText).toBeVisible({timeout: 60000}) + await this.confirmButton.click({timeout: 60000}) + await this.linkToAccountButton.click({timeout: 60000}) + await this.accountID.click({timeout: 60000}) + await this.accountID.fill('2955') + await this.selectAccountToLink.click({timeout: 60000}) + await this.page.waitForTimeout(2000) + await this.linkAccountButtonOnConfirmationPopup.click({timeout: 60000}) + await expect(this.page.locator('tbody').first()).toContainText('2955',{timeout: 60000}) + await this.cancelPaymentButton.click({timeout: 60000}) + await this.page.waitForTimeout(3000) + await this.confirmButton.click({timeout: 60000}) + await this.page.waitForTimeout(2000) + } +} \ No newline at end of file diff --git a/test-automation/tests/manage-eft-payments.spec.js b/test-automation/tests/manage-eft-payments.spec.js new file mode 100644 index 00000000..ec710737 --- /dev/null +++ b/test-automation/tests/manage-eft-payments.spec.js @@ -0,0 +1,33 @@ +/** + * ============================================================================ + * Manage EFT Payments Page Tests + * ============================================================================ + * + * File: tests/manage-eft-payments.spec.js + * Purpose: End-to-end regression tests for Manage EFT Payments page + * Created: May 01, 2026 + * author: Anish Batra + * Tagged: @regression (runs in npm run e2e:regression:test) + * + * Description: + * This test suite validates the Manage EFT Payments page functionality including: + * - Page navigation and URL verification + * - Element visibility (deactivate button) + * ============================================================================ + */ + +import { test } from '../fixtures.js' + +test.describe('Manage EFT Payments 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 account linkage and unlink for EFT Payments 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.accountUnlinkAndLink() + }) +}) \ No newline at end of file