-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09f5490
commit 4b1662c
Showing
14 changed files
with
39 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 3 additions & 15 deletions
18
tests/pw/pages/frontend/my-account/auth/my-account-auth.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,15 @@ | ||
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); | ||
await this.page.locator('#username').fill(username); | ||
} | ||
|
||
async enterPassword(password: string) { | ||
await this.passwordInputField().fill(password); | ||
await this.page.locator('#password').fill(password); | ||
} | ||
|
||
async clickOnLoginButton() { | ||
await this.loginButton().click(); | ||
await this.page.locator('//button[@name="login"]').click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
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(); | ||
await this.page.locator(`//td[@class="order-number"]/a[contains(text(), "${orderId}")]/../following-sibling::td[5]/a`).click(); | ||
} | ||
} |
12 changes: 2 additions & 10 deletions
12
tests/pw/pages/frontend/my-orders/customer-order-details.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
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(); | ||
await this.page.locator(`//h4[@class="shippments-tracking-title"]/strong[text()="Shipment ${shipmentNumber} "]/../../div[1]/strong[@class="customer-status"]`).click(); | ||
} | ||
|
||
async clickOnDialogBoxOkButton() { | ||
await this.dialogueBoxOkButton().click(); | ||
await this.page.locator('//div[@role="dialog"]/div[6]/button[text()="OK"]').click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class StorefrontMainMenu extends BasePage { | ||
cartContentLink() { | ||
return this.page.locator('.cart-contents'); | ||
} | ||
|
||
async clickOnCartContentLink() { | ||
await this.cartContentLink().click(); | ||
await this.page.locator('.cart-contents').click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
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(); | ||
await this.page.locator('.woocommerce-loop-product__title').getByText(productTitle).click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
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); | ||
await this.page.locator(`//div[@class="quantity"]/label[contains(text(), "${productTitle}")]/following-sibling::input`).fill(quantityValue); | ||
} | ||
|
||
async clickOnAddToCartButton() { | ||
await this.addToCartButton().click(); | ||
await this.page.locator('.single_add_to_cart_button').click(); | ||
} | ||
} |
42 changes: 7 additions & 35 deletions
42
tests/pw/pages/frontend/vendor-dashboard/orders/vendor-edit-order.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,31 @@ | ||
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(); | ||
await this.page.locator('#create-tracking-status-action').click(); | ||
} | ||
|
||
async clickOnShipmentItemCheckboxByIndex(itemNumber: string) { | ||
await this.shipmentItemCheckboxByIndex(itemNumber).click(); | ||
await this.page.locator(`//form[@id="add-shipping-tracking-status-form"]/div/table/tbody[@id="order_line_items"]/tr[${itemNumber}]/td[1]/label/input`).click(); | ||
} | ||
|
||
async selectShippingStatus(status: string) { | ||
await this.shippingStatusDropdown().selectOption(status); | ||
await this.page.locator('#shipment-status').selectOption(status); | ||
} | ||
|
||
async selectShippingProvider(providerName: string) { | ||
await this.shippingProviderDropdown().selectOption(providerName); | ||
await this.page.locator('#shipping_status_provider').selectOption(providerName); | ||
} | ||
|
||
async enterShippingDate(date: string) { | ||
await this.shippingDateField().fill(date); | ||
await this.page.locator('#shipped_status_date').fill(date); | ||
} | ||
|
||
async enterShippingTrackingNumber(trackingNumber: string) { | ||
await this.shippingTrackingNumberField().fill(trackingNumber); | ||
await this.page.locator('#tracking_status_number').fill(trackingNumber); | ||
} | ||
|
||
async clickOnCreateShipmentButton() { | ||
await this.createShipmentButton().click(); | ||
await this.page.locator('#add-tracking-status-details').click(); | ||
} | ||
} |
24 changes: 4 additions & 20 deletions
24
tests/pw/pages/frontend/vendor-dashboard/products/product-add-edit.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,19 @@ | ||
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); | ||
await this.page.locator('#min_quantity').fill(quantity); | ||
} | ||
|
||
async enterSimpleProductMaxQty(quantity: string) { | ||
await this.simpleProductMaxQtyInputField().fill(quantity); | ||
await this.page.locator('#max_quantity').fill(quantity); | ||
} | ||
|
||
async selectProductStatus(status: 'publish' | 'draft' | 'pending') { | ||
await this.productStatusSelectField().selectOption(status); | ||
await this.page.locator('#post_status').selectOption(status); | ||
} | ||
|
||
async clickOnSaveProduct() { | ||
await this.saveProductButton().click(); | ||
await this.page.locator('#publish').click(); | ||
} | ||
} |
18 changes: 3 additions & 15 deletions
18
tests/pw/pages/frontend/vendor-dashboard/settings/store/vendor-store.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,15 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class VendorStoreSettingsPage extends BasePage { | ||
minimumOrderAmountInputField() { | ||
return this.page.locator('#min_amount_to_order'); | ||
} | ||
|
||
maximumOrderAmountInputField() { | ||
return this.page.locator('#max_amount_to_order'); | ||
} | ||
|
||
updateSettingsButton() { | ||
return this.page.locator(`//input[@name="dokan_update_store_settings"]`); | ||
} | ||
|
||
async enterMinimumOrderAmount(amount: string) { | ||
await this.minimumOrderAmountInputField().fill(amount); | ||
await this.page.locator('#min_amount_to_order').fill(amount); | ||
} | ||
|
||
async enterMaximumOrderAmount(amount: string) { | ||
await this.maximumOrderAmountInputField().fill(amount); | ||
await this.page.locator('#max_amount_to_order').fill(amount); | ||
} | ||
|
||
async clickOnUpdateSettingsButton() { | ||
await this.updateSettingsButton().click(); | ||
await this.page.locator(`//input[@name="dokan_update_store_settings"]`).click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,19 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class DokanModulesPage extends BasePage { | ||
searchInputField() { | ||
return this.page.locator('//div[@class="search-box"]/input'); | ||
} | ||
|
||
moduleTitle() { | ||
return this.page.locator(`//div[@class="module-details"]/h3/a`); | ||
} | ||
|
||
moduleToggleField(moduleName: string) { | ||
return this.page.locator(`//div[@class="module-details"]/h3/a[contains(text(), "${moduleName}")]/../../following-sibling::div/div[2]/label`); | ||
} | ||
|
||
activeModuleTab() { | ||
return this.page.locator(`//div[@class="module-filter-left"]/ul/li[2]/a`); | ||
} | ||
|
||
async searchFor(searchTerm: string) { | ||
await this.searchInputField().fill(searchTerm); | ||
await this.page.locator('//div[@class="search-box"]/input').fill(searchTerm); | ||
} | ||
|
||
async clickOnModuleToggleButton(moduleName: string) { | ||
await this.moduleToggleField(moduleName).click(); | ||
await this.page.locator(`//div[@class="module-details"]/h3/a[contains(text(), "${moduleName}")]/../../following-sibling::div/div[2]/label`).click(); | ||
} | ||
|
||
async clickOnActiveModulesTab() { | ||
await this.activeModuleTab().click(); | ||
await this.page.locator(`//div[@class="module-filter-left"]/ul/li[2]/a`).click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class AllProductsPage extends BasePage { | ||
productTitleById(productId: string) { | ||
return this.page.locator(`//tr[@id="post-${productId}"]/td[2]/strong/a`); | ||
} | ||
|
||
async clickOnProductTitleById(productId: string) { | ||
await this.productTitleById(productId).click(); | ||
await this.page.locator(`//tr[@id="post-${productId}"]/td[2]/strong/a`).click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import { BasePage } from '@pages/basePage'; | ||
|
||
export default class EditProductPage extends BasePage { | ||
publishButton() { | ||
return this.page.locator('#publish'); | ||
} | ||
|
||
async clickOnPublishButton() { | ||
await this.publishButton().click(); | ||
await this.page.locator('#publish').click(); | ||
} | ||
} |