Skip to content

Conversation

@shohan0120
Copy link
Contributor

@shohan0120 shohan0120 commented Nov 3, 2025

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

Related Pull Request(s)

  • Full PR Link

Closes

  • Closes #

How to test the changes in this Pull Request:

  • Steps or issue link

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:

  • Code is not following code style guidelines
  • Bad naming: make sure you would understand your code if you read it a few months from now.
  • KISS: Keep it simple, Sweetie (not stupid!).
  • DRY: Don't Repeat Yourself.
  • Code that is not readable: too many nested 'if's are a bad sign.
  • Performance issues
  • Complicated constructions that need refactoring or comments: code should almost always be self-explanatory.
  • Grammar errors.

FOR PR REVIEWER ONLY:

As a reviewer, your feedback should be focused on the idea, not the person. Seek to understand, be respectful, and focus on constructive dialog.

As a contributor, your responsibility is to learn from suggestions and iterate your pull request should it be needed based on feedback. Seek to collaborate and produce the best possible contribution to the greater whole.

  • Correct — Does the change do what it’s supposed to? ie: code 100% fulfilling the requirements?
  • Secure — Would a nefarious party find some way to exploit this change? ie: everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities?
  • Readable — Will your future self be able to understand this change months down the road?
  • Elegant — Does the change fit aesthetically within the overall style and architecture?

Summary by CodeRabbit

  • New Features

    • Manual Orders: admins can enable/disable vendor order creation; vendors can create/manage manual orders.
    • Product Form Manager: admin controls for custom blocks/fields.
    • Store appearance: admin banner size control; expanded vendor management and verification visibility.
    • Payments: added Stripe & Stripe Express options; expanded analytics/reporting pages and vendor reports.
  • Tests

    • New/expanded e2e suites for vendor reports, coupons, and manual orders; many tests improved for stability and resiliency.
  • Documentation

    • Added comprehensive E2E testing guide.

dev-shahed and others added 30 commits August 21, 2025 17:53
- Improved error handling in the AbuseReportsPage to continue execution despite AJAX failures, providing fallback options for selecting filters and handling bulk actions.
- Updated selectors in the selectors.ts file for better flexibility in identifying report elements.
- Added comprehensive checks in VendorReportsPage for rendering, navigation, and data validation, including responsiveness and accessibility tests.
- Introduced new methods for filtering and exporting reports, ensuring robust interaction with the analytics dashboard.
- Adjusted test cases to use safer actions and improved logging for better traceability during test execution.
* fix: Shortcode templates fields not exists issue.

