Skip to content

Commit

Permalink
Merge branch 'develop' into develop_rk
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Oct 4, 2024
2 parents 2fb317a + 51bf060 commit da5e867
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 11 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
**WC requires at least:** 8.0.0
**WC tested up to:** 9.3.3
**Requires PHP:** 7.4
**Stable tag:** 3.12.3
**Stable tag:** 3.12.4
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -347,6 +347,10 @@ A. Just install and activate the PRO version without deleting the free plugin. A

## Changelog ##

### v3.12.4 ( Oct 03, 2024 ) ###

- **update:** Added `$data` parameter to `dokan_update_vendor` hook.

### v3.12.3 ( Sep 30, 2024 ) ###

- **update:** Added compatibility with RFQ state field ui.
Expand Down
4 changes: 2 additions & 2 deletions dokan.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Dokan
* Plugin URI: https://dokan.co/wordpress/
* Description: An e-commerce marketplace plugin for WordPress. Powered by WooCommerce and weDevs.
* Version: 3.12.3
* Version: 3.12.4
* Author: weDevs
* Author URI: https://dokan.co/
* Text Domain: dokan-lite
Expand Down Expand Up @@ -66,7 +66,7 @@ final class WeDevs_Dokan {
*
* @var string
*/
public $version = '3.12.2';
public $version = '3.12.4';

/**
* Instance of self
Expand Down
19 changes: 18 additions & 1 deletion includes/Vendor/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,28 @@ public function update( $vendor_id, $data = [] ) {
}
}

/**
* Fires before a vendor is updated.
*
* @since 2.9.10
*
* @param int $vendor_id The ID of the vendor being updated.
* @param array $data The array of vendor data being updated.
*/
do_action( 'dokan_before_update_vendor', $vendor->get_id(), $data );

$vendor->save();

do_action( 'dokan_update_vendor', $vendor->get_id() );
/**
* Fires after a vendor has been updated.
*
* @since 2.9.10
* @since 3.12.4 added $data parameter
*
* @param int $vendor_id The ID of the vendor that was updated.
* @param array $data The array of vendor data that was updated.
*/
do_action( 'dokan_update_vendor', $vendor->get_id(), $data );

return $vendor->get_id();
}
Expand Down
4 changes: 2 additions & 2 deletions languages/dokan-lite.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (c) 2024 weDevs Pte. Ltd. All Rights Reserved.
msgid ""
msgstr ""
"Project-Id-Version: Dokan 3.12.3\n"
"Project-Id-Version: Dokan 3.12.4\n"
"Report-Msgid-Bugs-To: https://dokan.co/contact/\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-09-30T09:33:46+00:00\n"
"POT-Creation-Date: 2024-10-03T05:38:32+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.11.0\n"
"X-Domain: dokan-lite\n"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dokan",
"version": "3.12.3",
"version": "3.12.4",
"description": "A WordPress marketplace plugin",
"author": "weDevs",
"license": "GPL",
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Tested up to: 6.6.2
WC requires at least: 8.0.0
WC tested up to: 9.3.3
Requires PHP: 7.4
Stable tag: 3.12.3
Stable tag: 3.12.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -347,6 +347,10 @@ A. Just install and activate the PRO version without deleting the free plugin. A

== Changelog ==

= v3.12.4 ( Oct 03, 2024 ) =

- **update:** Added `$data` parameter to `dokan_update_vendor` hook.

= v3.12.3 ( Sep 30, 2024 ) =

