Skip to content

Commit

Permalink
feat: added Bill Payment feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
najeeb1023 committed Apr 11, 2024
1 parent 09b8099 commit 94b426b
Show file tree
Hide file tree
Showing 13 changed files with 557 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ jobs:
if: always()
with:
name: cucumber-report
path: cucumber-report.html
path: test-result/reports/cucumber-report.html, test-result/reports/cucumber-report.json
retention-days: 30
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"parabank": "cucumber-js --config=config/cucumber.js --tags @PayBill"
"parabank": "cucumber-js --config=config/cucumber.js --tags @Regression"
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const config:LaunchOptions = {

timeout: 600000,
slowMo: 300,
headless: false,
headless: true,
args: ['--window-position=-1070,-100'] //! Used secondary monitor, can be removed/adjusted to show on default monitor.

};
5 changes: 4 additions & 1 deletion src/test/features/BillPay.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ Feature: User is able to transfer funds to an account.
When The user navigates to bill pay tab.
And Enters "<Payee Name>", "<Address>", "<City>", "<State>", "<Zip Code>", "<Phone Number>", "<Account Number>", "<Verify Account>", "<Amount>"
And Selects account number, pressing the send payment.


Examples:
| Payee Name | Address | City | State | Zip Code | Phone Number | Account Number | Verify Account | Amount |
| John Shilok | Jackman Street 11 | New York | New York | 798623 | 87234876 | 9827346987234 | 9827346987234 | 4750 |
17 changes: 14 additions & 3 deletions src/test/pages/BillPay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from "@playwright/test";
import { Page, expect } from "@playwright/test";
import { pageFixture } from "../hooks/pageFixture";
import { PageElement } from "../resources/interfaces/iPageElement";
import * as billPayLocators from "../resources/billPayLocators.json";
Expand All @@ -24,7 +24,9 @@ export class BillPay {
payeeAcc:() => pageFixture.page.locator(getResource('payeeAcc').selectorValue),
payeeConfirmAcc:() => pageFixture.page.locator(getResource('payeeConfirmAcc').selectorValue),
amountToPay:() => pageFixture.page.locator(getResource('amountToPay').selectorValue),
fromAccountDropDown:() => pageFixture.page.locator(getResource('fromAccountDropDown').selectorValue)
fromAccountDropDown:() => pageFixture.page.locator(getResource('fromAccountDropDown').selectorValue),
sendPaymentBtn:() => pageFixture.page.locator(getResource('sendPaymentBtn').selectorValue),
billPaymentConfirmation:() => pageFixture.page.locator(getResource('billPaymentConfirmation').selectorValue)
}

public async navigateToBillPay ():Promise<void> {
Expand All @@ -41,6 +43,15 @@ export class BillPay {
await this.billPaylocators.payeeAcc().fill(payeAcc);
await this.billPaylocators.payeeConfirmAcc().fill(payeeConfirmAcc);
await this.billPaylocators.amountToPay().fill(amountToPay);
// await this.billPaylocators.fromAccountDropDown().selectOption([]);
let accountNum = [(await this.billPaylocators.fromAccountDropDown().textContent()).trim()];
await this.billPaylocators.fromAccountDropDown().selectOption(accountNum);
await this.billPaylocators.sendPaymentBtn().click();
};

public async assertSentPayment ():Promise<void> {
let confirmPayment = await this.billPaylocators.billPaymentConfirmation().textContent();
expect(confirmPayment).toContain('was successful');
process.stdout.write("\n" + (" ") +confirmPayment.trim() + "\n" + "\n");
}

};
10 changes: 9 additions & 1 deletion src/test/resources/billPayLocators.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@
},
{
"elementName": "fromAccountDropDown",
"selectorValue": "//table[contains(@class, 'form2')]//selectt[contains(@name, 'fromAccountId')]"
"selectorValue": "//table[contains(@class, 'form2')]//select[contains(@name, 'fromAccountId')]"
},
{
"elementName": "sendPaymentBtn",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@type,'submit')]"
},
{
"elementName": "billPaymentConfirmation",
"selectorValue": "//div[contains(@id, 'rightPanel')]//div[contains(@ng-show, 'showResult')]//p[1]"
}
]
}
2 changes: 1 addition & 1 deletion src/test/steps/billPayStepDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ When("Enters {string}, {string}, {string}, {string}, {string}, {string}, {string
});

When("Selects account number, pressing the send payment.", async function () {

await billPay.assertSentPayment();
});
2 changes: 1 addition & 1 deletion test-result/reports/cucumber-report.html

Large diffs are not rendered by default.

536 changes: 525 additions & 11 deletions test-result/reports/cucumber-report.json

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-result/screenshots/User is able to pay bill..png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-result/screenshots/User is registered and logged in..png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 94b426b

Please sign in to comment.