Skip to content

Add user checkout flow #34

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 6 commits into from
Aug 22, 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: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: v3.6.0
name: v3.7.0
on:
push

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Magento WebApp Test Automation Framework

[![v3.6.0.](https://github.com/najeeb1023/magento-webapp/actions/workflows/release.yaml/badge.svg)](https://github.com/najeeb1023/magento-webapp/actions/workflows/release.yaml)
[![v3.7.0.](https://github.com/najeeb1023/magento-webapp/actions/workflows/release.yaml/badge.svg)](https://github.com/najeeb1023/magento-webapp/actions/workflows/release.yaml)
![License](https://img.shields.io/badge/license-MIT-green)

## Overview
Expand Down
16 changes: 10 additions & 6 deletions src/test/features/UserShoppingByWear.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ Feature: Verify that the user is able to purchase some item.
Scenario: User shops for Men attire.
When The user clicks on the "<Section>" section and the user clicks on "<Attire>" option.
And The products are shown and user navigates to a product.
Then The details of the product are shown.
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>"

Examples:
| Section | Attire |
| Men | Jackets |
| Section | Attire | EmailAddress | FirstName | LastName | Address | City | State | ZipCode | Country | PhoneNumber |
| Men | Jackets | randomemail@gmail.com | Ronald | McDonald | Any Street 9112 | New York City | New York | 92784 | United States | 873487682 |

@WomenShopping
Scenario: User shops for Women attire.
When The user clicks on the "<Section>" section and the user clicks on "<Attire>" option.
And The products are shown and user navigates to a product.
Then The details of the product are shown.
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>"

Examples:
| Section | Attire |
| Women | Bras & Tanks |
| Section | Attire | EmailAddress | FirstName | LastName | Address | City | State | ZipCode | Country | PhoneNumber |
| Women | Bras & Tanks | randomemail@gmail.com | Ronald | McDonald | Any Street 9112 | New York City | New York | 92784 | United States | 873487682 |
33 changes: 32 additions & 1 deletion src/test/pages/UserShoppingByWear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import { Page, expect } from "@playwright/test";
public async userItemCheckout(){
await this.userShoppingByWear.addToCartProduct();
await this.userShoppingByWear.proceedToCheckout();
};

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);
}
};

Expand Down Expand Up @@ -65,7 +69,17 @@ import { Page, expect } from "@playwright/test";
pageTitle:() => pageFixture.page.locator(getResourceRegisterPage('createAccHeading').selectorValue),
productTitle:() => pageFixture.page.locator(getResourceRegisterPage('productTitle').selectorValue),
miniCartBtn:() => pageFixture.page.locator(getResource('miniCartBtn').selectorValue),
proceedToCheckoutBtn:() => pageFixture.page.locator(getResource('proceedToCheckoutBtn').selectorValue)
proceedToCheckoutBtn:() => pageFixture.page.locator(getResource('proceedToCheckoutBtn').selectorValue),
emailAddress:() => pageFixture.page.locator(getResource('emailAddress').selectorValue),
firstName:() => pageFixture.page.locator(getResource('firstName').selectorValue),
lastName:() => pageFixture.page.locator(getResource('lastName').selectorValue),
streetAddress:() => pageFixture.page.locator(getResource('streetAddress').selectorValue),
city:() => pageFixture.page.locator(getResource('city').selectorValue),
state:() => pageFixture.page.locator(getResource('state').selectorValue),
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)

};

Expand Down Expand Up @@ -168,4 +182,21 @@ import { Page, expect } from "@playwright/test";
await this.userShoppingByWearByWearLocators.miniCartBtn().click();
await this.userShoppingByWearByWearLocators.proceedToCheckoutBtn().click();
};

public async fillCheckoutForm(emailAddress: string, firstName: string, lastName: string, streetAddress: string, city: string, state: string, zipcode: string, country: string, phoneNumber: string):Promise<void>{
await pageFixture.page.waitForLoadState('networkidle');
await this.userShoppingByWearByWearLocators.emailAddress().fill(emailAddress);
await this.userShoppingByWearByWearLocators.firstName().fill(firstName);
await this.userShoppingByWearByWearLocators.lastName().fill(lastName);
await this.userShoppingByWearByWearLocators.streetAddress().fill(streetAddress);
await this.userShoppingByWearByWearLocators.city().fill(city);
await this.userShoppingByWearByWearLocators.state().selectOption(state);
await this.userShoppingByWearByWearLocators.state().scrollIntoViewIfNeeded();
await this.userShoppingByWearByWearLocators.zipCode().fill(zipcode);
await this.userShoppingByWearByWearLocators.country().scrollIntoViewIfNeeded();
await this.userShoppingByWearByWearLocators.country().selectOption(country);
await this.userShoppingByWearByWearLocators.phoneNumber().fill(phoneNumber);
await this.userShoppingByWearByWearLocators.nextBtn().scrollIntoViewIfNeeded();
await this.userShoppingByWearByWearLocators.nextBtn().click();
};
};
41 changes: 40 additions & 1 deletion src/test/resources/userShoppingPageByWear.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,46 @@
{
"elementName": "proceedToCheckoutBtn",
"selectorValue": "//div[contains(@class,'primary')]//button[contains(@id,'top-cart-btn-checkout')]"
},
{
"elementName": "emailAddress",
"selectorValue": "(//input[contains(@id,'customer-email')])[1]"
},
{
"elementName": "firstName",
"selectorValue": "//input[contains(@name,'firstname')]"
},
{
"elementName": "lastName",
"selectorValue": "//input[contains(@name,'lastname')]"
},
{
"elementName": "streetAddress",
"selectorValue": "//input[contains(@name,'street[0]')]"
},
{
"elementName": "city",
"selectorValue": "//input[contains(@name,'city')]"
},
{
"elementName": "state",
"selectorValue": "//select[contains(@name,'region_id')]"
},
{
"elementName": "zipCode",
"selectorValue": "//input[contains(@name,'postcode')]"
},
{
"elementName": "country",
"selectorValue": "//select[contains(@name,'country_id')]"
},
{
"elementName": "phoneNumber",
"selectorValue": "//input[contains(@name,'telephone')]"
},
{
"elementName": "nextBtn",
"selectorValue": "//button[contains(@class,'button action continue primary')]"
}

]
}
11 changes: 9 additions & 2 deletions src/test/steps/userShoppingByWearStepDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ When("The products are shown and user navigates to a product.", async function (
await categoryAndProductSectionFacade.selectRandomItem();
});

When("The details of the product are shown.", async function (){
When("The details of the product are shown and user adds the product in their cart.", async function (){
await categoryAndProductSectionFacade.showProductDetails();
});

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){
await categoryAndProductSectionFacade.enterUserCheckoutDetails(emailAddress, firstName, lastName, streetAddress, city, state, zipcode, country, phoneNumber);
});
Loading