Skip to content

Add user checkout flow #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/test/features/UserShoppingByWear.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Feature: Verify that the user is able to purchase some item.
And The details of the product are shown and user adds the product in their cart.
And User navigates to checkout page.
And User enters "<EmailAddress>", "<FirstName>", "<LastName>", "<Address>", "<City>", "<State>", "<ZipCode>", "<Country>" and "<PhoneNumber>"
And User selects a shipping method.

Examples:
| Section | Attire | EmailAddress | FirstName | LastName | Address | City | State | ZipCode | Country | PhoneNumber |
Expand All @@ -26,6 +27,7 @@ Feature: Verify that the user is able to purchase some item.
And The details of the product are shown and user adds the product in their cart.
And User navigates to checkout page.
And User enters "<EmailAddress>", "<FirstName>", "<LastName>", "<Address>", "<City>", "<State>", "<ZipCode>", "<Country>" and "<PhoneNumber>"
And User selects a shipping method.

Examples:
| Section | Attire | EmailAddress | FirstName | LastName | Address | City | State | ZipCode | Country | PhoneNumber |
Expand Down
17 changes: 15 additions & 2 deletions src/test/pages/UserShoppingByWear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ import { Page, expect } from "@playwright/test";

public async enterUserCheckoutDetails(emailAddress: string, firstName: string, lastName: string, streetAddress: string, city: string, state: string, zipcode: string, country: string, phoneNumber: string){
await this.userShoppingByWear.fillCheckoutForm(emailAddress, firstName, lastName, streetAddress, city, state, zipcode, country, phoneNumber);
}
};

public async shippingMethodSelection(){
await this.userShoppingByWear.selectShippingMethod();
};
};

export class UserShoppingByWear {
Expand Down Expand Up @@ -79,7 +83,8 @@ import { Page, expect } from "@playwright/test";
zipCode:() => pageFixture.page.locator(getResource('zipCode').selectorValue),
country:() => pageFixture.page.locator(getResource('country').selectorValue),
phoneNumber:() => pageFixture.page.locator(getResource('phoneNumber').selectorValue),
nextBtn:() => pageFixture.page.locator(getResource('nextBtn').selectorValue)
nextBtn:() => pageFixture.page.locator(getResource('nextBtn').selectorValue),
selectShippingBtn:() => pageFixture.page.locator(getResource('selectShippingBtn').selectorValue)

};

Expand Down Expand Up @@ -199,4 +204,12 @@ import { Page, expect } from "@playwright/test";
await this.userShoppingByWearByWearLocators.nextBtn().scrollIntoViewIfNeeded();
await this.userShoppingByWearByWearLocators.nextBtn().click();
};

public async selectShippingMethod():Promise<void> {
// await this.userShoppingByWearByWearLocators.selectShippingBtn()
const getShippingMethods = await this.userShoppingByWearByWearLocators.selectShippingBtn().count();
console.log("Shipping methods found -> ", getShippingMethods);

// await (pageFixture.page.locator(getResource('selectShippingBtn').selectorValue.replace('FLAG', 'tes1')));
};
};
4 changes: 4 additions & 0 deletions src/test/resources/userShoppingPageByWear.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@
{
"elementName": "nextBtn",
"selectorValue": "//button[contains(@class,'button action continue primary')]"
},
{
"elementName": "selectShippingBtn",
"selectorValue": "//tbody//tr"
}
]
}
6 changes: 5 additions & 1 deletion src/test/steps/userShoppingByWearStepDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ When("User navigates to checkout page.", async function (){
await categoryAndProductSectionFacade.userItemCheckout();
});

Then("User enters {string}, {string}, {string}, {string}, {string}, {string}, {string}, {string} and {string}", async function (emailAddress: string, firstName: string, lastName: string, streetAddress: string, city: string, state: string, zipcode: string, country: string, phoneNumber: string){
When("User enters {string}, {string}, {string}, {string}, {string}, {string}, {string}, {string} and {string}", async function (emailAddress: string, firstName: string, lastName: string, streetAddress: string, city: string, state: string, zipcode: string, country: string, phoneNumber: string){
await categoryAndProductSectionFacade.enterUserCheckoutDetails(emailAddress, firstName, lastName, streetAddress, city, state, zipcode, country, phoneNumber);
});

When("User selects a shipping method.", async function () {
await categoryAndProductSectionFacade.shippingMethodSelection();
});
Loading