Skip to content
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

feat: NEXT-39291 - create order listing and order bulk edit #176

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/page-objects/AdministrationPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -37,6 +39,8 @@ export interface AdministrationPageTypes {
AdminLandingPageCreate: LandingPageCreate;
AdminLandingPageDetail: LandingPageDetail;
AdminRuleDetail: RuleDetail;
AdminOrderListing: OrderListing;
AdminOrderBulkEdit: OrderBulkEdit;
AdminRuleCreate: RuleCreate;
AdminCustomFieldListing: CustomFieldListing;
AdminCustomFieldCreate: CustomFieldCreate;
Expand All @@ -59,6 +63,8 @@ export const AdminPageObjects = {
LandingPageCreate,
LandingPageDetail,
RuleDetail,
OrderListing,
OrderBulkEdit,
RuleCreate,
CustomFieldListing,
CustomFieldCreate,
Expand Down Expand Up @@ -127,6 +133,14 @@ export const test = base.extend<FixtureTypes>({
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));
},
Expand Down
28 changes: 28 additions & 0 deletions src/page-objects/administration/OrderBulkEdit.ts
Original file line number Diff line number Diff line change
@@ -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/';
}
}
18 changes: 0 additions & 18 deletions src/page-objects/administration/OrderDetail.ts

This file was deleted.

38 changes: 38 additions & 0 deletions src/page-objects/administration/OrderListing.ts
Original file line number Diff line number Diff line change
@@ -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<Record<string, Locator>> {
const orderTableRow = this.ordersTable.locator('.sw-data-grid__row', { hasText: orderNumber });


return {
selectionCheckbox: orderTableRow.getByRole('checkbox'),
};
}
}
4 changes: 3 additions & 1 deletion src/tasks/shop-admin-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
17 changes: 17 additions & 0 deletions src/tasks/shop-admin/Order/BulkEditOrders.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test as base, expect } from '@playwright/test';

Check warning on line 1 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'expect' is defined but never used

Check warning on line 1 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'expect' is defined but never used
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 ) => {

Check warning on line 7 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'AdminOrderBulkEdit' is defined but never used

Check warning on line 7 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'AdminOrderBulkEdit' is defined but never used

Check warning on line 7 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'AdminOrderListing' is defined but never used

Check warning on line 7 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'AdminOrderListing' is defined but never used
const task = (order: Order[], changes: Record<string, Change> ) => {

Check warning on line 8 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'order' is defined but never used

Check warning on line 8 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'order' is defined but never used

Check warning on line 8 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'changes' is defined but never used

Check warning on line 8 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

'changes' is defined but never used
return async function BulkEditOrders() {

Check failure on line 9 in src/tasks/shop-admin/Order/BulkEditOrders.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected empty async function 'BulkEditOrders'


};
};

await use(task);
},
});
Loading