- **update:** Added compatibility with RFQ state field ui.
Expand Down
12 changes: 12 additions & 0 deletions templates/whats-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
* When you are adding new version please follow this sequence for changes: New Feature, New, Improvement, Fix...
*/
$changelog = [
[
'version' => 'Version 3.12.4',
'released' => '2024-10-03',
'changes' => [
'Improvement' => [
[
'title' => 'Added `$data` parameter to `dokan_update_vendor` hook.',
'description' => '',
],
],
],
],
[
'version' => 'Version 3.12.3',
'released' => '2024-09-30',
Expand Down
12 changes: 12 additions & 0 deletions tests/pw/feature-map/feature-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@
vendor can update product short description [lite]: true
vendor can remove product short description [lite]: true
vendor can update product description [lite]: true
vendor can add product downloadable options [lite]: true
vendor can update product downloadable options [lite]: true
vendor can remove product downloadable file [lite]: true
vendor can add product inventory options (SKU) [lite]: true
vendor can update product inventory options (SKU) [lite]: true
vendor can remove product inventory options (SKU) [lite]: true
vendor can add product inventory options (stock status) [lite]: true
vendor can add product inventory options (stock management) [lite]: true
vendor can update product inventory options (stock management) [lite]: true
vendor can remove product inventory options (stock management) [lite]: true
vendor can add product inventory options (allow single quantity) [lite]: true
vendor can remove product inventory options (allow single quantity) [lite]: true

- page: 'MyOrders'
features:
Expand Down
98 changes: 97 additions & 1 deletion tests/pw/pages/productsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ export class ProductsPage extends AdminPage {
await this.goToProductEdit(productName);
for (const tag of tags) {
await this.click(productsVendor.tags.removeSelectedTags(tag));
await this.press('Escape'); // shift focus from element
await this.press('Escape'); // shift focus from element
}
await this.saveProduct();

Expand Down Expand Up @@ -1003,6 +1003,102 @@ export class ProductsPage extends AdminPage {
await this.toContainTextFrameLocator(productsVendor.description.descriptionIframe, productsVendor.description.descriptionHtmlBody, description);
}

// add product downloadable options
async addProductDownloadableOptions(productName: string, downloadableOption: product['productInfo']['downloadableOptions']): Promise<void> {
await this.goToProductEdit(productName);
await this.check(productsVendor.downloadable);
await this.click(productsVendor.downloadableOptions.addFile);
await this.clearAndType(productsVendor.downloadableOptions.fileName, downloadableOption.fileName);
await this.click(productsVendor.downloadableOptions.chooseFile);
await this.uploadMedia(downloadableOption.fileUrl);
await this.clearAndType(productsVendor.downloadableOptions.downloadLimit, downloadableOption.downloadLimit);
await this.clearAndType(productsVendor.downloadableOptions.downloadExpiry, downloadableOption.downloadExpiry);
await this.saveProduct();
await this.toBeChecked(productsVendor.downloadable);
await this.toHaveValue(productsVendor.downloadableOptions.fileName, downloadableOption.fileName);
await this.toHaveValue(productsVendor.downloadableOptions.downloadLimit, downloadableOption.downloadLimit);
await this.toHaveValue(productsVendor.downloadableOptions.downloadExpiry, downloadableOption.downloadExpiry);
}

// remove product downloadable files
async removeDownloadableFile(productName: string, downloadableOption: product['productInfo']['downloadableOptions']): Promise<void> {
await this.goToProductEdit(productName);
const fileCount = await this.getElementCount(productsVendor.downloadableOptions.deleteFile);
for (let i = 0; i < fileCount; i++) {
await this.clickFirstLocator(productsVendor.downloadableOptions.deleteFile);
}
await this.clearAndType(productsVendor.downloadableOptions.downloadLimit, downloadableOption.downloadLimit);
await this.clearAndType(productsVendor.downloadableOptions.downloadExpiry, downloadableOption.downloadExpiry);
await this.saveProduct();
await this.notToBeVisible(productsVendor.downloadableOptions.deleteFile);
await this.toHaveValue(productsVendor.downloadableOptions.downloadLimit, downloadableOption.downloadLimit);
await this.toHaveValue(productsVendor.downloadableOptions.downloadExpiry, downloadableOption.downloadExpiry);
}

// add product inventory
async addProductInventory(productName: string, inventory: product['productInfo']['inventory'], choice: string): Promise<void> {
await this.goToProductEdit(productName);

switch (choice) {
case 'sku':
await this.clearAndType(productsVendor.inventory.sku, inventory.sku);
break;
case 'stock-status':
await this.selectByValue(productsVendor.inventory.stockStatus, inventory.stockStatus);
break;
case 'stock-management':
await this.check(productsVendor.inventory.enableStockManagement);
await this.clearAndType(productsVendor.inventory.stockQuantity, inventory.stockQuantity);
await this.clearAndType(productsVendor.inventory.lowStockThreshold, inventory.lowStockThreshold);
await this.selectByValue(productsVendor.inventory.allowBackorders, inventory.backorders);
break;
case 'one-quantity':
if (inventory.oneQuantity) {
await this.check(productsVendor.inventory.allowOnlyOneQuantity);
} else {
await this.uncheck(productsVendor.inventory.allowOnlyOneQuantity);
}
break;
default:
break;
}

await this.saveProduct();

// todo: replace switch with all method action and assertion as object member and loop through to call them

switch (choice) {
case 'sku':
await this.toHaveValue(productsVendor.inventory.sku, inventory.sku);
break;
case 'stock-status':
await this.toHaveSelectedValue(productsVendor.inventory.stockStatus, inventory.stockStatus);
break;
case 'stock-management':
await this.toBeChecked(productsVendor.inventory.enableStockManagement);
await this.toHaveValue(productsVendor.inventory.stockQuantity, inventory.stockQuantity);
await this.toHaveValue(productsVendor.inventory.lowStockThreshold, inventory.lowStockThreshold);
await this.toHaveSelectedValue(productsVendor.inventory.allowBackorders, inventory.backorders);
await this.notToBeVisible(productsVendor.inventory.stockStatus);
break;
case 'one-quantity':
if (inventory.oneQuantity) {
await this.toBeChecked(productsVendor.inventory.allowOnlyOneQuantity);
} else {
await this.notToBeChecked(productsVendor.inventory.allowOnlyOneQuantity);
}
break;
default:
break;
}
}
// remove product inventory [stock management]
async removeProductInventory(productName: string): Promise<void> {
await this.goToProductEdit(productName);
await this.uncheck(productsVendor.inventory.enableStockManagement);
await this.saveProduct();
await this.notToBeChecked(productsVendor.inventory.enableStockManagement);
}

// add product catalog mode
async addProductCatalogMode(productName: string, hidePrice: boolean = false): Promise<void> {
Expand Down
54 changes: 54 additions & 0 deletions tests/pw/tests/e2e/productsDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,58 @@ test.describe('Product details functionality test', () => {
await vendor.addProductDescription(productName, data.product.productInfo.description.description);
});

// product downloadable options

test('vendor can add product downloadable options', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductDownloadableOptions(productName1, data.product.productInfo.downloadableOptions);
});

test('vendor can update product downloadable options', { tag: ['@lite', '@vendor'] }, async () => {
// todo: need a product with downloadable file
await vendor.addProductDownloadableOptions(productName, data.product.productInfo.downloadableOptions);
});

test('vendor can remove product downloadable file', { tag: ['@lite', '@vendor'] }, async () => {
// todo: need a product with downloadable file
await vendor.addProductDownloadableOptions(productName, data.product.productInfo.downloadableOptions);
await vendor.removeDownloadableFile(productName, { ...data.product.productInfo.downloadableOptions, downloadLimit: '', downloadExpiry: '' });
});

// product inventory options

test('vendor can add product inventory options (SKU)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'sku');
});

test('vendor can update product inventory options (SKU)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductInventory(productName, data.product.productInfo.inventory(), 'sku');
});

test('vendor can remove product inventory options (SKU)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductInventory(productName, { ...data.product.productInfo.inventory(), sku: '' }, 'sku');
});

