From 40cf4be21d9adc48e554206060f1a56941503415 Mon Sep 17 00:00:00 2001 From: Orkun Cavli Date: Fri, 15 Nov 2024 14:32:15 +0100 Subject: [PATCH 1/2] feat: NEXT-39291 - --- src/page-objects/AdministrationPages.ts | 15 +++++++++++ .../administration/OrderBulkEdit.ts | 26 +++++++++++++++++++ .../administration/OrderListing.ts | 23 ++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/page-objects/administration/OrderBulkEdit.ts create mode 100644 src/page-objects/administration/OrderListing.ts diff --git a/src/page-objects/AdministrationPages.ts b/src/page-objects/AdministrationPages.ts index 631b0b4..60ee6c7 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'; export interface AdministrationPageTypes { AdminProductDetail: ProductDetail; @@ -31,6 +33,8 @@ export interface AdministrationPageTypes { AdminLandingPageCreate: LandingPageCreate; AdminLandingPageDetail: LandingPageDetail; AdminRuleDetail: RuleDetail; + AdminOrderListing: OrderListing; + AdminOrderBulkEdit: OrderBulkEdit; } export const AdminPageObjects = { @@ -48,6 +52,8 @@ export const AdminPageObjects = { LandingPageCreate, LandingPageDetail, RuleDetail, + OrderListing, + OrderBulkEdit, } export const test = base.extend({ @@ -103,7 +109,16 @@ export const test = base.extend({ AdminLandingPageCreate: async ({ AdminPage }, use) => { await use(new LandingPageCreate(AdminPage)); }, + AdminRuleDetail: async ({ AdminPage }, use) => { await use(new RuleDetail(AdminPage)); }, + + AdminOrderListing: async ({ AdminPage }, use) => { + await use(new OrderListing(AdminPage)); + }, + + AdminOrderBulkEdit: async ({ AdminPage }, use) => { + await use(new OrderBulkEdit(AdminPage)); + }, }); \ No newline at end of file diff --git a/src/page-objects/administration/OrderBulkEdit.ts b/src/page-objects/administration/OrderBulkEdit.ts new file mode 100644 index 0000000..90d82e2 --- /dev/null +++ b/src/page-objects/administration/OrderBulkEdit.ts @@ -0,0 +1,26 @@ +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; + + + + 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'); + + + + + } + + url() { + return '#/sw/order/index/'; + } +} \ No newline at end of file diff --git a/src/page-objects/administration/OrderListing.ts b/src/page-objects/administration/OrderListing.ts new file mode 100644 index 0000000..940b687 --- /dev/null +++ b/src/page-objects/administration/OrderListing.ts @@ -0,0 +1,23 @@ +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; + + + 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(); + + + } + + url() { + return '#/sw/order/index/'; + } +} \ No newline at end of file From 0b322166bb64b7aaf25740c26a34f1d12cbec7af Mon Sep 17 00:00:00 2001 From: Kstala Date: Fri, 22 Nov 2024 12:59:17 +0100 Subject: [PATCH 2/2] feat: add order bulk edit task --- .../administration/OrderBulkEdit.ts | 2 ++ .../administration/OrderDetail.ts | 18 ---------------- .../administration/OrderListing.ts | 21 ++++++++++++++++--- src/tasks/shop-admin-tasks.ts | 4 +++- src/tasks/shop-admin/Order/BulkEditOrders.ts | 17 +++++++++++++++ 5 files changed, 40 insertions(+), 22 deletions(-) delete mode 100644 src/page-objects/administration/OrderDetail.ts create mode 100644 src/tasks/shop-admin/Order/BulkEditOrders.ts diff --git a/src/page-objects/administration/OrderBulkEdit.ts b/src/page-objects/administration/OrderBulkEdit.ts index 90d82e2..4ccc4a3 100644 --- a/src/page-objects/administration/OrderBulkEdit.ts +++ b/src/page-objects/administration/OrderBulkEdit.ts @@ -5,6 +5,7 @@ export class OrderBulkEdit implements PageObject { public readonly header: Locator; public readonly statusCard: Locator; public readonly changePaymentStatus: Locator; + public readonly changeOrderStatus: Locator; @@ -14,6 +15,7 @@ export class OrderBulkEdit implements PageObject { //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') 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 index 940b687..39ed2ef 100644 --- a/src/page-objects/administration/OrderListing.ts +++ b/src/page-objects/administration/OrderListing.ts @@ -6,18 +6,33 @@ export class OrderListing implements PageObject { 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); + }, +});