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

Auction tests #2452

Merged
merged 8 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
21 changes: 18 additions & 3 deletions tests/pw/feature-map/feature-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@
vendor can't bid own product: true
vendor can add auction product: true
vendor can view auction product: true
vendor can duplicate auction product: false
vendor can duplicate auction product: true
vendor can permanently delete auction product: true
vendor can edit auction product: true
vendor can update auction product title: true
Expand Down Expand Up @@ -760,13 +760,28 @@
admin:
admin can enable delivery time module: false
admin can disable delivery time module: false
admin can allow vendor to override delivery time settings: false
admin can set delivery support options: false
admin can set delivery date label: false
admin can set delivery blocked buffer: false
admin can set delivery time slot: false
admin can set delivery order per slot: false
admin can set delivery box info: false
admin can require delivery date and time: false
admin can set delivery days: false
admin can update delivery time on order details: false
vendor:
vendor can view delivery time menu page: true
vendor can change view style of delivery time calendar: true
vendor can filter delivery time: true
vendor can view delivery time orders on calendar: false
vendor can view delivery time settings menu page: true
vendor can set delivery time settings: true
vendor can filter delivery time: true
vendor can change view style of delivery time calendar: true
vendor can set delivery support options: false
vendor can set delivery blocked buffer: false
vendor can set delivery time slot: false
vendor can set delivery order per slot: false
vendor can set delivery days: false
vendor can update delivery time on order details: false
customer:
customer can buy product with delivery time: true
Expand Down
2 changes: 2 additions & 0 deletions tests/pw/pages/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5708,6 +5708,8 @@ export const selector = {
edit: (productName: string) => `//a[normalize-space()="${productName}"]/../..//span[@class="edit"]`,
permanentlyDelete: (productName: string) => `//a[normalize-space()="${productName}"]/../..//span[@class="delete"]`,
view: (productName: string) => `//a[normalize-space()="${productName}"]/../..//span[@class="view"]`,
duplicate: (productName: string) => `//a[normalize-space()="${productName}"]/../..//span[@class="duplicate"]`,
duplicateSuccessMessage: '//div[contains(@class,"dokan-alert dokan-alert-success")]//strong[normalize-space(text())="Product successfully duplicated"]',

confirmDelete: '.swal2-confirm',
cancelDelete: '.swal2-cancel',
Expand Down
10 changes: 10 additions & 0 deletions tests/pw/pages/vendorAuctionsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ export class AuctionsPage extends VendorPage {
await this.toBeVisible(auctionProductsVendor.productCell(productName));
}

// duplicate auction product
async duplicateAuctionProduct(productName: string) {
await this.searchAuctionProduct(productName);
await this.removeAttribute(auctionProductsVendor.rowActions(productName), 'class'); // forcing the row actions to be visible, to avoid flakiness
await this.hover(auctionProductsVendor.productCell(productName));
await this.clickAndWaitForResponseAndLoadState(data.subUrls.frontend.vDashboard.auction, auctionProductsVendor.duplicate(productName), 302);
await this.toBeVisible(auctionProductsVendor.duplicateSuccessMessage);
await this.toBeVisible(auctionProductsVendor.productCell(productName + ' (Copy)'));
}

// delete auction product
async deleteAuctionProduct(productName: string) {
await this.searchAuctionProduct(productName);
Expand Down
8 changes: 4 additions & 4 deletions tests/pw/tests/e2e/commission.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { payloads } from '@utils/payloads';
import { dbUtils } from '@utils/dbUtils';
import { dbData } from '@utils/dbData';

const { DOKAN_PRO, PRODUCT_ID } = process.env;
const { PRODUCT_ID } = process.env;

test.describe('Commission test', () => {
let admin: CommissionPage;
Expand Down Expand Up @@ -49,7 +49,7 @@ test.describe('Commission test', () => {
await admin.setCommissionOnDokanSetupWizard(data.commission.allCategory);
});

test('admin can set commission on Dokan setup wizard (specific category based)', { tag: ['@lite', '@admin'] }, async () => {
test.skip('admin can set commission on Dokan setup wizard (specific category based)', { tag: ['@lite', '@admin'] }, async () => {
await admin.setCommissionOnDokanSetupWizard(data.commission.specificCategory);
});

Expand All @@ -61,7 +61,7 @@ test.describe('Commission test', () => {
await admin.setCommissionOnDokanSellingSettings(data.commission.allCategory);
});

test('admin can set commission on Dokan selling settings (specific category based)', { tag: ['@lite', '@admin'] }, async () => {
test.skip('admin can set commission on Dokan selling settings (specific category based)', { tag: ['@lite', '@admin'] }, async () => {
await admin.setCommissionOnDokanSellingSettings(data.commission.specificCategory);
});

Expand All @@ -73,7 +73,7 @@ test.describe('Commission test', () => {
await admin.setCommissionForVendor(sellerId, data.commission.allCategory);
});

test('admin can set commission for vendor (specific category based)', { tag: ['@lite', '@admin'] }, async () => {
test.skip('admin can set commission for vendor (specific category based)', { tag: ['@lite', '@admin'] }, async () => {
await admin.setCommissionForVendor(sellerId, data.commission.specificCategory);
});

Expand Down
5 changes: 5 additions & 0 deletions tests/pw/tests/e2e/vendorAuction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ test.describe('Auction Product test', () => {
await vendor.searchAuctionProduct(auctionProductName);
});

test('vendor can duplicate auction product', { tag: ['@pro', '@vendor'] }, async () => {
const [, , auctionProductName] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth);
await vendor.duplicateAuctionProduct(auctionProductName);
});
Comment on lines +72 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance test verification and cleanup

The test should verify the duplicated product's existence and properties, and ensure proper cleanup. Consider:

  1. Verifying the duplicated product's attributes match the original
  2. Adding cleanup for both original and duplicated products
 test('vendor can duplicate auction product', { tag: ['@pro', '@vendor'] }, async () => {
     const [, , auctionProductName] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth);
-    await vendor.duplicateAuctionProduct(auctionProductName);
+    const duplicatedProductName = await vendor.duplicateAuctionProduct(auctionProductName);
+    // Verify the duplicated product
+    await vendor.verifyDuplicatedProduct(auctionProductName, duplicatedProductName);
+    // Cleanup
+    await apiUtils.deleteProduct(duplicatedProductName, payloads.vendorAuth);
+    await apiUtils.deleteProduct(auctionProductName, payloads.vendorAuth);
 });

Committable suggestion skipped: line range outside the PR's diff.


test('vendor can permanently delete auction product', { tag: ['@pro', '@vendor'] }, async () => {
const [, , auctionProductName] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth);
await vendor.deleteAuctionProduct(auctionProductName);
Expand Down
Loading