test('vendor can add product inventory options (stock status)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-status');
});

test('vendor can add product inventory options (stock management)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-management');
});

test('vendor can update product inventory options (stock management)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-management');
});

test('vendor can remove product inventory options (stock management)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.removeProductInventory(productName);
});

test('vendor can add product inventory options (allow single quantity)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'one-quantity');
});

test('vendor can remove product inventory options (allow single quantity)', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.addProductInventory(productName, { ...data.product.productInfo.inventory(), oneQuantity: false }, 'one-quantity');
});
});
11 changes: 11 additions & 0 deletions tests/pw/tests/e2e/vendorSettings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { dbUtils } from '@utils/dbUtils';
import { data } from '@utils/testData';
import { payloads } from '@utils/payloads';

const { VENDOR_ID } = process.env;

test.describe('Vendor settings test', () => {
let vendor: VendorSettingsPage;
let vPage: Page;
Expand All @@ -21,6 +23,7 @@ test.describe('Vendor settings test', () => {

test.afterAll(async () => {
await apiUtils.setStoreSettings(payloads.defaultStoreSettings, payloads.vendorAuth);
await dbUtils.setUserMeta(VENDOR_ID, '_dokan_rma_settings', dbData.testData.dokan.rmaSettings, true);
await vPage.close();
await apiUtils.dispose();
});
Expand Down Expand Up @@ -49,6 +52,14 @@ test.describe('Vendor settings test', () => {

// store settings

test.skip('vendor can set store banner settings', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.setStoreSettings(data.vendor.vendorInfo, 'banner');
});

test.skip('vendor can set store profile picture settings', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.setStoreSettings(data.vendor.vendorInfo, 'profile-picture');
});

test('vendor can set store basic settings', { tag: ['@lite', '@vendor'] }, async () => {
await vendor.setStoreSettings(data.vendor.vendorInfo, 'basic');
});
Expand Down

0 comments on commit da5e867

Please sign in to comment.