* fix: update coupon section text for consistency.
…dation. (#2872)

* fix: Coupon creation execution by ensuring proper load state and validation.

* fix: update coupon selector text for consistency in the marketplace
refactor: enhance abuse reports and vendor reports functionality
fix: update env:setup script in package.json to include NO_SETUP flag…
…ity checks

- Changed visibility check for admin notices container to a more specific selector.
- Updated the dashboard text selector to use a normalized space query for consistency.
- Modified the expectTotalNotices method to remove the count parameter and focus on visibility of a specific notice.
- Skipped the vendor analytics test suite for future implementation.
refactor: update admin notice page and selectors for improved visibil…
test: skip Product AI test suite and add tag to product title test
… tests

- Refactored CouponsPage class to improve structure and readability.
- Added new methods for navigating and managing coupons, including creating, searching, and verifying coupons.
- Updated e2e tests to utilize the refactored CouponsPage class, ensuring better organization and clarity in test cases for admin, vendor, and customer coupon functionalities.
…ure and data handling

- Refactored coupon management tests to utilize a centralized test data structure for better maintainability.
- Implemented cleanup logic to remove test coupons after all tests are completed.
- Updated test cases for admin and vendor coupon functionalities to improve clarity and organization.
- Ensured consistent usage of Playwright's page interactions across all test scenarios.
- Updated the CouponsPage class to include additional locators and methods for better organization and maintainability.
- Refactored test cases to utilize the new CouponsPage methods, improving clarity and reducing redundancy.
- Ensured consistent handling of coupon creation, verification, and management across admin and vendor functionalities.
- Improved test data structure for easier updates and maintenance.
refactor: restructure CouponsPage class and enhance coupon management…
feat: enhance environment variable typing in testData.ts for better t…
- Restored and organized selectors for category selection, radius slider, and search button in the selectors.ts file.
- Removed outdated merge conflict markers to ensure clean code.
- Temporarily disabled the background color assertion for the menu switcher to address potential test flakiness.
- Temporarily commented out the upgradePlan selector to improve code readability and maintainability.
- Temporarily skipped the Printful module functionality test to address potential test flakiness and improve overall test reliability.
- Skipped the Printful module functionality test as it requires individual setup with client Key and Secret Key, which is not currently configured.
… menu status updates and renaming functionality. Update related test cases to utilize vendor context for verification.
…total modules to 42, store management to 11, payment to 7, and vendor management to 2.
…or strategies and streamline input handling. Update tracking number and comments input methods for improved clarity and efficiency.
…sPage to prevent redundant actions during shipment addition process.
@shohan0120 shohan0120 requested a review from mrabbani November 3, 2025 08:45
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

Coercion of Playwright slowMo env to Number; added NO_SETUP prefixes and .gitignore entry; large Playwright E2E test overhaul with locator/wait hardening, new/removed page objects and tests, many suites skipped, feature-map/testData expansions, and several page-object API changes.

Changes

Cohort / File(s) Summary
Config & Scripts
tests/pw/playwright.config.ts, tests/pw/e2e.config.ts, tests/pw/package.json, .gitignore
Coerce SLOWMO via Number(...) * 1000, prefix Playwright commands with NO_SETUP=true, add test-results/ to .gitignore.
Feature map & Test Data
tests/pw/feature-map/feature-map.yml, tests/pw/utils/testData.ts
Added many feature flags/pages (Manual Orders, Product Form Manager, analytics, payments, vendor controls); typed env destructuring; new dashboard/report paths; product URL mapping and module stat updates.
Core helpers & selectors
tests/pw/pages/basePage.ts, tests/pw/pages/selectors.ts
Added gotoUrl, stronger navigation/wait semantics, element pre-scroll/visibility waits, updated XPaths and broader selectors for robustness.
Resilient actions & flows
tests/pw/pages/abuseReportsPage.ts, tests/pw/pages/ordersPage.ts, tests/pw/pages/productsPage.ts, tests/pw/pages/productAddonsPage.ts
Converted fragile AJAX-dependent flows to try/catch/fallbacks, added domcontentloaded/networkidle waits, guarded interactions, and safer submit/apply flows.
Admin & vendor page objects (new/expanded)
tests/pw/pages/newCouponsPage.ts, tests/pw/pages/manualOrderPage.ts, tests/pw/pages/adminDashboardPage.ts, tests/pw/pages/vendorReportsPage.ts
Added newCouponsPage with full coupon workflows; manualOrderPage gained vendor enable/disable helpers and testData; adminDashboardPage split into modular checks; vendorReportsPage expanded with analytics/report helpers and API integration.
Page object adjustments & removals
tests/pw/pages/couponsPage.ts, tests/pw/pages/menuManagerPage.ts, tests/pw/pages/followStorePage.ts, tests/pw/pages/adminNoticePage.ts, tests/pw/pages/vendorVerificationsPage.ts, tests/pw/pages/vendorAuctionsPage.ts, tests/pw/pages/shortcodePage.ts, tests/pw/pages/vendorDashboardPage.ts
Removed legacy couponsPage.ts; updated several method signatures (e.g., expectTotalNotices, viewVerificationMethods), added optional vendor-page parameters, simplified navigation checks, and relaxed some post-action assertions.
E2E tests — added / updated / removed
tests/pw/tests/e2e/newCoupons.spec.ts, tests/pw/tests/e2e/ManualOrder.spec.ts, tests/pw/tests/e2e/menuManager.spec.ts, tests/pw/tests/e2e/coupons.spec.ts, many tests/pw/tests/e2e/*
New coupons suite using newCouponsPage; ManualOrder tests made data-driven with global enable/disable setup/teardown; menuManager uses vendor context and API plugin checks; old coupons suite deleted; many suites/tests converted to test.describe.skip/test.skip.
Utilities & API helpers
tests/pw/utils/apiUtils.ts
Added getSellerIdByUsername(...), improved createStore failure handling and guarded downstream updates.
Docs
tests/pw/e2eReadme.md
Added comprehensive local E2E testing guide and commands.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Admin as Admin test
    participant ManualPage as ManualOrderPage
    participant Backend as API
    rect rgba(120,150,255,0.08)
    Admin->>ManualPage: goToVendorsPage()
    ManualPage->>Backend: GET /vendors?search=vendorName
    Backend-->>ManualPage: vendor found (id)
    ManualPage->>Backend: PATCH /vendors/{id}/settings { orderCreation: true }
    Backend-->>ManualPage: 200 OK
    ManualPage-->>Admin: enabled confirmation
    end
Loading
sequenceDiagram
    autonumber
    participant Vendor as Vendor test
    participant UI as Frontend
    participant Backend as API
    rect rgba(120,200,150,0.06)
    Vendor->>UI: navigate to Orders (goIfNotThere)
    UI-->>Vendor: Orders page loaded
    Vendor->>UI: click Add New Order (pre-checks, waits)
    UI->>Backend: GET products/search?q=...
    alt network OK
      Backend-->>UI: product list
      Vendor->>UI: fill product/customer/fee, saveOrder()
      UI->>Backend: POST /orders
      Backend-->>UI: 201 Created
      UI-->>Vendor: success toast
    else network flaky
      UI->>Vendor: fallback selectors/inputs used, guarded submit
      UI-->>Vendor: may log and continue
    end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas to focus:

  • tests/pw/pages/abuseReportsPage.ts — many fallbacks may mask real failures.
  • tests/pw/pages/basePage.ts — navigation/wait semantics affect broad surface.
  • tests/pw/pages/manualOrderPage.ts & tests/pw/tests/e2e/ManualOrder.spec.ts — new vendor enable/disable helpers and data-driven flows.
  • tests/pw/pages/vendorReportsPage.ts & new vendor_reports tests — API integration and many new methods.
  • tests/pw/pages/newCouponsPage.ts & newCoupons.spec.ts — ensure parity with removed coupons flows and cleanup logic.

Possibly related PRs

Suggested labels

Test Automation, Need Dev Review Only

Suggested reviewers

  • mrabbani
  • shohag121

Poem

🐰
I hopped through locators, gentle and spry,
Coerced slowMo numbers so tests no longer cry.
Coupons reborn, old suites set free,
Vendors can order — hip-hop hooray for me!
A carrot-coded cheer for smoother CI. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is entirely empty template boilerplate with no filled-in sections; all proposed changes, testing steps, and changelog information are missing or blank, providing no context for reviewers. Fill in 'Changes proposed in this Pull Request' with a summary of modifications, add testing instructions, provide changelog entry, and complete other relevant sections to document the PR's purpose and scope.
Title check ❓ Inconclusive The PR title 'All/e2e fix' is vague and generic, using abbreviated terminology that does not clearly convey the specific changes or main purpose of the extensive modifications across multiple E2E test files. Replace with a more descriptive title that summarizes the primary focus, such as 'Refactor E2E tests: skip non-critical suites and improve robustness' or similar that reflects the main changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch all/e2e-fix

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 945e63a and 454c5e9.

📒 Files selected for processing (2)
  • tests/pw/package.json (1 hunks)
  • tests/pw/tests/e2e/products.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/pw/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: e2e tests (1, 3)
  • GitHub Check: e2e tests (2, 3)
  • GitHub Check: e2e tests (3, 3)
  • GitHub Check: api tests (1, 1)
🔇 Additional comments (1)
tests/pw/tests/e2e/products.spec.ts (1)

7-7: Clarify the reason for skipping the entire product test suite.

Skipping this suite removes E2E coverage for critical product functionality (creation, editing, filtering, import/export). The suite contains 32 tests, all now skipped without explanation or documentation. While other skipped tests throughout the codebase include inline comments explaining the rationale (e.g., "need to update create dokan subscription product", "Has Dokan Issue download limit & expiry does not reset"), line 7 provides no context.

Please:

  1. Add a comment above line 7 explaining why the suite is skipped (temporary, blocked by issue, refactoring, etc.)
  2. Reference a tracking issue if this is work-in-progress
  3. Update the PR description with the rationale

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 21

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/pw/pages/vendorAuctionsPage.ts (1)

381-405: Restore post-save tag verification to align with established patterns.

The commented assertion at line 403 removes the only verification that tags persist after saving. This breaks the established pattern used throughout the codebase:

  • productsPage.ts addProductTags() (lines 1006-1008) has post-save verification
  • vendorAuctionsPage.ts removeProductTags() (lines 411-413) has post-save verification
  • productsPage.ts removeProductTags() (lines 1025-1027) has post-save verification

Without this check, the test can pass even if the save operation fails, creating a false positive.

Additional issues:

  • Line 402's focus operation is now orphaned and serves no purpose; remove it if the assertion remains disabled
  • Lines 390-397's commented block with TODO suggests implementation uncertainty; clarify the intent and remove obsolete code

Restore the assertion or replace it with a retry mechanism (toPass) if flakiness is the issue. Document any known issues with a TODO comment linking to a tracking ticket.

tests/pw/pages/manualOrderPage.ts (1)

79-107: Fix the toggle state detection

allowVendorOrdersToggle resolves to the slider <span>, but isChecked() only works on checkbox or radio inputs. Right now both enableVendorOrderCreation and disableVendorOrderCreation throw before they can toggle anything. Please query the hidden <input type="checkbox"> for the state check (you can keep clicking the slider for the user-facing action).

@@
-        const toggle = this.page.locator(this.adminLocators.allowVendorOrdersToggle);
-        const isEnabled = await toggle.isChecked();
+        const toggle = this.page.locator(this.adminLocators.allowVendorOrdersToggle);
+        const toggleCheckbox = this.page.locator('fieldset:has-text("Allow Vendors to Create Orders") input[type="checkbox"]');
+        const isEnabled = await toggleCheckbox.isChecked();
@@
-            await toggle.click();
+            await toggle.click();
@@
-        const toggle = this.page.locator(this.adminLocators.allowVendorOrdersToggle);
-        const isEnabled = await toggle.isChecked();
+        const toggle = this.page.locator(this.adminLocators.allowVendorOrdersToggle);
+        const toggleCheckbox = this.page.locator('fieldset:has-text("Allow Vendors to Create Orders") input[type="checkbox"]');
+        const isEnabled = await toggleCheckbox.isChecked();
🧹 Nitpick comments (19)
tests/pw/tests/e2e/wholesale.spec.ts (2)

10-11: Reference a tracking issue for the skipped admin test suite.

The placeholder comment lacks specificity about which tests are flaky or why. Future maintainers won't have sufficient context to determine when or how to re-enable these tests.

Consider replacing the generic comment with a tracking issue reference (e.g., JIRA ticket, GitHub issue) that documents the flakiness and what needs to be fixed.

-// Need to rewrite because it has flaky test cases
-test.describe.skip('Wholesale test (admin)', () => {
+// TODO: GH-XXXX - Re-enable after fixing flaky wholesale admin tests
+test.describe.skip('Wholesale test (admin)', () => {

160-165: Consolidate the test-skipping strategy for consistency.

The customer test suite uses inline test.skip() calls (lines 160, 165, 181) with generic @todo placeholders, while the admin suite skips the entire describe block. This inconsistency makes it unclear whether the customer suite's individual skipped tests are intentional omissions or temporary disables.

Consider either:

  1. Standardize on suite-level skipping if most customer tests are flaky
  2. Use structured skip reasons if keeping individual test skips (e.g., with issue references)

Example for option 2:

-test.skip(true, '@todo fix this test');
+test.skip(true, 'GH-XXXX: Flaky wholesale price display logic');

Also applies to: 181-181

tests/pw/tests/e2e/help.spec.ts (1)

23-25: Test skip acknowledged.

The change to skip this test is safe and aligns with the broader test stabilization effort mentioned in the PR summary.

Consider adding a brief comment explaining why this test is skipped (e.g., flaky, needs rework, blocked by issue #XXXX) to help future maintainers understand the context.

Example:

+    // TODO: Re-enable after fixing flaky dropdown behavior (issue #XXXX)
     test.skip('admin can view get help dropdown', { tag: ['@lite', '@exploratory', '@admin'] }, async () => {
         await admin.adminGetHelpDropdownRenderProperly();
     });
tests/pw/tests/e2e/productsDetailsAuction.spec.ts (2)

84-87: Remove commented code.

The test is already skipped at line 85, so the commented-out line 86 serves no purpose. Remove it to keep the codebase clean.

Apply this diff:

 test('vendor can add auction product tags', { tag: ['@pro', '@vendor'] }, async () => {
     test.skip(true, 'dokan issue option does not work');
-    //await vendor.addProductTags(productIdBasic, data.product.productInfo.tags.tags);
 });

100-102: Consider adding a skip reason for clarity.

While using test.skip() is valid, providing a reason (as done in other skipped tests at lines 85, 167, 193, etc.) would improve maintainability and help others understand why this test is disabled.

For consistency with the file's pattern, consider:

-test.skip('vendor can add auction product cover image', { tag: ['@pro', '@vendor'] }, async () => {
+test('vendor can add auction product cover image', { tag: ['@pro', '@vendor'] }, async () => {
+    test.skip(true, 'reason for skipping');
     await vendor.addProductCoverImage(productIdBasic, data.product.productInfo.images.cover);
 });
tests/pw/tests/e2e/vendorReturnRequest.spec.ts (3)

10-10: Link this comment to a tracked issue.

The comment indicates a need to rewrite the test suite but lacks a reference to a tracking issue or ticket. Consider converting this to a TODO with an issue reference to ensure the work is tracked and prioritized.

Apply this diff to improve tracking:

-// Need to rewrite full test because of new return request page
+// TODO(#ISSUE_NUMBER): Rewrite test suite for new return request page

9-9: Consider removing commented-out code.

The commented-out constants and alternative API implementations add noise without providing value. If this code is no longer needed, remove it. If it's useful as reference for the rewrite, rely on version control history instead.

Apply this diff to clean up:

-// const { CUSTOMER_ID, PRODUCT_ID } = process.env;
-// Need to rewrite full test because of new return request page
+// Need to rewrite full test because of new return request page

 test.describe.skip('Vendor RMA test', () => {

And remove lines 46-47:

         apiUtils = new ApiUtils(await request.newContext());
-
-        // [,, orderId, ] = await apiUtils.createOrderWithStatus(PRODUCT_ID, { ...payloads.createOrder, customer_id: CUSTOMER_ID }, data.order.orderStatus.processing, payloads.vendorAuth);
-        // [,, orderId, ] = await apiUtils.createOrderWithStatus(payloads.createProduct(), { ...payloads.createOrder, customer_id: CUSTOMER_ID }, data.order.orderStatus.processing, payloads.vendorAuth);
     });

Also applies to: 46-47


114-114: Redundant skip directive.

This test uses test.skip inside a test.describe.skip block, making the inner skip redundant. While this doesn't affect functionality, you could remove the inner .skip if the entire suite remains skipped, or keep it if you plan to re-enable the suite selectively.

tests/pw/pages/ordersPage.ts (1)

237-238: Implement missing assertions to validate shipment creation.

The TODO comments indicate that assertions are missing to verify successful shipment creation. Without these assertions, the test may pass even if the shipment was not created correctly.

Do you want me to suggest assertions for the shipment creation success? For example:

  • Verify success message appears
  • Verify shipment #1 is visible in the order details
  • Verify shipment details match the input data
tests/pw/tests/e2e/vendorAnalytics.spec.ts (1)

7-7: Consider adding an explanatory comment for consistency.

Other skipped test suites in this PR include comments explaining why they're skipped (e.g., withdraws.spec.ts, productReviews.spec.ts, printful.spec.ts). Adding a brief comment here would improve maintainability.

tests/pw/pages/selectors.ts (9)

284-284: Prefer role-based heading to reduce brittleness and i18n issues.

Using exact text "Dashboard" ties tests to English and DOM tag. Consider a role selector.

-                dashboardText: "//h1[normalize-space()='Dashboard']",
+                dashboardText: 'role=heading[name=/Dashboard/i][level=1]',

1471-1471: Remove or justify commented-out selector.

Dead code invites drift. Delete it or add a note why it’s intentionally disabled and where it’s covered.


3437-3437: Handle both “Publish” and “Update” and standardize selector engine.

WP switches label after first save; role selector is clearer and resilient.

-                publish: "//input[@id='publish']",
+                publish: 'role=button[name=/Publish|Update/i]',

3894-3894: Avoid index-based anchor; target by role/text.

nth(1) is fragile if links reorder (Import/Export). Prefer accessible name.

-                addNewProduct: "//span[@class='dokan-add-product-link']//a[1]",
+                addNewProduct: 'role=link[name=/Add( | )?(New|Product)/i]',

4722-4723: Simplify union with a role selector and keep i18n in mind.

Large XPath unions are harder to maintain; role selector captures both cases.

-            reportsText: '//h1[normalize-space()="Reports"] | //h1[normalize-space()="Analytics"] | //div[contains(@class, "reports")]//h1 | //div[contains(@class, "analytics")]//h1',
+            reportsText: 'role=heading[name=/Reports|Analytics/i][level=1]',

7236-7238: Confirm the target is interactive.

#dokan-geo-product-categories-root looks like a container; ensure it’s the clickable control (or point to its input/combobox).


7415-7415: Narrow “Report” trigger to avoid accidental matches.

Generic a:has-text("Report")/button:has-text("Report") may hit unrelated links. Prefer role + name.

-                reportAbuse: 'a.dokan-report-abuse-button, button.dokan-report-abuse-button, .report-abuse-button, a:has-text("Report"), button:has-text("Report")',
+                reportAbuse: 'role=button[name=/^Report( Abuse)?$/i], a.dokan-report-abuse-button, button.dokan-report-abuse-button, .report-abuse-button',

7417-7417: Leverage accessible labels for reasons.

XPath unions here are brittle; radio/checkbox reasons usually expose labels.

-                reportReasonByName: (reasonName: string) => `//input[@value='${reasonName}']/.. | //label[contains(text(), '${reasonName}')]/input/.. | //div[contains(text(), '${reasonName}')]/input/..`,
+                reportReasonByName: (reasonName: string) => `role=radio[name="${reasonName}"], role=checkbox[name="${reasonName}"]`,

7939-7941: Support both “Add coupon” and “Add coupons”.

Text varies between classic and block cart; handle both.

-            addCoupon: '//div[text()="Add coupons"]',
+            addCoupon: '//div[normalize-space()="Add coupons" or normalize-space()="Add a coupon"]',
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be5afb8 and 36b81d1.

📒 Files selected for processing (53)
  • test-results/.last-run.json (1 hunks)
  • tests/pw/e2e.config.ts (1 hunks)
  • tests/pw/feature-map/feature-map.yml (26 hunks)
  • tests/pw/package.json (1 hunks)
  • tests/pw/pages/abuseReportsPage.ts (1 hunks)
  • tests/pw/pages/adminDashboardPage.ts (1 hunks)
  • tests/pw/pages/adminNoticePage.ts (1 hunks)
  • tests/pw/pages/basePage.ts (6 hunks)
  • tests/pw/pages/couponsPage.ts (0 hunks)
  • tests/pw/pages/followStorePage.ts (1 hunks)
  • tests/pw/pages/manualOrderPage.ts (7 hunks)
  • tests/pw/pages/menuManagerPage.ts (5 hunks)
  • tests/pw/pages/newCouponsPage.ts (1 hunks)
  • tests/pw/pages/ordersPage.ts (2 hunks)
  • tests/pw/pages/productAddonsPage.ts (1 hunks)
  • tests/pw/pages/productQAPage.ts (1 hunks)
  • tests/pw/pages/productsPage.ts (5 hunks)
  • tests/pw/pages/selectors.ts (10 hunks)
  • tests/pw/pages/shortcodePage.ts (0 hunks)
  • tests/pw/pages/vendorAuctionsPage.ts (1 hunks)
  • tests/pw/pages/vendorDashboardPage.ts (1 hunks)
  • tests/pw/pages/vendorReportsPage.ts (2 hunks)
  • tests/pw/pages/vendorVerificationsPage.ts (1 hunks)
  • tests/pw/playwright.config.ts (1 hunks)
  • tests/pw/tests/e2e/ManualOrder.spec.ts (3 hunks)
  • tests/pw/tests/e2e/VednorReports.spec.ts (1 hunks)
  • tests/pw/tests/e2e/_auth.setup.ts (1 hunks)
  • tests/pw/tests/e2e/abuseReports.spec.ts (1 hunks)
  • tests/pw/tests/e2e/adminNotice.spec.ts (1 hunks)
  • tests/pw/tests/e2e/ai.spec.ts (1 hunks)
  • tests/pw/tests/e2e/coupons.spec.ts (0 hunks)
  • tests/pw/tests/e2e/dashboard.spec.ts (1 hunks)
  • tests/pw/tests/e2e/followStore.spec.ts (2 hunks)
  • tests/pw/tests/e2e/help.spec.ts (1 hunks)
  • tests/pw/tests/e2e/menuManager.spec.ts (1 hunks)
  • tests/pw/tests/e2e/newCoupons.spec.ts (1 hunks)
  • tests/pw/tests/e2e/printful.spec.ts (1 hunks)
  • tests/pw/tests/e2e/productAdvertising.spec.ts (2 hunks)
  • tests/pw/tests/e2e/productReviews.spec.ts (1 hunks)
  • tests/pw/tests/e2e/productsDetailsAuction.spec.ts (2 hunks)
  • tests/pw/tests/e2e/vendorAnalytics.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorBooking.fast.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorBooking.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorDeliveryTime.spec.ts (2 hunks)
  • tests/pw/tests/e2e/vendorReturnRequest.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorSettings.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorShipping.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorStaff.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorVerifications.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendor_reports.spec.ts (1 hunks)
  • tests/pw/tests/e2e/wholesale.spec.ts (1 hunks)
  • tests/pw/tests/e2e/withdraws.spec.ts (1 hunks)
  • tests/pw/utils/testData.ts (6 hunks)
💤 Files with no reviewable changes (3)
  • tests/pw/pages/shortcodePage.ts
  • tests/pw/tests/e2e/coupons.spec.ts
  • tests/pw/pages/couponsPage.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-19T06:19:41.376Z
Learnt from: mrabbani
Repo: getdokan/dokan PR: 2891
File: src/admin/dashboard/pages/vendors-single/InformationTabs/WithdrawTab.tsx:58-59
Timestamp: 2025-09-19T06:19:41.376Z
Learning: The Dokan codebase uses 'dokan-lite' as the text domain for WordPress internationalization (__() function calls).

Applied to files:

  • tests/pw/utils/testData.ts
🧬 Code graph analysis (17)
tests/pw/tests/e2e/wholesale.spec.ts (1)
tests/pw/fixtures/page.ts (1)
  • test (141-409)
tests/pw/tests/e2e/vendorStaff.spec.ts (1)
tests/pw/fixtures/page.ts (1)
  • test (141-409)
tests/pw/pages/menuManagerPage.ts (1)
tests/pw/utils/testData.ts (1)
  • data (105-2960)
tests/pw/pages/ordersPage.ts (3)
tests/pw/utils/testData.ts (1)
  • data (105-2960)
tests/pw/pages/selectors.ts (1)
  • selector (3-8247)
tests/pw/utils/helpers.ts (1)
  • helpers (7-554)
tests/pw/tests/e2e/followStore.spec.ts (2)
tests/pw/utils/dbUtils.ts (1)
  • dbUtils (20-256)
tests/pw/utils/payloads.ts (1)
  • payloads (9-5094)
tests/pw/tests/e2e/vendorBooking.spec.ts (1)
tests/pw/fixtures/page.ts (1)
  • test (141-409)
tests/pw/pages/abuseReportsPage.ts (2)
tests/pw/utils/interfaces.ts (1)
  • product (45-468)
tests/pw/utils/helpers.ts (1)
  • helpers (7-554)
tests/pw/tests/e2e/ManualOrder.spec.ts (1)
tests/pw/pages/manualOrderPage.ts (1)
  • ManualOrderPage (3-387)
tests/pw/tests/e2e/productAdvertising.spec.ts (2)
tests/pw/utils/payloads.ts (1)
  • payloads (9-5094)
tests/pw/pages/vendorAuctionsPage.ts (1)
  • AuctionsPage (16-764)
tests/pw/pages/vendorVerificationsPage.ts (1)
tests/pw/utils/testData.ts (1)
  • data (105-2960)
tests/pw/tests/e2e/menuManager.spec.ts (1)
tests/pw/pages/menuManagerPage.ts (1)
  • MenuManagerPage (11-139)
tests/pw/pages/followStorePage.ts (3)
tests/pw/pages/selectors.ts (1)
  • selector (3-8247)
tests/pw/utils/testData.ts (1)
  • data (105-2960)
tests/pw/utils/helpers.ts (1)
  • helpers (7-554)
tests/pw/tests/e2e/newCoupons.spec.ts (1)
tests/pw/pages/newCouponsPage.ts (1)
  • newCouponsPage (3-340)
tests/pw/tests/e2e/abuseReports.spec.ts (1)
tests/pw/utils/interfaces.ts (1)
  • admin (2-5)
tests/pw/tests/e2e/vendor_reports.spec.ts (3)
tests/pw/pages/vendorReportsPage.ts (1)
  • VendorReportsPage (10-518)
tests/pw/utils/apiUtils.ts (1)
  • ApiUtils (9-2499)
tests/pw/utils/testData.ts (1)
  • data (105-2960)
tests/pw/pages/vendorReportsPage.ts (2)
tests/pw/pages/selectors.ts (1)
  • selector (3-8247)
tests/pw/utils/apiUtils.ts (1)
  • ApiUtils (9-2499)
tests/pw/pages/productsPage.ts (2)
tests/pw/utils/testData.ts (1)
  • data (105-2960)
tests/pw/pages/selectors.ts (1)
  • selector (3-8247)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: e2e tests (1, 3)
  • GitHub Check: api tests (1, 1)
  • GitHub Check: e2e tests (2, 3)
  • GitHub Check: e2e tests (3, 3)
🔇 Additional comments (25)
tests/pw/pages/ordersPage.ts (1)

198-198: Line 198 already exists in HEAD — review comment may be analyzing non-existent changes.

Based on git history inspection, the await this.press(data.key.enter); statement at line 198 was already present before this PR. The Enter key press pattern is common throughout the codebase (found in 20+ locations across test files) and is typically used to dismiss autocomplete dropdowns or trigger field validation.

However, unable to retrieve the diff to definitively confirm which lines actually changed in this PR. The review comment may be mislabeling existing code as new additions.

tests/pw/pages/menuManagerPage.ts (2)

60-74: LGTM!

The optional vendorPage parameter follows the same cross-context verification pattern as updateMenuStatus. The implementation correctly verifies the renamed menu in the vendor dashboard when a vendor context is provided.


23-38: Type safety concern with 'as any' is valid but unfounded for current usage.

The properties referenced via menuLink do exist: both 'analytics' and 'userSubscriptions' are defined in selector.vendor.vDashboard.menus.primary (selectors.ts lines 3795, 3779) and in data.subUrls.frontend.vDashboard (testData.ts lines 1249, 1223). The current implementation will not cause runtime errors.

However, using as any to bypass type checking remains a maintainability concern. If new menuLink values are added without corresponding properties in either data structure, this would fail at runtime. Consider typing the object keys directly or validating menuLink against known values to maintain type safety.

tests/pw/tests/e2e/menuManager.spec.ts (4)

1-7: LGTM!

The additional imports (request, ApiUtils, payloads) are necessary to support the API-based plugin check introduced in the activate test.


11-21: LGTM!

The vendor context setup properly creates a second browser context with vendor authentication, enabling cross-context verification in the tests. The vendor page is correctly closed in afterAll (line 27).


33-33: LGTM!

Passing the vendor context enables verification of the menu deactivation from the vendor perspective.


58-58: LGTM!

Passing the vendor context enables verification of the menu rename from the vendor perspective.

tests/pw/tests/e2e/vendorStaff.spec.ts (1)

6-8: Clear communication about test suite status.

The comment clearly explains why the first test suite is being skipped, which helps maintainers understand this is a temporary state during the Staff page rewrite.

tests/pw/package.json (1)

18-18: Verify the NO_SETUP flag behavior change.

The env:setup script now includes NO_SETUP=true, which changes its runtime behavior. This aligns with the pattern used in auth:setup (line 19), but differs from site:reset (line 16) which explicitly sets NO_SETUP=false.

Please confirm:

  1. What does the NO_SETUP flag control in the test setup process?
  2. Is this change intentional, and what impact will it have on the test environment setup?
  3. Should this change be documented in the PR description?
tests/pw/pages/productAddonsPage.ts (1)

63-64: LGTM - Improves test stability.

Adding an explicit networkidle wait after creating a new addon ensures all network requests have completed before proceeding with subsequent interactions. This is a good defensive practice that should reduce test flakiness.

tests/pw/tests/e2e/vendorShipping.spec.ts (1)

6-6: Test suite skipped pending rewrite.

Similar to the vendorStaff tests, this suite is being skipped during the Shipping page rewrite. The comment on line 4 provides clear context.

tests/pw/tests/e2e/vendorBooking.spec.ts (3)

11-11: Question: Why improve a skipped test suite?

The test suite is being skipped, yet substantial improvements were made throughout this file (retry logic, error handling, timeout optimization). This suggests effort was invested in making the tests more robust.

  • Is this suite intended to be re-enabled soon after these improvements?
  • If the suite remains skipped indefinitely, should these improvements be applied to the active test suite instead?
  • Consider adding a TODO or issue reference explaining when this suite will be re-enabled.

37-54: Excellent retry logic with exponential backoff.

The retry mechanism for API product creation is well-implemented with:

  • Clear max attempts limit
  • Exponential backoff timing (0.5s, 1s, 2s)
  • Helpful console logging
  • Proper error propagation after max attempts

This pattern should improve test reliability when dealing with potentially flaky API operations.


65-97: Robust cleanup with error handling.

The comprehensive error handling in the afterAll block ensures that:

  • Cleanup operations don't fail silently
  • Partial failures don't prevent subsequent cleanup steps
  • Diagnostic information is logged for debugging

This is a best practice for test teardown logic.

tests/pw/tests/e2e/vendorBooking.fast.spec.ts (1)

8-8: Fast variant also skipped.

Both the regular booking test suite (vendorBooking.spec.ts) and this fast execution variant are now skipped.

When re-enabling these tests:

  • Should both variants be maintained, or is one preferred?
  • The fast variant uses better test isolation patterns (individual browser contexts per test) - consider applying these patterns to the regular suite if it becomes the primary version.
tests/pw/tests/e2e/withdraws.spec.ts (1)

8-9: Test suite appropriately skipped with clear documentation.

The comment explains the reason for skipping (new Withdraw page requires rewrite), which helps maintain context for future work.

tests/pw/tests/e2e/productReviews.spec.ts (1)

8-9: Test suite appropriately skipped with clear documentation.

The comment explains the reason for skipping (new Product Review test cases needed), which helps maintain context for future work.

tests/pw/playwright.config.ts (1)

107-107: Good defensive coding with explicit type coercion.

Explicitly coercing SLOWMO to a number is safer since environment variables are always strings. This prevents potential edge cases and makes the intent clearer.

tests/pw/e2e.config.ts (1)

107-107: Good defensive coding with explicit type coercion.

Explicitly coercing SLOWMO to a number is safer since environment variables are always strings. This change is consistent with the same update in tests/pw/playwright.config.ts.

tests/pw/pages/vendorDashboardPage.ts (1)

23-23: Default dashboard navigation updated to new URL.

The change redirects to the new React-based dashboard (newDashboard with analytics/Overview path) when no specific link is provided. The existing logic already handles both React and traditional dashboards appropriately.

tests/pw/tests/e2e/printful.spec.ts (1)

6-7: Test suite appropriately skipped with clear documentation.

The comment explains that the tests require individual Printful account setup with client credentials, which justifies the skip for general test runs.

tests/pw/pages/adminNoticePage.ts (1)

26-29: No API compatibility issues found.

The verification confirms that the single call site at tests/pw/tests/e2e/adminNotice.spec.ts:82 is already correctly updated. The method expectTotalNotices() is invoked without arguments, matching the new signature that no longer accepts a count parameter. No further action is needed.

tests/pw/pages/productQAPage.ts (1)

305-309: Navigation guard keeps vendor flow stable.

Switching to goIfNotThere keeps this helper consistent with the rest of the vendor QA flows while avoiding redundant reloads. Looks good.

tests/pw/pages/vendorVerificationsPage.ts (1)

382-392: Setup-wizard visibility check looks good.

Verifying both required and optional verification methods keeps the flow honest and matches the updated scenario. Thanks for tightening this assertion.

tests/pw/pages/selectors.ts (1)

4023-4027: LGTM: more specific "Schedule" trigger.

Comment on lines 1 to 4
{
"status": "failed",
"failedTests": []
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Test artifacts should not be committed to version control.

This file appears to be a test run artifact that will change with every test execution. Committing such files creates unnecessary repository churn and can cause merge conflicts.

Consider:

  1. Adding test-results/ to .gitignore to prevent these files from being committed
  2. Removing this file from the commit
#!/bin/bash
# Check if test-results is already in .gitignore
rg -n "test-results" .gitignore
🤖 Prompt for AI Agents
In test-results/.last-run.json lines 1 to 4, this file is a transient test
artifact that should not be committed; remove the file from the commit and add
the test-results/ directory (or the specific file pattern) to .gitignore so
future test artifacts are not tracked, then run git rm --cached on the file if
already tracked and commit the updated .gitignore.

Comment on lines +265 to 266
admin can add Strip Express payment method: true
vendor:
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix payment-method capability typo

The new capability says “Strip Express”, which breaks the Stripe naming convention used elsewhere. Please correct it to “Stripe Express”.

-          admin can add Strip Express payment method: true
+          admin can add Stripe Express payment method: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
admin can add Strip Express payment method: true
vendor:
admin can add Stripe Express payment method: true
vendor:
🤖 Prompt for AI Agents
In tests/pw/feature-map/feature-map.yml around lines 265 to 266, the capability
string contains a typo "Strip Express"; update it to "Stripe Express" so it
matches the Stripe naming used elsewhere in the test suite and maintain
consistency.

Comment on lines +1303 to 1304
admin can RMA module: true
admin can disable RMA module: true
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Clarify RMA capability entry

“admin can RMA module” drops the verb and duplicates the preceding flag, so the meaning is unclear. Please rename it (for example, “admin can enable RMA module”) or remove it if it isn’t needed.

🤖 Prompt for AI Agents
In tests/pw/feature-map/feature-map.yml around lines 1303 to 1304, the entry
"admin can RMA module: true" is unclear and duplicates the adjacent flag; rename
it to a clear verb form such as "admin can enable RMA module: true" (or another
precise action like "admin can perform RMA on module" or "admin can manage RMA
module") or remove the line if it is redundant, and ensure the YAML keys remain
consistent with other feature-map entries.

Comment on lines +1408 to 1409
admin can store support module: true
admin can disable store support module: true
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Correct store support capability text

“admin can store support module” is missing the action verb. Align it with the other entries (e.g., “admin can enable store support module”) so downstream tooling can rely on the key.

🤖 Prompt for AI Agents
In tests/pw/feature-map/feature-map.yml around lines 1408 to 1409, the key
"admin can store support module: true" lacks an action verb and should be
aligned with the neighboring entry; change it to "admin can enable store support
module: true" (or the canonical wording used elsewhere) so downstream tooling
can reliably parse capability keys and keep the "admin can disable store support
module: true" entry unchanged.

Comment on lines +140 to +145
try {
await this.notToHaveText(abuseReportAdmin.numberOfRowsFound, '0 items');
await this.notToBeVisible(abuseReportAdmin.noRowsFound);
} catch (error) {
console.log('No results found, but continuing...');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Don't swallow the filter assertions.

Catching and ignoring the failures from notToHaveText/notToBeVisible means the filter test now passes even when the table shows “0 items” or “No rows found,” masking real regressions. Please keep the logging if you want, but rethrow the failure so the test still fails when filters break.

Apply this diff:

         try {
             await this.notToHaveText(abuseReportAdmin.numberOfRowsFound, '0 items');
             await this.notToBeVisible(abuseReportAdmin.noRowsFound);
         } catch (error) {
-            console.log('No results found, but continuing...');
+            console.log('No results found, rethrowing for visibility...');
+            throw error;
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
try {
await this.notToHaveText(abuseReportAdmin.numberOfRowsFound, '0 items');
await this.notToBeVisible(abuseReportAdmin.noRowsFound);
} catch (error) {
console.log('No results found, but continuing...');
}
try {
await this.notToHaveText(abuseReportAdmin.numberOfRowsFound, '0 items');
await this.notToBeVisible(abuseReportAdmin.noRowsFound);
} catch (error) {
console.log('No results found, rethrowing for visibility...');
throw error;
}
🤖 Prompt for AI Agents
In tests/pw/pages/abuseReportsPage.ts around lines 140 to 145, the try/catch
swallows assertion failures from notToHaveText/notToBeVisible so filter
regressions are masked; remove the catch or, if you want to keep the console
log, rethrow the caught error after logging (e.g., console.log('No results
found, but continuing...', error); throw error) so the test still fails on
assertion failures.

const orderId = await vendor.buyProductAdvertising(productName, 'simple');
await apiUtils.updateOrderStatus(orderId, 'wc-completed', payloads.adminAuth);
await vendor.assertProductAdvertisementIsBought(productName, 'simple');
//await vendor.assertProductAdvertisementIsBought(productName, 'simple');
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep the purchase assertion active.

With the vendor.assertProductAdvertisementIsBought call commented out, the test will now pass even if the purchase fails, removing the only validation this scenario provided. Either keep the assertion or explicitly skip the whole test with a documented reason, but don’t neuter it.

Apply this diff:

-        //await vendor.assertProductAdvertisementIsBought(productName, 'simple');
+        await vendor.assertProductAdvertisementIsBought(productName, 'simple');
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//await vendor.assertProductAdvertisementIsBought(productName, 'simple');
await vendor.assertProductAdvertisementIsBought(productName, 'simple');
🤖 Prompt for AI Agents
In tests/pw/tests/e2e/productAdvertising.spec.ts around line 104, the purchase
verification call vendor.assertProductAdvertisementIsBought(...) was commented
out, which removes the test's validation and allows false positives; restore the
assertion (uncomment the call) so the test actually verifies the purchase
outcome, or if the check is intentionally unavailable, replace it by marking the
test as skipped with a clear comment and reason (e.g., test.skip(...) or add a
TODO and link to the blocking issue) so the intent is explicit.

const { PRODUCT_ID } = process.env;

test.describe('Reports test', () => {
test.describe.skip('Reports test', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Test suite skipped - consider fixing or removing the file.

This test suite has been disabled. Given the PR summary mentions "substantially refactors the Playwright end-to-end test suite" and the AI summary notes a new comprehensive VendorReports suite at tests/pw/tests/e2e/vendor_reports.spec.ts, consider whether this file should be deleted entirely rather than left in a skipped state.

Additionally, note the filename typo: "Vednor" should be "Vendor".

Is this file intended to be replaced by the new vendor_reports.spec.ts file? If so, please remove this file entirely to reduce maintenance burden.


🏁 Script executed:

#!/bin/bash
# Verify the existence and content of both test files
echo "=== Checking for VednorReports.spec.ts ==="
fd -type f 'VednorReports\.spec\.ts'

echo ""
echo "=== Checking for vendor_reports.spec.ts ==="
fd -type f 'vendor_reports\.spec\.ts'

echo ""
echo "=== Contents of VednorReports.spec.ts (first 20 lines) ==="
fd -type f 'VednorReports\.spec\.ts' -x head -20 {}

echo ""
echo "=== Checking for any other similar vendor-related test files ==="
fd -type f -e spec.ts | grep -i vendor

Length of output: 897


🏁 Script executed:

#!/bin/bash
# Verify file existence and content with corrected syntax
echo "=== Searching for VednorReports.spec.ts ==="
find . -name "VednorReports.spec.ts" 2>/dev/null

echo ""
echo "=== Searching for vendor_reports.spec.ts ==="
find . -name "vendor_reports.spec.ts" 2>/dev/null

echo ""
echo "=== All .spec.ts files in e2e directory ==="
find . -path "*/e2e/*.spec.ts" 2>/dev/null | sort

echo ""
echo "=== Contents of VednorReports.spec.ts (first 15 lines) ==="
find . -name "VednorReports.spec.ts" -exec head -15 {} \; 2>/dev/null

echo ""
echo "=== Contents of vendor_reports.spec.ts (first 15 lines) ==="
find . -name "vendor_reports.spec.ts" -exec head -15 {} \; 2>/dev/null

Length of output: 4916


🏁 Script executed:

#!/bin/bash
# Determine the scope and content of both files
echo "=== Test descriptions in VednorReports.spec.ts ==="
grep -n "test\(" ./tests/pw/tests/e2e/VednorReports.spec.ts | head -20

echo ""
echo "=== Test descriptions in vendor_reports.spec.ts ==="
grep -n "test\(" ./tests/pw/tests/e2e/vendor_reports.spec.ts | head -20

echo ""
echo "=== Check if ReportsPage (admin reports) is tested elsewhere ==="
grep -r "ReportsPage" ./tests/pw/tests/e2e/*.spec.ts | grep -v "VednorReports.spec.ts"

echo ""
echo "=== Full line count for each file ==="
wc -l ./tests/pw/tests/e2e/VednorReports.spec.ts ./tests/pw/tests/e2e/vendor_reports.spec.ts

Length of output: 1259


🏁 Script executed:

#!/bin/bash
# Get test names with corrected syntax
echo "=== Test names in VednorReports.spec.ts ==="
grep -n "test(" ./tests/pw/tests/e2e/VednorReports.spec.ts

echo ""
echo "=== Test names in vendor_reports.spec.ts ==="
grep -n "test(" ./tests/pw/tests/e2e/vendor_reports.spec.ts

echo ""
echo "=== Check if ReportsPage is imported or used anywhere ==="
grep -r "ReportsPage" ./tests/pw/tests/e2e/ --include="*.spec.ts"

echo ""
echo "=== View full content of VednorReports.spec.ts ==="
cat ./tests/pw/tests/e2e/VednorReports.spec.ts

Length of output: 9448


Test suite skipped and contains admin test coverage not present in new file.

The file has a typo ("Vednor" → "Vendor") and is skipped, but it contains 6 admin tests using ReportsPage that are not covered in vendor_reports.spec.ts or anywhere else in the test suite:

  • admin can view reports menu page
  • admin can view all Logs menu page
  • admin can search all logs
  • admin can export all logs
  • admin can filter all logs by store name
  • admin can filter all logs by order status

The new vendor_reports.spec.ts focuses exclusively on vendor analytics and reports. Before removing the old file, either migrate the admin tests to a dedicated admin reports test file or confirm that admin reports functionality is no longer tested.

🤖 Prompt for AI Agents
In tests/pw/tests/e2e/VednorReports.spec.ts around line 10 the suite is skipped
and the filename contains a typo ("Vednor" → "Vendor"); the file also contains
six admin tests using ReportsPage that are not present in
vendor_reports.spec.ts. Fix by renaming the file to VendorReports.spec.ts (and
update any imports/CI references), extract or copy the six admin tests into a
new dedicated admin_reports.spec.ts (or into an existing admin test file),
update test descriptions to match the list (view reports menu, view all logs,
search logs, export logs, filter by store name, filter by order status), ensure
they use the ReportsPage helper correctly, remove the skipped flag (or delete
the old file only after confirming the admin tests exist elsewhere), and run the
test suite to verify coverage and path updates.

Comment on lines +197 to +199
test('vendor reports data matches API responses', { tag: ['@lite', '@integration', '@vendor'] }, async () => {
await vendor.validateReportsWithAPI(apiUtils);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Authenticate the vendor reports API call

ApiUtils is instantiated from request.newContext() without any stored authentication, so /dokan/v1/vendor-dashboard/sales responds 401/403 and this integration test never exercises the UI/API validation logic. Please reuse the vendor storage state (or otherwise inject vendor credentials) when creating the request context before calling validateReportsWithAPI. The snippet below shows one way to do it with the existing vendor auth storage state.

@@
-        apiUtils = new ApiUtils(await request.newContext());
+        apiUtils = new ApiUtils(
+            await request.newContext({ storageState: 'playwright/.auth/vendorStorageState.json' })
+        );

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

🤖 Prompt for AI Agents
In tests/pw/tests/e2e/vendor_reports.spec.ts around lines 197 to 199, the test
creates ApiUtils using a fresh request.newContext() with no auth so the vendor
reports API returns 401/403; update the test to create the request context with
the vendor's stored authentication state (or otherwise inject the vendor
credentials) before instantiating ApiUtils and calling
vendor.validateReportsWithAPI(apiUtils). Ensure you pass the storageState path
or authenticated context into ApiUtils so the /dokan/v1/vendor-dashboard/sales
request is authenticated and the validation logic runs.

// Need to rewrite full test because of new return request page

test.describe('Vendor RMA test', () => {
test.describe.skip('Vendor RMA test', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Skipping the entire RMA test suite eliminates critical test coverage.

Disabling this test suite removes all automated verification for vendor and customer RMA functionality, a critical e-commerce feature. While the rewrite is noted, the lack of test coverage increases regression risk until the tests are restored.

Consider:

  • Prioritizing the rewrite or creating a minimal smoke test for RMA flows
  • Documenting the expected timeline for restoring coverage
  • Tracking this as a known gap in your test coverage documentation
🤖 Prompt for AI Agents
In tests/pw/tests/e2e/vendorReturnRequest.spec.ts around line 12, the entire RMA
test suite is skipped which removes critical coverage; remove the
test.describe.skip to re-enable the suite, or replace it with
test.describe.only/test.describe (or restore individual skipped tests) after
completing the rewrite, and if the full rewrite cannot be finished immediately,
add a minimal smoke test that exercises the core vendor/customer RMA flow
(create RMA, verify status transition) in this file; also add a short TODO
comment with an expected timeline and create/update an entry in the
test-coverage or known-issues tracker documenting this gap so it is visible to
the team.

import { test, Page } from '@playwright/test';
import { VendorShippingPage } from '@pages/vendorShippingPage';
import { data } from '@utils/testData';
//Need to rewrite full test because of new Shiiping page
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix typo in comment.

"Shiiping" should be "Shipping".

Apply this diff to fix the typo:

-//Need to rewrite full test because of new Shiiping page
+//Need to rewrite full test because of new Shipping page
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//Need to rewrite full test because of new Shiiping page
//Need to rewrite full test because of new Shipping page
🤖 Prompt for AI Agents
In tests/pw/tests/e2e/vendorShipping.spec.ts around line 4, the inline comment
contains a typo ("Shiiping"); update the comment to read "Shipping" so it
becomes "// Need to rewrite full test because of new Shipping page" (fix
spacing/capitalization as appropriate).

…nal actions and adding method to retrieve sellerId by username
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36b81d1 and 538d53f.

📒 Files selected for processing (2)
  • tests/pw/tests/e2e/_auth.setup.ts (3 hunks)
  • tests/pw/utils/apiUtils.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/pw/tests/e2e/_auth.setup.ts
🧰 Additional context used
🧬 Code graph analysis (1)
tests/pw/utils/apiUtils.ts (2)
tests/pw/utils/interfaces.ts (2)
  • auth (2021-2024)
  • responseBody (2101-2101)
tests/pw/utils/apiEndPoints.ts (1)
  • endPoints (6-649)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: e2e tests (1, 3)
  • GitHub Check: e2e tests (3, 3)
  • GitHub Check: e2e tests (2, 3)
  • GitHub Check: api tests (1, 1)
🔇 Additional comments (3)
tests/pw/utils/apiUtils.ts (3)

230-235: LGTM! Well-structured helper method.

The new getSellerIdByUsername method follows established patterns in this class and correctly reuses getAllUsersByRoles. The case-insensitive username matching is appropriate.


243-244: Verify that handling all non-2xx status codes is appropriate.

The change from checking for a specific 400 status to accepting any non-2xx response (response.ok().toBeFalsy()) makes the code more flexible but less precise. This could mask unexpected errors like 401 (unauthorized), 403 (forbidden), or 502 (bad gateway).

Consider logging the actual status code for debugging purposes:

 // Handle error cases (status can be 400 or 500)
 expect(response.ok()).toBeFalsy();
+console.log(`Store creation failed with status ${response.status()}: ${responseBody.message || responseBody.code}`);

267-267: Good defensive check to prevent errors.

Adding the && sellerId condition prevents attempting to update the customer address when sellerId is undefined, which would cause updateCustomer to fail. This is consistent with the conditional updateStore pattern above.

Comment on lines +248 to +259

// If not found by store name, try to find by username (for cases where user exists but store might not)
if (!sellerId && payload.user_login) {
sellerId = await this.getSellerIdByUsername(payload.user_login, auth);
}

storeName = payload.store_name;

// update store if already exists
await this.updateStore(sellerId, payload, auth);
// update store if already exists and sellerId is found
if (sellerId) {
await this.updateStore(sellerId, payload, auth);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Handle the case when sellerId cannot be resolved.

If both the store name lookup (line 247) and username lookup (line 251) fail to find a sellerId, the variable remains undefined. However, the function's return type at line 238 declares sellerId as string, creating a type safety issue. Additionally, calling code may not expect undefined and could fail downstream.

Consider one of these approaches:

Option 1: Throw an error if sellerId cannot be resolved

 // If not found by store name, try to find by username (for cases where user exists but store might not)
 if (!sellerId && payload.user_login) {
     sellerId = await this.getSellerIdByUsername(payload.user_login, auth);
 }
+
+if (!sellerId) {
+    throw new Error(`Unable to resolve sellerId for store '${payload.store_name}' or user '${payload.user_login}'`);
+}
 
 storeName = payload.store_name;

Option 2: Log a warning and update the return type

+if (!sellerId) {
+    console.warn(`Store creation/update skipped: sellerId not found for '${payload.store_name}' or '${payload.user_login}'`);
+}
+
 storeName = payload.store_name;
 
 // update store if already exists and sellerId is found

And update the return type to reflect that sellerId may be undefined:

async createStore(payload: any, auth?: auth, addUserAddress: boolean = false): Promise<[responseBody, string | undefined, string, string]>
🤖 Prompt for AI Agents
In tests/pw/utils/apiUtils.ts around lines 248 to 259, sellerId can remain
undefined if both store_name and user_login lookups fail, which violates the
function's declared Promise<[responseBody, string, string, string]> return type;
add an explicit check immediately after the username lookup and if sellerId is
still falsy throw a descriptive Error (e.g., "Unable to resolve sellerId for
payload: ...") so the function never returns an undefined sellerId, and keep the
existing updateStore call guarded by the sellerId truthiness.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
tests/pw/e2eReadme.md (3)

82-90: Consolidate Playwright installation commands for clarity.

The multiple similar commands (lines 82–90) are redundant and unclear. Users won't know which to run. Provide a single, clear sequence:

 3. Install Playwright and browsers:
    ```bash
-   playwright install chromium
-   playwright install --with-deps chromium
-   playwright install-deps chromium
-   playwright install
-   playwright install --with-deps
-   playwright install-deps
+   npx playwright install --with-deps
    ```

The --with-deps flag handles both browser installation and system dependencies in one command.


96-102: Clarify NO_SETUP usage—it's redundant if already set in .env.

The .env file already sets NO_SETUP=true (line 32), so prefixing it again in the command-line (lines 96, 101) is redundant and could confuse users. Clarify:

  • If NO_SETUP should always be true for auth and e2e setup, set it once in .env and remove from commands.
  • Or, explain when and why users should override it on the command line.

Consider revising to:

 #### Authentication Setup
 ```bash
-NO_SETUP=true npx playwright test --project=auth_setup
+npx playwright test --project=auth_setup

Environment Setup

-NO_SETUP=true npx playwright test --project=e2e_setup
+npx playwright test --project=e2e_setup

Or add a note explaining when to override `NO_SETUP` via the command line.

---

`45-68`: **Add a note on module enablement location for clarity.**

Line 60 instructs to "Enable all modules **except Paystack**" under "Admin → Dokan → Modules", but doesn't provide additional context. Consider adding a brief note about what modules are or linking to documentation, especially for first-time users unfamiliar with Dokan.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used**: CodeRabbit UI

**Review profile**: CHILL

**Plan**: Pro

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between d1e3ed5f9767ba5162e60df71ad8f2a1cf1646c2 and 945e63a0875b1991c7dadb3c914d3ddd9ac86004.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `tests/pw/e2eReadme.md` (1 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)</summary>

* GitHub Check: e2e tests (2, 3)
* GitHub Check: e2e tests (1, 3)
* GitHub Check: e2e tests (3, 3)
* GitHub Check: api tests (1, 1)

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines +78 to +79
npm install --include=dev
npm install --omit=dev
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix the npm install sequence—do not run --omit=dev after --include=dev.

Line 79 (npm install --omit=dev) will remove dev dependencies that were just installed in line 78. For a development environment running E2E tests, dev dependencies are necessary. Remove line 79 or clarify the intent.

 2. Install dependencies:
    ```bash
    npm install --include=dev
-   npm install --omit=dev
    ```
🤖 Prompt for AI Agents
In tests/pw/e2eReadme.md around lines 78–79, the documented command sequence
installs dev dependencies then immediately removes them; remove the second line
(`npm install --omit=dev`) or replace it with an explicit note describing a
separate production install command (e.g., explain that `npm install --omit=dev`
is only for production builds) so the README does not instruct removing dev
dependencies needed for running E2E tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants