diff --git a/src/page-objects/AdministrationPages.ts b/src/page-objects/AdministrationPages.ts index 09f97ba..e3c038f 100644 --- a/src/page-objects/AdministrationPages.ts +++ b/src/page-objects/AdministrationPages.ts @@ -15,6 +15,8 @@ import { LandingPageCreate } from './administration/LandingPageCreate'; import { LandingPageDetail } from './administration/LandingPageDetail'; import { Categories } from './administration/Categories'; import { RuleDetail } from './administration/RuleDetail'; +import { OrderListing } from './administration/OrderListing'; +import { OrderBulkEdit } from './administration/OrderBulkEdit'; import { CustomFieldListing } from './administration/CustomFieldListing'; import { CustomFieldCreate } from './administration/CustomFieldCreate'; import { CustomFieldDetail } from './administration/CustomFieldDetail'; @@ -37,6 +39,8 @@ export interface AdministrationPageTypes { AdminLandingPageCreate: LandingPageCreate; AdminLandingPageDetail: LandingPageDetail; AdminRuleDetail: RuleDetail; + AdminOrderListing: OrderListing; + AdminOrderBulkEdit: OrderBulkEdit; AdminRuleCreate: RuleCreate; AdminCustomFieldListing: CustomFieldListing; AdminCustomFieldCreate: CustomFieldCreate; @@ -59,6 +63,8 @@ export const AdminPageObjects = { LandingPageCreate, LandingPageDetail, RuleDetail, + OrderListing, + OrderBulkEdit, RuleCreate, CustomFieldListing, CustomFieldCreate, @@ -127,6 +133,14 @@ export const test = base.extend({ await use(new RuleDetail(AdminPage)); }, + AdminOrderListing: async ({ AdminPage }, use) => { + await use(new OrderListing(AdminPage)); + }, + + AdminOrderBulkEdit: async ({ AdminPage }, use) => { + await use(new OrderBulkEdit(AdminPage)); + }, + AdminRuleCreate: async ({ AdminPage }, use) => { await use(new RuleCreate(AdminPage)); }, diff --git a/src/page-objects/administration/OrderBulkEdit.ts b/src/page-objects/administration/OrderBulkEdit.ts new file mode 100644 index 0000000..4ccc4a3 --- /dev/null +++ b/src/page-objects/administration/OrderBulkEdit.ts @@ -0,0 +1,28 @@ +import type { Page, Locator } from '@playwright/test'; +import type { PageObject } from '../../types/PageObject'; + +export class OrderBulkEdit implements PageObject { + public readonly header: Locator; + public readonly statusCard: Locator; + public readonly changePaymentStatus: Locator; + public readonly changeOrderStatus: Locator; + + + + constructor(public readonly page: Page) { + this.header = page.locator('.smart-bar__header'); + + //Status Card + this.statusCard = page.locator('.sw-bulk-edit-order-base__status'); + this.changePaymentStatus = page.getByText('Change: Payment status'); + this.changeOrderStatus = page.getByText('Change: Order status') + + + + + } + + url() { + return '#/sw/order/index/'; + } +} \ No newline at end of file diff --git a/src/page-objects/administration/OrderDetail.ts b/src/page-objects/administration/OrderDetail.ts deleted file mode 100644 index 40c3809..0000000 --- a/src/page-objects/administration/OrderDetail.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { Page, Locator } from '@playwright/test'; -import type { PageObject } from '../../types/PageObject'; - -export class OrderDetail implements PageObject { - public readonly saveButton: Locator; - public readonly dataGridContextButton: Locator; - public readonly orderTag: Locator; - - constructor(public readonly page: Page) { - this.saveButton = page.locator('.sw-order-detail__smart-bar-save-button'); - this.dataGridContextButton = page.locator('.sw-data-grid__actions-menu').and(page.getByRole('button')); - this.orderTag = page.locator('.sw-select-selection-list__item'); - } - - url(orderId: string) { - return `#/sw/order/detail/${orderId}/general`; - } -} diff --git a/src/page-objects/administration/OrderListing.ts b/src/page-objects/administration/OrderListing.ts new file mode 100644 index 0000000..39ed2ef --- /dev/null +++ b/src/page-objects/administration/OrderListing.ts @@ -0,0 +1,38 @@ +import type { Page, Locator } from '@playwright/test'; +import type { PageObject } from '../../types/PageObject'; + +export class OrderListing implements PageObject { + public readonly header: Locator; + public readonly addOrderButton: Locator; + public readonly contextMenu: Locator; + public readonly selectAllCheckbox: Locator; + public readonly ordersTable:Locator; + public readonly bulkEditButton: Locator; + public readonly bulkEditModal: Locator; + public readonly startBulkEditButton: Locator; + + + constructor(public readonly page: Page) { + this.header = page.locator('.smart-bar__header'); + this.addOrderButton = page.getByText('Add order', { exact: true }); + this.contextMenu = page.locator('.sw-data-grid-settings__trigger'); + this.selectAllCheckbox = page.locator('.sw-field--checkbox').first(); + this.ordersTable = page.locator('.sw-data-grid__table'); + this.bulkEditButton = page.getByRole('button', {name: 'Bulk edit'}); + this.bulkEditModal = page.locator('.sw-product-bulk-edit-modal'); + this.startBulkEditButton = this.bulkEditModal.getByRole('button', {name: 'Start bulk edit'}); + } + + url() { + return '#/sw/order/index/'; + } + + async getOrderRow(orderNumber: string): Promise> { + const orderTableRow = this.ordersTable.locator('.sw-data-grid__row', { hasText: orderNumber }); + + + return { + selectionCheckbox: orderTableRow.getByRole('checkbox'), + }; + } +} \ No newline at end of file diff --git a/src/tasks/shop-admin-tasks.ts b/src/tasks/shop-admin-tasks.ts index 4373936..8deadbe 100644 --- a/src/tasks/shop-admin-tasks.ts +++ b/src/tasks/shop-admin-tasks.ts @@ -2,8 +2,10 @@ import { mergeTests } from '@playwright/test'; import { SaveProduct } from './shop-admin/Product/SaveProduct'; import { ExpectNotification } from './shop-admin/ExpectNotification'; +import { BulkEditOrders } from './shop-admin/Order/BulkEditOrders'; export const test = mergeTests( SaveProduct, - ExpectNotification + ExpectNotification, + BulkEditOrders ); \ No newline at end of file diff --git a/src/tasks/shop-admin/Order/BulkEditOrders.ts b/src/tasks/shop-admin/Order/BulkEditOrders.ts new file mode 100644 index 0000000..f60a4a0 --- /dev/null +++ b/src/tasks/shop-admin/Order/BulkEditOrders.ts @@ -0,0 +1,17 @@ +import { test as base, expect } from '@playwright/test'; +import type { Task } from '../../../types/Task'; +import type { FixtureTypes} from '../../../types/FixtureTypes'; +import { Order } from 'src/types/ShopwareTypes'; + +export const BulkEditOrders = base.extend<{ BulkEditOrders: Task }, FixtureTypes>({ + BulkEditOrders: async ({ AdminOrderBulkEdit, AdminOrderListing }, use ) => { + const task = (order: Order[], changes: Record ) => { + return async function BulkEditOrders() { + + + }; + }; + + await use(task); + }, +});