-
Notifications
You must be signed in to change notification settings - Fork 206
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
Test Case :: Order Min Max #2367
base: develop
Are you sure you want to change the base?
Changes from 8 commits
242edc6
9f243d5
9d189ab
439d5d5
0f4eba0
db8f058
328e2fe
78aa53a
f38ba64
09f5490
4b1662c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class CartPage extends BasePage { | ||
quantityInputFieldFor(productTitle: string) { | ||
return this.page.locator(`//div[@class="quantity"]/label[contains(text(), "${productTitle}")]/following-sibling::input`); | ||
} | ||
|
||
updateCartButton() { | ||
return this.page.locator('//button[@name="update_cart"]'); | ||
} | ||
|
||
quantityErrorElement() { | ||
return this.page.locator('//td[@class="product-quantity"]/div[@class="required"]'); | ||
} | ||
|
||
woocommerceErrorMessage() { | ||
return this.page.locator('//div[@class="woocommerce-notices-wrapper"]/ul[@class="woocommerce-error"]/li'); | ||
} | ||
|
||
async enterQuantityValue(productTitle: string, quantityValue: string) { | ||
await this.quantityInputFieldFor(productTitle).fill(quantityValue); | ||
} | ||
|
||
async clickOnUpdateCartButton() { | ||
await this.updateCartButton().click(); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Locators are already defined in pages/selectors. Add new locators there if they are not already included. Using multiple files solely for locators can unnecessarily complicate the project. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class MyAccountAuthPage extends BasePage { | ||
usernameInputField() { | ||
return this.page.locator('#username'); | ||
} | ||
|
||
passwordInputField() { | ||
return this.page.locator('#password'); | ||
} | ||
|
||
loginButton() { | ||
return this.page.locator('//button[@name="login"]'); | ||
} | ||
|
||
async enterUsername(username: string) { | ||
await this.usernameInputField().fill(username); | ||
} | ||
|
||
async enterPassword(password: string) { | ||
await this.passwordInputField().fill(password); | ||
} | ||
|
||
async clickOnLoginButton() { | ||
await this.loginButton().click(); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of creating a class with already implemented methods. use login methods from the LoginPage class |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class AllMyOrdersPage extends BasePage { | ||
viewButtonByOrderId(orderId: string) { | ||
return this.page.locator(`//td[@class="order-number"]/a[contains(text(), "${orderId}")]/../following-sibling::td[5]/a`); | ||
} | ||
|
||
async clickOnViewButtonByOrderId(orderId: string) { | ||
await this.viewButtonByOrderId(orderId).click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class CustomerOrderDetailsPage extends BasePage { | ||
orderReceivedButtonByShipmentNumber(shipmentNumber: string) { | ||
return this.page.locator(`//h4[@class="shippments-tracking-title"]/strong[text()="Shipment ${shipmentNumber} "]/../../div[1]/strong[@class="customer-status"]`); | ||
} | ||
|
||
trackingStatusByShipmentNumber(shipmentNumber: string) { | ||
return this.page.locator(`//h4[@class="shippments-tracking-title"]/strong[text()="Shipment ${shipmentNumber} "]/../../div[1]/p/strong`); | ||
} | ||
|
||
dialogueBoxOkButton() { | ||
return this.page.locator('//div[@role="dialog"]/div[6]/button[text()="OK"]'); | ||
} | ||
|
||
async markOrderAsReceived(shipmentNumber: string) { | ||
await this.orderReceivedButtonByShipmentNumber(shipmentNumber).click(); | ||
} | ||
|
||
async clickOnDialogBoxOkButton() { | ||
await this.dialogueBoxOkButton().click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class StorefrontMainMenu extends BasePage { | ||
cartContentLink() { | ||
return this.page.locator('.cart-contents'); | ||
} | ||
|
||
async clickOnCartContentLink() { | ||
await this.cartContentLink().click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class ShopPage extends BasePage { | ||
productTitle() { | ||
return this.page.locator('.woocommerce-loop-product__title'); | ||
} | ||
|
||
async clickOnProductWithTitle(productTitle: string) { | ||
await this.productTitle().getByText(productTitle).click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class SingleProductPage extends BasePage { | ||
quantityInputFieldFor(productTitle: string) { | ||
return this.page.locator(`//div[@class="quantity"]/label[contains(text(), "${productTitle}")]/following-sibling::input`); | ||
} | ||
|
||
addToCartButton() { | ||
return this.page.locator('.single_add_to_cart_button'); | ||
} | ||
|
||
errorMessageElement() { | ||
return this.page.locator('//ul[@class="woocommerce-error"]/li'); | ||
} | ||
|
||
async enterQuantityValue(productTitle: string, quantityValue: string) { | ||
await this.quantityInputFieldFor(productTitle).fill(quantityValue); | ||
} | ||
|
||
async clickOnAddToCartButton() { | ||
await this.addToCartButton().click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class VendorDashboardSidebarPage extends BasePage { | ||
sidebarMenu(title: string) { | ||
return this.page.locator(`//li[contains(@class, "${title}")]/a`); | ||
} | ||
|
||
async clickOnOrdersTab() { | ||
await this.sidebarMenu('orders').click(); | ||
} | ||
|
||
async clickOnProductsTab() { | ||
await this.sidebarMenu('products').click(); | ||
} | ||
|
||
async clickOnSettingsTab() { | ||
await this.sidebarMenu('settings').click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class VendorAllOrdersPage extends BasePage { | ||
orderTitleById(orderId: string) { | ||
return this.page.locator(`//td[@data-title="Order"]/a/strong[text()="Order ${orderId}"]`); | ||
} | ||
|
||
async clickOnOrderById(orderId: string) { | ||
await this.orderTitleById(orderId).click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class VendorEditOrderPage extends BasePage { | ||
createNewShipmentButton() { | ||
return this.page.locator('#create-tracking-status-action'); | ||
} | ||
|
||
shipmentItemCheckboxByIndex(itemNumber: string) { | ||
return this.page.locator(`//form[@id="add-shipping-tracking-status-form"]/div/table/tbody[@id="order_line_items"]/tr[${itemNumber}]/td[1]/label/input`); | ||
} | ||
|
||
shippingStatusDropdown() { | ||
return this.page.locator('#shipment-status'); | ||
} | ||
|
||
shippingProviderDropdown() { | ||
return this.page.locator('#shipping_status_provider'); | ||
} | ||
|
||
shippingDateField() { | ||
return this.page.locator('#shipped_status_date'); | ||
} | ||
|
||
shippingTrackingNumberField() { | ||
return this.page.locator('#tracking_status_number'); | ||
} | ||
|
||
createShipmentButton() { | ||
return this.page.locator('#add-tracking-status-details'); | ||
} | ||
|
||
async clickOnCreateNewShipmentButton() { | ||
await this.createNewShipmentButton().click(); | ||
} | ||
|
||
async clickOnShipmentItemCheckboxByIndex(itemNumber: string) { | ||
await this.shipmentItemCheckboxByIndex(itemNumber).click(); | ||
} | ||
|
||
async selectShippingStatus(status: string) { | ||
await this.shippingStatusDropdown().selectOption(status); | ||
} | ||
|
||
async selectShippingProvider(providerName: string) { | ||
await this.shippingProviderDropdown().selectOption(providerName); | ||
} | ||
|
||
async enterShippingDate(date: string) { | ||
await this.shippingDateField().fill(date); | ||
} | ||
|
||
async enterShippingTrackingNumber(trackingNumber: string) { | ||
await this.shippingTrackingNumberField().fill(trackingNumber); | ||
} | ||
|
||
async clickOnCreateShipmentButton() { | ||
await this.createShipmentButton().click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class VendorProductAddEditPage extends BasePage { | ||
simpleProductMinQtyInputField() { | ||
return this.page.locator('#dokan_simple_product_min_quantity'); | ||
} | ||
|
||
simpleProductMaxQtyInputField() { | ||
return this.page.locator('#dokan_simple_product_max_quantity'); | ||
} | ||
|
||
productStatusSelectField() { | ||
return this.page.locator('#post_status'); | ||
} | ||
|
||
saveProductButton() { | ||
return this.page.locator('#publish'); | ||
} | ||
|
||
async enterSimpleProductMinQty(quantity: string) { | ||
await this.simpleProductMinQtyInputField().fill(quantity); | ||
} | ||
|
||
async enterSimpleProductMaxQty(quantity: string) { | ||
await this.simpleProductMaxQtyInputField().fill(quantity); | ||
} | ||
|
||
async selectProductStatus(status: 'publish' | 'draft' | 'pending') { | ||
await this.productStatusSelectField().selectOption(status); | ||
} | ||
|
||
async clickOnSaveProduct() { | ||
await this.saveProductButton().click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class VendorProductListPage extends BasePage { | ||
productTitle() { | ||
return this.page.locator(`//td[@data-title="Name"]/strong/a`); | ||
} | ||
|
||
async clickOnProductWithTitle(productTitle: string) { | ||
await this.productTitle().getByText(productTitle).click(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using radomstring package. use Use faker.string.alpha() from faker-js package which is already available