Skip to content

Commit

Permalink
Merge pull request #31 from najeeb1023/billPay_feature
Browse files Browse the repository at this point in the history
Bill pay feature
  • Loading branch information
najeeb1023 authored Apr 11, 2024
2 parents cccf9f2 + 744159d commit 625a15b
Show file tree
Hide file tree
Showing 11 changed files with 815 additions and 2 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
retention-days: 30
19 changes: 19 additions & 0 deletions src/test/features/BillPay.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@Regression @PayBill
Feature: User is able to transfer funds to an account.

User is logged in their account and is able to transfer some amount
to another account.

Background: User is logged in.
Given The user lands at the webpage.
When User registers new user account.
Then The user is logged in successfully.

Scenario: User is able to pay bill.
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 |
57 changes: 57 additions & 0 deletions src/test/pages/BillPay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { Page, expect } from "@playwright/test";
import { pageFixture } from "../hooks/pageFixture";
import { PageElement } from "../resources/interfaces/iPageElement";
import * as billPayLocators from "../resources/billPayLocators.json";

function getResource(resourceName: string){
return billPayLocators.webElements.find((element: PageElement) => element.elementName == resourceName) as PageElement
};

export class BillPay {

constructor(public page: Page){
pageFixture.page = page;
};

billPaylocators = {
billPayTab:() => pageFixture.page.locator(getResource('billPayTab').selectorValue),
payeeName:() => pageFixture.page.locator(getResource('payeeName').selectorValue),
payeeAddress:() => pageFixture.page.locator(getResource('payeeAddress').selectorValue),
payeeCity:() => pageFixture.page.locator(getResource('payeeCity').selectorValue),
payeeState:() => pageFixture.page.locator(getResource('payeeState').selectorValue),
payeeZip:() => pageFixture.page.locator(getResource('payeeZip').selectorValue),
payeeNum:() => pageFixture.page.locator(getResource('payeeNum').selectorValue),
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),
sendPaymentBtn:() => pageFixture.page.locator(getResource('sendPaymentBtn').selectorValue),
billPaymentConfirmation:() => pageFixture.page.locator(getResource('billPaymentConfirmation').selectorValue)
}

public async navigateToBillPay ():Promise<void> {
await this.billPaylocators.billPayTab().click();
};

public async enterPayeeDetails (payeeName, payeeAddress, payeeCity, payeeState, payeeZip, payeeNum, payeAcc, payeeConfirmAcc, amountToPay):Promise<void> {
await this.billPaylocators.payeeName().fill(payeeName);
await this.billPaylocators.payeeAddress().fill(payeeAddress);
await this.billPaylocators.payeeCity().fill(payeeCity);
await this.billPaylocators.payeeState().fill(payeeState);
await this.billPaylocators.payeeZip().fill(payeeZip);
await this.billPaylocators.payeeNum().fill(payeeNum);
await this.billPaylocators.payeeAcc().fill(payeAcc);
await this.billPaylocators.payeeConfirmAcc().fill(payeeConfirmAcc);
await this.billPaylocators.amountToPay().fill(amountToPay);
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");
}

};
57 changes: 57 additions & 0 deletions src/test/resources/billPayLocators.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "Bill Pay Locators",
"webElements": [
{
"elementName": "billPayTab",
"selectorValue": "//div[contains(@id,'leftPanel')]//li[4]"
},
{
"elementName": "payeeName",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'payee.name')]"
},
{
"elementName": "payeeAddress",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'payee.address.street')]"
},
{
"elementName": "payeeCity",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'payee.address.city')]"
},
{
"elementName": "payeeState",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'payee.address.state')]"
},
{
"elementName": "payeeZip",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'payee.address.zip')]"
},
{
"elementName": "payeeNum",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'payee.phoneNumber')]"
},
{
"elementName": "payeeAcc",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'payee.accountNumber')]"
},
{
"elementName": "payeeConfirmAcc",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'verifyAccount')]"
},
{
"elementName": "amountToPay",
"selectorValue": "//table[contains(@class, 'form2')]//input[contains(@name, 'amount')]"
},
{
"elementName": "fromAccountDropDown",
"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]"
}
]
}
17 changes: 17 additions & 0 deletions src/test/steps/billPayStepDef.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { When } from "@cucumber/cucumber";
import { BillPay } from "../pages/BillPay";
import { pageFixture } from "../hooks/pageFixture";

let billPay = new BillPay(pageFixture.page);

When("The user navigates to bill pay tab.", async function () {
await billPay.navigateToBillPay();
});

When("Enters {string}, {string}, {string}, {string}, {string}, {string}, {string}, {string}, {string}", async function (payeeName, payeeAddress, payeeCity, payeeState,payeeZip, payeeNum, payeAcc, payeeConfirmAcc, amountToPay) {
await billPay.enterPayeeDetails(payeeName, payeeAddress, payeeCity, payeeState, payeeZip, payeeNum, payeAcc, payeeConfirmAcc, amountToPay);
});

When("Selects account number, pressing the send payment.", async function () {
await billPay.assertSentPayment();
});
9 changes: 8 additions & 1 deletion test-result/reports/cucumber-report.html

Large diffs are not rendered by default.

656 changes: 656 additions & 0 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.
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 625a15b

Please sign in to comment.