diff --git a/src/page-objects/StorefrontPages.ts b/src/page-objects/StorefrontPages.ts index 271ea3e..33e21fa 100644 --- a/src/page-objects/StorefrontPages.ts +++ b/src/page-objects/StorefrontPages.ts @@ -18,6 +18,7 @@ import { AccountPayment } from './storefront/AccountPayment'; import { Search } from './storefront/Search'; import { SearchSuggest } from './storefront/SearchSuggest'; import { CustomRegister } from './storefront/CustomRegister'; +import { CheckoutOrderEdit } from './storefront/CheckoutOrderEdit'; export interface StorefrontPageTypes { StorefrontHome: Home; @@ -37,6 +38,7 @@ export interface StorefrontPageTypes { StorefrontSearch: Search; StorefrontSearchSuggest: SearchSuggest; StorefrontCustomRegister: CustomRegister; + StorefrontCheckoutOrderEdit: CheckoutOrderEdit; } export const StorefrontPageObjects = { @@ -57,6 +59,7 @@ export const StorefrontPageObjects = { Search, SearchSuggest, CustomRegister, + CheckoutOrderEdit, } export const test = base.extend({ @@ -127,5 +130,10 @@ export const test = base.extend({ StorefrontCustomRegister: async ({ StorefrontPage }, use) => { await use(new CustomRegister(StorefrontPage)); + + }, + + StorefrontCheckoutOrderEdit: async ({ StorefrontPage }, use) => { + await use(new CheckoutOrderEdit(StorefrontPage)); }, }); diff --git a/src/page-objects/storefront/CheckoutOrderEdit.ts b/src/page-objects/storefront/CheckoutOrderEdit.ts new file mode 100644 index 0000000..17ee524 --- /dev/null +++ b/src/page-objects/storefront/CheckoutOrderEdit.ts @@ -0,0 +1,43 @@ +import type { Page, Locator } from '@playwright/test'; +import type { PageObject } from '../../types/PageObject'; + +export class CheckoutOrderEdit implements PageObject{ + public readonly completePaymentButton: Locator; + public readonly orderCancelButton: Locator; + public readonly dialogOrderCancel: Locator; + public readonly dialogOrderCancelButton: Locator; + public readonly dialogBackButton: Locator; + + /** + * Payment options + */ + public readonly paymentCashOnDelivery: Locator; + public readonly paymentPaidInAdvance: Locator; + public readonly paymentInvoice: Locator; + + /** + * Shipping options + */ + public readonly shippingStandard: Locator; + public readonly shippingExpress: Locator; + + constructor(public readonly page: Page) { + + this.completePaymentButton = page.getByRole('button', { name : 'Complete payment' }); + this.orderCancelButton = page.getByRole('button', { name: 'Cancel order' }); + this.dialogOrderCancel = page.getByRole('dialog', { name: 'Cancel order' }); + this.dialogOrderCancelButton = this.dialogOrderCancel.getByRole('button', { name: 'Cancel order' }); + this.dialogBackButton = this.dialogOrderCancel.getByRole('button', { name: 'Back' }); + + this.paymentCashOnDelivery = page.getByLabel('Cash on delivery'); + this.paymentPaidInAdvance = page.getByLabel('Paid in advance'); + this.paymentInvoice = page.getByLabel('Invoice'); + + this.shippingStandard = page.getByLabel('Standard'); + this.shippingExpress = page.getByLabel('Express'); + } + + url(orderUuid: string) { + return `account/order/edit/${orderUuid}`; + } +} diff --git a/src/services/TestDataService.ts b/src/services/TestDataService.ts index a8adf64..d90b976 100644 --- a/src/services/TestDataService.ts +++ b/src/services/TestDataService.ts @@ -877,6 +877,8 @@ export class TestDataService { this.addCreatedRecord('system_config', systemConfigEntry.id); + await this.clearCaches(); + return systemConfigEntry; } @@ -2235,4 +2237,8 @@ export class TestDataService { return Object.assign({}, basicCustomerGroup, overrides); } + async clearCaches() { + await this.AdminApiClient.delete('_action/cache'); + } + } \ No newline at end of file