test(e2e): add virtual product creation and shipping field visibility… - #3341
test(e2e): add virtual product creation and shipping field visibility…#3341dev-shahed wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughAdds virtual-product helpers and shipping/tax locators to the product form page object, with end-to-end coverage for virtual shipping behavior, persistence, downloadable products, edge cases, and variable products. It also hardens auction date parsing and removes duplicate navigation logic. ChangesVirtual Product Form
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant NewProductFormPage
participant ProductFormUI
participant RESTAPI
NewProductFormPage->>ProductFormUI: Fill product data
NewProductFormPage->>ProductFormUI: Wait for digital options and enable Virtual
NewProductFormPage->>ProductFormUI: Save product
ProductFormUI->>RESTAPI: Persist virtual product
RESTAPI-->>NewProductFormPage: Return product id
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
tests/pw/tests/e2e/product-form-manager/newProductFormPage.ts (1)
692-708: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd the
@since DOKAN_SINCEplaceholder to the new JSDoc blocks.The new
waitForDigitalOptions()andcreateVirtualProduct()doc comments don't carry a version tag.📝 Proposed fix
/** * Wait for the async-hydrated "Digital Product Options" group (Virtual / * Downloadable) to mount. It renders noticeably later than title/price, so * toggling Virtual straight after waitForFormReady() can silently no-op. + * + * `@since` DOKAN_SINCE */ async waitForDigitalOptions(timeoutMs = 20000): Promise<void> { await this.virtualToggle.waitFor({ state: 'attached', timeout: timeoutMs }).catch(() => undefined); } - /** Create a virtual product (basic info + Virtual) and return its persisted id. */ + /** + * Create a virtual product (basic info + Virtual) and return its persisted id. + * + * `@since` DOKAN_SINCE + */ async createVirtualProduct(data: ProductData): Promise<number | null> {As per coding guidelines, "For new code documentation, use the literal placeholder
@since DOKAN_SINCE... Never hardcode or guess an unreleased version."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/pw/tests/e2e/product-form-manager/newProductFormPage.ts` around lines 692 - 708, Add the literal `@since DOKAN_SINCE` tag to the JSDoc blocks for `waitForDigitalOptions()` and `createVirtualProduct()`, without changing their descriptions or implementation.Source: Coding guidelines
tests/pw/tests/e2e/product-form-manager/newProductFormTypes.spec.ts (1)
148-165: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider reusing
createVirtualProduct()instead of re-inlining its steps.This test repeats
fillBasicInfo→waitForDigitalOptions→enableVirtualbefore addingenableDownloadable, duplicating the sequence already encapsulated inNewProductFormPage.createVirtualProduct(). Extending that helper (e.g., an optionaldownloadableflag) or adding a smallcreateVirtualDownloadableProduct()helper would avoid the duplicate sequence.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/pw/tests/e2e/product-form-manager/newProductFormTypes.spec.ts` around lines 148 - 165, The test “vendor can create a virtual downloadable product” duplicates the virtual-product setup already encapsulated by NewProductFormPage.createVirtualProduct(). Reuse that helper by extending it with an optional downloadable behavior or add a focused createVirtualDownloadableProduct() helper, then update the test to call it before saving and validating both REST flags.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/pw/tests/e2e/product-form-manager/newProductFormPage.ts`:
- Around line 692-708: Add the literal `@since DOKAN_SINCE` tag to the JSDoc
blocks for `waitForDigitalOptions()` and `createVirtualProduct()`, without
changing their descriptions or implementation.
In `@tests/pw/tests/e2e/product-form-manager/newProductFormTypes.spec.ts`:
- Around line 148-165: The test “vendor can create a virtual downloadable
product” duplicates the virtual-product setup already encapsulated by
NewProductFormPage.createVirtualProduct(). Reuse that helper by extending it
with an optional downloadable behavior or add a focused
createVirtualDownloadableProduct() helper, then update the test to call it
before saving and validating both REST flags.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9ebed46a-9de2-490e-a71b-b502a929720d
📒 Files selected for processing (2)
tests/pw/tests/e2e/product-form-manager/newProductFormPage.tstests/pw/tests/e2e/product-form-manager/newProductFormTypes.spec.ts
… tests
All Submissions:
Changes proposed in this Pull Request:
Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
Changelog entry
Title
Detailed Description of the pull request. What was previous behaviour
and what will be changed in this PR.
Before Changes
Describe the issue before changes with screenshots(s).
After Changes
Describe the issue after changes with screenshot(s).
Feature Video (optional)
Link of detailed video if this PR is for a feature.
PR Self Review Checklist:
FOR PR REVIEWER ONLY:
Summary by CodeRabbit
New Features
Bug Fixes