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

Migrate @pages/BO/shopParameters/orderSettings/statuses/returnStatus/add from Core #460

Merged
merged 1 commit into from
Mar 3, 2025
Merged
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
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export {default as boProductsCreateTabStocksPage} from '@pages/BO/catalog/produc
export {default as boProductsCreateTabVirtualProductPage} from '@pages/BO/catalog/products/create/tabVirtualProduct';
export {default as boProductSettingsPage} from '@pages/BO/shopParameters/productSettings';
export {default as boQuickAccessPage} from '@pages/BO/quickAccess';
export {default as boReturnStatusesCreatePage} from '@pages/BO/shopParameters/orderSettings/orderStatuses/returnStatuses/create';
export {default as boRolesPage} from '@pages/BO/advancedParameters/team/roles';
export {default as boRolesCreatePage} from '@pages/BO/advancedParameters/team/roles/create';
export {default as boSearchPage} from '@pages/BO/shopParameters/search';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type FakerOrderReturnStatus from '@data/faker/orderReturnStatus';
import {BOBasePagePageInterface} from '@interfaces/BO';
import {type Page} from '@playwright/test';

export interface BOReturnStatusesCreatePageInterface extends BOBasePagePageInterface {
readonly pageTitleCreate: string;
readonly pageTitleEdit: (name: string) => string;

setOrderReturnStatus(page: Page, orderReturnStatusData: FakerOrderReturnStatus): Promise<string>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
type BOReturnStatusesCreatePageInterface,
} from '@interfaces/BO/shopParameters/orderSettings/orderStatuses/returnStatuses/create';

/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
function requirePage(): BOReturnStatusesCreatePageInterface {
return require('@versions/develop/pages/BO/shopParameters/orderSettings/orderStatuses/returnStatuses/create');
}
/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */

export default requirePage();
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import type FakerOrderReturnStatus from '@data/faker/orderReturnStatus';
import {
type BOReturnStatusesCreatePageInterface,
} from '@interfaces/BO/shopParameters/orderSettings/orderStatuses/returnStatuses/create';
import BOBasePage from '@pages/BO/BOBasePage';
import {type Page} from '@playwright/test';

/**
* Add order return status page, contains selectors and functions for the page
* @class
* @extends BOBasePage
*/
class BOReturnStatusesCreatePage extends BOBasePage implements BOReturnStatusesCreatePageInterface {
public readonly pageTitleCreate: string;

public readonly pageTitleEdit: (name: string) => string;

private readonly nameInput: string;

private readonly colorInput: string;

private readonly saveButton: string;

/**
* @constructs
* Setting up titles and selectors to use on add order return status page
*/
constructor() {
super();

this.pageTitleCreate = `New return status • ${global.INSTALL.SHOP_NAME}`;
this.pageTitleEdit = (name: string) => `Editing return status ${name} • ${global.INSTALL.SHOP_NAME}`;

// Form selectors
this.nameInput = '#order_return_state_name_1';
this.colorInput = '#order_return_state_color';
this.saveButton = '#save-button';
}

/* Methods */

/**
* Fill order return status form
* @param page {Page} Browser tab
* @param orderReturnStatusData {FakerOrderReturnStatus} Data to set on order return status form
* @return {Promise<string>}
*/
async setOrderReturnStatus(page: Page, orderReturnStatusData: FakerOrderReturnStatus): Promise<string> {
await this.setValue(page, this.nameInput, orderReturnStatusData.name);

// Set color
await this.setInputValue(page, this.colorInput, orderReturnStatusData.color);

// Save order return status
await this.clickAndWaitForURL(page, this.saveButton);

// Return successful message
return this.getAlertSuccessBlockParagraphContent(page);
}
}

module.exports = new BOReturnStatusesCreatePage();