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

Add Pro module tests(wholesale, vendorstaff) (test automation) #2379

Merged
merged 7 commits into from
Sep 25, 2024

Conversation

shashwatahalder01
Copy link
Contributor

@shashwatahalder01 shashwatahalder01 commented Sep 25, 2024

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

    • Admins can now add vendor table rate and distance rate shipping methods.
    • Vendors can add product min-max options and settings.
    • Admins can add new payment methods: Mangopay, Razorpay, and Stripe.
    • Vendors can create wholesale products and manage bookings for guests and existing customers.
    • Enhanced vendor dashboard with menu visibility features.
    • New method for verifying visibility of vendor dashboard menus.
  • Bug Fixes

    • Corrected various typos in comments and variable names for clarity.
  • Tests

    • Added new tests for vendor dashboard menu visibility and vendor functionality in the wholesale testing suite.
    • Updated tests for customer visibility of wholesale prices and vendor actions.

@shashwatahalder01 shashwatahalder01 self-assigned this Sep 25, 2024
Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes encompass a series of updates to the feature map configuration, vendor capabilities, and various page classes within the testing framework. Key modifications include enhancements to vendor functionalities, such as managing shipping methods and payment options, alongside the introduction of new methods and constants for better code organization. Additionally, several typos in comments have been corrected, and the structure of selectors has been improved for clarity and maintainability.

Changes

File(s) Change Summary
tests/pw/feature-map/feature-map.yml Updates to vendor and admin capabilities, including shipping methods, payment options, and handling of abuse reports. New features for wholesale products and booking functionality for vendors introduced.
tests/pw/fixtures/page.ts Renamed WholesaleCustomersPage to WholesalePage and updated references accordingly.
tests/pw/pages/basePage.ts Corrected method name from clickAndWaitForLocatorTobeVisible to clickAndWaitForLocatorToBeVisible and refactored click actions.
tests/pw/pages/colorsPage.ts Corrected typos and enhanced clarity in variable names and comments.
tests/pw/pages/customerPage.ts Updated selector for visibility checks in the CustomerPage class.
tests/pw/pages/menuManagerPage.ts Introduced a new method for navigation and updated references to use a new constant for the vendor dashboard.
tests/pw/pages/productAdvertisingPage.ts Minor corrections to comments regarding search types.
tests/pw/pages/productQAPage.ts Corrected method name from clickAndWaitForLocatorTobeVisible to clickAndWaitForLocatorToBeVisible.
tests/pw/pages/refundsPage.ts Minor textual corrections in comments.
tests/pw/pages/reverseWithdrawsPage.ts Introduced a new constant for vendor dashboard references to streamline code.
tests/pw/pages/selectors.ts Restructured the selector object for better organization and corrected a spelling error.
tests/pw/pages/settingPage.ts Updated selector in the SettingPage for visibility checks.
tests/pw/pages/settingsPage.ts Minor comment modification for clarity.
tests/pw/pages/singleProductPage.ts Corrected a typo in comments.
tests/pw/pages/vendorBookingPage.ts Corrected variable names for accuracy.
tests/pw/pages/vendorDashboardPage.ts Added a method to verify the visibility of vendor dashboard menus.
tests/pw/pages/vendorPage.ts Introduced a new constant for vendor dashboard references to streamline code.
tests/pw/pages/vendorStaffPage.ts Added a method to check permitted menus for vendor staff.
tests/pw/pages/vendorSubscriptionsPage.ts Minor textual modification in a comment.
tests/pw/pages/wholesalePage.ts Renamed WholesaleCustomersPage to WholesalePage and updated related methods and selectors.
tests/pw/pages/withdrawsPage.ts Minor textual change in a comment.
tests/pw/tests/e2e/dashboard.spec.ts Added a new test case for vendor dashboard menu visibility.
tests/pw/tests/e2e/vendorBooking.spec.ts Added a comment regarding a potential timing issue in a test case.
tests/pw/tests/e2e/vendorStaff.spec.ts Added a new test suite for vendor staff capabilities with setup and teardown procedures.
tests/pw/tests/e2e/vendorVerifications.spec.ts Removed a test case regarding admin notifications for verification requests.
tests/pw/tests/e2e/wholesale.spec.ts Restructured the wholesale testing suite, updated class names, and added tests for vendor functionality.

Possibly related PRs

🐰 In the garden where changes bloom,
New features sprout, dispelling gloom.
With vendors empowered, they take the stage,
Enhancing their tools, turning a page.
Comments corrected, the code shines bright,
A hop of delight in the coding night! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 10

Outside diff range and nitpick comments (23)
tests/pw/tests/e2e/vendorStaff.spec.ts (3)

48-72: LGTM! Consider adding more test cases.

The new test suite 'Wholesale test (customer)' is well-structured with proper setup and teardown processes. The test case is appropriately tagged and checks an important functionality.

Consider adding more test cases to this suite to cover different scenarios, such as:

  1. Checking if the staff cannot access menus they don't have permission for.
  2. Verifying the behavior when updating staff permissions.
  3. Testing edge cases with empty or invalid permissions.

69-71: LGTM! Consider adding assertions for clarity.

The test case 'VendorStaff can view allowed menus' is concise and focused on a single functionality.

Consider adding explicit assertions to make the test's expectations clearer. For example:

test('VendorStaff can view allowed menus', { tag: ['@pro', '@staff'] }, async () => {
    const visibleMenus = await staff.viewPermittedMenus(data.vendorStaff.basicMenuNames);
    expect(visibleMenus).toEqual(data.vendorStaff.basicMenuNames);
});

This assumes that viewPermittedMenus returns the list of visible menus. If it doesn't, you might need to adjust the method to return this information.


74-81: LGTM! Consider adding type annotations and adjusting the default value.

The createPayload function is well-structured and uses modern JavaScript features effectively.

Consider the following improvements:

  1. Add type annotations for better type safety:
function createPayload(capabilitiesArray: string[], access: boolean = true): { capabilities: Array<{ capability: string, access: boolean }> } {
    // ... function body ...
}
  1. Consider changing the default value of access to false. This follows the principle of least privilege, where access is denied by default:
function createPayload(capabilitiesArray: string[], access: boolean = false) {
    // ... function body ...
}
  1. Add a brief JSDoc comment to explain the function's purpose and parameters:
/**
 * Creates a payload object for updating staff capabilities.
 * @param capabilitiesArray - An array of capability strings.
 * @param access - Whether to grant or deny access to the capabilities. Defaults to false.
 * @returns An object with a 'capabilities' property containing an array of capability objects.
 */
function createPayload(capabilitiesArray: string[], access: boolean = false): { capabilities: Array<{ capability: string, access: boolean }> } {
    // ... function body ...
}
tests/pw/pages/colorsPage.ts (1)

Line range hint 1-85: Consider refactoring the addColorPalette method for improved maintainability.

While the recent changes have improved code clarity, the addColorPalette method is quite long and handles multiple responsibilities. Consider refactoring this method to improve readability and maintainability. Some suggestions:

  1. Extract the color palette setting logic into a separate method.
  2. Create a dedicated method for color assertions.
  3. Use a configuration object or enum for field names to reduce repetition.

Example refactoring:

private async setColorPalette(paletteChoice: string, paletteName: string, paletteValues: paletteValues) {
    if (paletteChoice === 'predefined') {
        await this.setPredefinedPalette(paletteName);
    } else {
        await this.setCustomPalette(paletteValues);
    }
}

private async assertColors(paletteValues: paletteValues) {
    // Move all color assertions here
}

async addColorPalette(paletteName: string, paletteValues: paletteValues, paletteChoice: string = 'predefined') {
    await this.goToDokanSettings();
    await this.click(settingsAdmin.menus.colors);

    await this.setColorPalette(paletteChoice, paletteName, paletteValues);

    // save settings
    await this.saveSettings();

    await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsStore);

    await this.assertColors(paletteValues);
}

This refactoring would make the code more modular and easier to maintain.

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

Potential Duplication Detected in VendorStaffPage Additions

The newly added methods viewPermittedMenus and goToVendorDashboard, as well as the selector vendorDashboard, already exist in other parts of the codebase. This duplication could lead to maintainability challenges and inconsistencies.

Affected Areas:

  • vendorStaff.spec.ts uses viewPermittedMenus.
  • vendorPage.ts contains the goToVendorDashboard method.
  • Multiple pages (vendorDashboardPage.ts, settingPage.ts, reverseWithdrawsPage.ts, menuManagerPage.ts, vendorPage.ts, colorsPage.ts, customerPage.ts) utilize the selector.vendor.vDashboard selector.
Analysis chain

Line range hint 1-132: Summary: Positive addition to VendorStaffPage class.

The changes made to this file enhance the VendorStaffPage class by adding functionality to view permitted menus. The new viewPermittedMenus method aligns well with the class's purpose and follows the established coding patterns. The addition of the vendorDashboard constant also improves code readability and maintainability.

These changes contribute positively to the testing framework for the Pro module, specifically for vendor staff functionalities, which aligns with the PR objectives.

To ensure that these changes don't conflict with or duplicate existing functionality, please run the following verification:

This will help identify any potential overlaps or inconsistencies with other parts of the testing framework.


</run_scripts>


</run_scripts>

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for similar methods or usages in other test files

# Search for similar method names or usages
rg --type typescript -g '!vendorStaffPage.ts' 'viewPermittedMenus|goToVendorDashboard'

# Check for other usages of vendorDashboard selector
rg --type typescript -g '!vendorStaffPage.ts' 'selector\.vendor\.vDashboard'

Length of output: 237


Script:

#!/bin/bash
# Description: Check for similar methods or usages in other TypeScript test files

# Search for similar method names or usages in .ts and .tsx files excluding vendorStaffPage.ts
rg -t ts -t tsx -g '!vendorStaffPage.ts' 'viewPermittedMenus|goToVendorDashboard'

# Check for other usages of vendorDashboard selector in .ts and .tsx files excluding vendorStaffPage.ts
rg -t ts -t tsx -g '!vendorStaffPage.ts' 'selector\.vendor\.vDashboard'

Length of output: 213


Script:

#!/bin/bash
# Description: Check for similar methods or usages in other TypeScript test files using file extensions

# Search for similar method names or usages in .ts and .tsx files excluding vendorStaffPage.ts
rg -g '*.ts' -g '*.tsx' -g '!vendorStaffPage.ts' 'viewPermittedMenus|goToVendorDashboard'

# Check for other usages of vendorDashboard selector in .ts and .tsx files excluding vendorStaffPage.ts
rg -g '*.ts' -g '*.tsx' -g '!vendorStaffPage.ts' 'selector\.vendor\.vDashboard'

Length of output: 1595

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

15-19: LGTM: Good encapsulation of navigation logic.

The goToMenuManagerSettings method effectively encapsulates the navigation logic, which can reduce code duplication throughout the class. It's consistent with the single responsibility principle and correctly uses async/await.

Consider adding a brief JSDoc comment to describe the method's purpose and any side effects:

/**
 * Navigates to the Menu Manager Settings page.
 */
async goToMenuManagerSettings() {
    // ... existing code ...
}

11-13: Consider removing the unnecessary constructor.

The current constructor doesn't add any functionality beyond calling the superclass constructor. Removing it would slightly reduce code complexity without affecting the class's behavior.

You can safely remove the constructor:

-    constructor(page: Page) {
-        super(page);
-    }

This change will implicitly use the superclass constructor.

Tools
Biome

[error] 11-13: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

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

164-165: LGTM: Consistent use of the new vendorDashboard constant.

The changes in the vendorCantWithdraw and vendorStatusInactive methods correctly utilize the newly introduced vendorDashboard constant. This improves code maintainability and consistency.

For even better consistency, consider updating other methods in this class that might still be using direct selector references (e.g., selector.vendor.vDashboard) to use the new vendorDashboard constant.

Also applies to: 170-170

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

182-200: LGTM: Enhanced viewWholeSalePrice method with improved flexibility.

The viewWholeSalePrice method has been significantly improved:

  1. Two new parameters (canView and productDetails) have been added, allowing for more flexible testing scenarios.
  2. The new logic correctly implements visibility checks based on these parameters.

These changes enhance the method's functionality and test coverage.

Consider adding the following test cases to ensure comprehensive coverage:

  1. Test with canView = false and productDetails = false
  2. Test with canView = true and productDetails = false
  3. Test with canView = false and productDetails = true

These additional test cases will help ensure that all combinations of the new parameters are properly handled.

tests/pw/fixtures/page.ts (3)

137-137: Approve with suggestion: Maintain consistency in property naming.

The type definition for WholesalePage has been added correctly to the pages type. However, to maintain consistency with other property names in the type definition, consider changing the property name to lowercase.

Apply this change to maintain consistency:

-    WholesalePage: WholesalePage;
+    wholesalePage: WholesalePage;

402-403: Approve with suggestion: Maintain consistency in fixture naming.

The fixture definition for WholesalePage has been added correctly. However, to maintain consistency with other fixture names, consider changing the fixture name to lowercase.

Apply this change to maintain consistency:

-    WholesalePage: async ({ page }, use) => {
+    wholesalePage: async ({ page }, use) => {
         await use(new WholesalePage(page));
     },

413-414: Consider removing commented-out code.

The comments for exporting test and expect have been modified to indicate that they are no longer active. However, it's generally a good practice to remove commented-out code entirely if it's no longer needed, as it can lead to confusion and clutter in the codebase.

Consider removing these lines entirely if they are no longer needed:

-// export const test = page;
-// export const expect = page.expect;

If there's a specific reason for keeping these comments, please add an explanatory note to clarify their purpose.

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

299-299: Approved: Method name casing corrected.

The change from clickAndWaitForLocatorTobeVisible to clickAndWaitForLocatorToBeVisible improves adherence to camelCase naming conventions. This is a good catch and enhances code readability.

Consider updating the method name in other parts of the codebase (if any) to maintain consistency. You can use the following command to find other occurrences:

rg "clickAndWaitForLocatorTobeVisible" --type typescript
tests/pw/feature-map/feature-map.yml (4)

689-689: LGTM: Added Mangopay payment method

Enabling Mangopay as a payment method expands payment options for vendors and customers. This is a positive addition to the plugin's functionality.

Consider updating the plugin's documentation to reflect this new payment method option.


809-809: LGTM: Added Razorpay payment method

Enabling Razorpay as a payment method expands payment options for vendors and customers. This is a positive addition to the plugin's functionality.

Consider updating the plugin's documentation to reflect this new payment method option.


819-819: LGTM: Added bulk action capability for abuse reports

Enabling bulk actions on abuse reports will significantly improve the efficiency of report management for admins.

Consider updating the admin documentation to include instructions on how to use this new bulk action feature for abuse reports.


847-847: LGTM: Added bulk action capability for quotes

Enabling bulk actions on quotes will significantly improve the efficiency of quote management for admins.

Consider updating the admin documentation to include instructions on how to use this new bulk action feature for quotes.

tests/pw/pages/basePage.ts (3)

Line range hint 1361-1365: Improved method documentation.

The comment above the addLocatorHandler method has been updated from "userful" to "useful", correcting a typo. This improves the overall documentation quality.

Consider adding more details to the comment, such as explaining when this method should be called (e.g., "Call this method before the start of the test to handle randomly appearing popups").


Line range hint 1600-1608: Simplified implementation using clickAndWaitForResponse.

The enableSwitcherAndWaitForResponse method has been updated to use the clickAndWaitForResponse method instead of Promise.all. This change simplifies the code and makes it more consistent with other methods in the class.

Consider adding a comment explaining the behavior when the switcher is already enabled (i.e., when the method returns an empty string).


Line range hint 1611-1619: Simplified implementation using clickAndWaitForResponse.

The disableSwitcherAndWaitForResponse method has been updated to use the clickAndWaitForResponse method instead of Promise.all. This change simplifies the code and makes it more consistent with other methods in the class.

Consider adding a comment explaining the behavior when the switcher is already disabled (i.e., when the method returns an empty string).

tests/pw/utils/testData.ts (1)

1884-1907: Approved: New vendorStaff structure added

The addition of the vendorStaff object with basicMenu, basicMenuNames, and menus arrays is a good structure for managing vendor staff permissions or capabilities. This clear separation between basic and advanced menu items can facilitate different levels of staff access.

Suggestion for improvement:
Consider adding a brief comment above the vendorStaff object to explain its purpose and how it relates to the rest of the data structure. This would enhance code readability and make it easier for other developers to understand the context of this new addition.

Example:

// Defines menu access and capabilities for vendor staff members
vendorStaff: {
  // ... (existing code)
}
tests/pw/tests/e2e/wholesale.spec.ts (2)

104-105: Address the TODO Comment Regarding Product Creation

There is a TODO comment indicating that the line should be replaced when the product edit PR is merged. To prevent this from being overlooked, consider tracking this task explicitly.

Would you like me to open a GitHub issue to track this TODO, or assist in updating the code once the dependent PR is merged?


153-155: Clarify Access Levels in Test Descriptions

The test 'All users can see wholesale price' might benefit from clarification on which user roles are included. Explicitly stating the user roles involved (e.g., guest, customer, admin) can enhance test readability.

Consider updating the test description:

- test('All users can see wholesale price', { tag: ['@pro', '@customer'] }, async () => {
+ test('All user roles can see wholesale price', { tag: ['@pro', '@customer'] }, async () => {
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e73c5df and 14cb079.

Files selected for processing (30)
  • tests/pw/feature-map/feature-map.yml (15 hunks)
  • tests/pw/fixtures/page.ts (4 hunks)
  • tests/pw/pages/basePage.ts (4 hunks)
  • tests/pw/pages/colorsPage.ts (1 hunks)
  • tests/pw/pages/customerPage.ts (1 hunks)
  • tests/pw/pages/menuManagerPage.ts (8 hunks)
  • tests/pw/pages/productAdvertisingPage.ts (1 hunks)
  • tests/pw/pages/productQAPage.ts (1 hunks)
  • tests/pw/pages/refundsPage.ts (1 hunks)
  • tests/pw/pages/reverseWithdrawsPage.ts (2 hunks)
  • tests/pw/pages/selectors.ts (2 hunks)
  • tests/pw/pages/settingPage.ts (1 hunks)
  • tests/pw/pages/settingsPage.ts (1 hunks)
  • tests/pw/pages/singleProductPage.ts (1 hunks)
  • tests/pw/pages/vendorBookingPage.ts (2 hunks)
  • tests/pw/pages/vendorDashboardPage.ts (1 hunks)
  • tests/pw/pages/vendorPage.ts (4 hunks)
  • tests/pw/pages/vendorStaffPage.ts (2 hunks)
  • tests/pw/pages/vendorSubscriptionsPage.ts (1 hunks)
  • tests/pw/pages/wholesalePage.ts (6 hunks)
  • tests/pw/pages/withdrawsPage.ts (1 hunks)
  • tests/pw/tests/e2e/dashboard.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorBooking.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorStaff.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorVerifications.spec.ts (0 hunks)
  • tests/pw/tests/e2e/wholesale.spec.ts (4 hunks)
  • tests/pw/utils/apiUtils.ts (2 hunks)
  • tests/pw/utils/helpers.ts (1 hunks)
  • tests/pw/utils/pwMatchers.ts (1 hunks)
  • tests/pw/utils/testData.ts (3 hunks)
Files not reviewed due to no reviewable changes (1)
  • tests/pw/tests/e2e/vendorVerifications.spec.ts
Files skipped from review due to trivial changes (9)
  • tests/pw/pages/productAdvertisingPage.ts
  • tests/pw/pages/refundsPage.ts
  • tests/pw/pages/settingsPage.ts
  • tests/pw/pages/singleProductPage.ts
  • tests/pw/pages/vendorBookingPage.ts
  • tests/pw/pages/vendorSubscriptionsPage.ts
  • tests/pw/pages/withdrawsPage.ts
  • tests/pw/utils/helpers.ts
  • tests/pw/utils/pwMatchers.ts
Additional context used
Biome
tests/pw/pages/menuManagerPage.ts

[error] 11-13: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

Additional comments not posted (45)
tests/pw/tests/e2e/dashboard.spec.ts (3)

Line range hint 1-55: Well-structured and consistent test suite. Good job!

The test suite is well-organized with clear separation between admin and vendor tests. The new test case maintains consistency with existing tests in terms of structure and tagging. This addition enhances the coverage of vendor-related functionality.

The use of beforeAll and afterAll hooks for setup and teardown is a good practice. The consistent use of tags (@lite, @exploratory, @vendor, @admin) across tests facilitates easy filtering and organization of test runs.


Line range hint 1-55: Summary: Focused addition enhancing vendor dashboard testing

This change introduces a new test case for vendor dashboard menus, which complements the existing vendor dashboard test. The addition is minimal, focused, and well-integrated into the existing test suite structure. It enhances the test coverage for vendor-related functionality without disrupting the existing tests.

The PR objectives align well with this change, as it contributes to enhancing the testing framework for the Pro module, specifically for vendor functionalities.


53-55: LGTM! Consider verifying the implementation of the new method.

The new test case for vendor dashboard menus is a good addition that complements the existing vendor dashboard test. It follows the same structure and tagging convention as other tests in the suite.

To ensure the completeness of this change, please verify the implementation of the vendorDashboardMenusRenderProperly() method in the VendorDashboardPage class. You can use the following script to locate and review its implementation:

Verification successful

Verified! The vendorDashboardMenusRenderProperly method is properly implemented and aligns with the added test case. It comprehensively checks the visibility of all relevant dashboard menus based on the application’s configuration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Locate and display the implementation of vendorDashboardMenusRenderProperly method

# Search for the VendorDashboardPage class definition
echo "VendorDashboardPage class definition:"
ast-grep --lang typescript --pattern 'class VendorDashboardPage {
  $$$
}'

# Search for the vendorDashboardMenusRenderProperly method
echo "\nvendorDashboardMenusRenderProperly method implementation:"
ast-grep --lang typescript --pattern 'async vendorDashboardMenusRenderProperly() {
  $$$
}'

Length of output: 859


Script:

#!/bin/bash
# Description: Locate and display the implementation of vendorDashboardMenusRenderProperly method

# Search for the VendorDashboardPage class definition with a more flexible pattern
echo "VendorDashboardPage class definition:"
ast-grep --lang typescript --pattern 'class VendorDashboardPage { $$$ }'

# Search for the vendorDashboardMenusRenderProperly method with adjusted pattern
echo "\nvendorDashboardMenusRenderProperly method implementation:"
ast-grep --lang typescript --pattern 'async vendorDashboardMenusRenderProperly($_parameters) { $$$ }' || \
echo "ast-grep pattern did not match. Attempting with ripgrep."

# Alternative search using ripgrep if ast-grep fails
echo "\nUsing ripgrep to locate vendorDashboardMenusRenderProperly method:"
rg 'async\s+vendorDashboardMenusRenderProperly\s*\('

Length of output: 1289


Script:

#!/bin/bash
# Description: Locate and display the implementation of VendorDashboardPage class

# Use ripgrep to find the VendorDashboardPage class definition
echo "VendorDashboardPage class definition:"
rg -A 10 'class\s+VendorDashboardPage' tests/pw/pages/vendorDashboardPage.ts

Length of output: 452


Script:

#!/bin/bash
# Description: Display the implementation of vendorDashboardMenusRenderProperly method

# Use ripgrep to extract the method's implementation with context lines
echo "vendorDashboardMenusRenderProperly method implementation:"
rg -A 10 'async\s+vendorDashboardMenusRenderProperly\s*\(' tests/pw/pages/vendorDashboardPage.ts

Length of output: 715


Script:

#!/bin/bash
# Description: Retrieve the complete implementation of vendorDashboardMenusRenderProperly method

# Use ripgrep to extract the full method implementation by specifying a range of lines
echo "Complete vendorDashboardMenusRenderProperly method implementation:"
rg -A 20 'async\s+vendorDashboardMenusRenderProperly\s*\(' tests/pw/pages/vendorDashboardPage.ts

Length of output: 1295

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

51-70: Good implementation, but consider some improvements

The vendorDashboardMenusRenderProperly method is well-structured and covers different scenarios based on the DOKAN_PRO environment variable. However, there are a few points to consider:

  1. Error handling: Consider adding try-catch blocks to handle potential errors if elements are not found.

  2. Documentation: Add a comment explaining why 'inbox' and 'subscription' are excluded in the PRO version checks.

  3. Non-PRO version checks: Verify if 'reverseWithdrawal' should be checked in the non-PRO version.

Here's a suggested improvement with error handling and comments:

async vendorDashboardMenusRenderProperly() {
    try {
        await this.goIfNotThere(data.subUrls.frontend.vDashboard.dashboard);

        await this.toBeVisible(vendorDashboard.menus.menus);

        if (DOKAN_PRO) {
            // Exclude 'inbox' and 'subscription' as they might be conditionally visible
            const { inbox, subscription, wepos, ...menus } = vendorDashboard.menus.primary;
            await this.multipleElementVisible(menus);
        } else {
            const nonProMenus = [
                'dashboard', 'products', 'orders', 'withdraw', 'settings', 'visitStore', 'editAccount'
            ];
            for (const menu of nonProMenus) {
                await this.toBeVisible(vendorDashboard.menus.primary[menu]);
            }
            // Verify if 'reverseWithdrawal' should be checked in non-PRO version
            // await this.toBeVisible(vendorDashboard.menus.primary.reverseWithdrawal);
        }
    } catch (error) {
        console.error('Error in vendorDashboardMenusRenderProperly:', error);
        throw error;
    }
}

To verify the presence of 'reverseWithdrawal' in the non-PRO version, run the following script:

This will help determine if 'reverseWithdrawal' should be included in the non-PRO version checks.

tests/pw/pages/colorsPage.ts (4)

56-56: Typo correction approved.

The comment has been corrected from "asertions" to "assertions", which improves code readability.


74-76: Assertion updates approved.

The variable name in the assertions has been correctly updated from beforHover to beforeHover, maintaining consistency with the earlier variable name correction.


64-64: Variable name correction approved.

The variable name has been corrected from beforHover to beforeHover, which improves code clarity and consistency.

Please run the following script to ensure there are no remaining occurrences of the misspelled variable:

Verification successful

Please run the following script to ensure there are no remaining occurrences of the misspelled variable:


Variable name correction verified.

The variable name has been corrected from beforHover to beforeHover, and no remaining occurrences of beforHover were found in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining occurrences of 'beforHover'

# Test: Search for 'beforHover'. Expect: No results.
rg --type typescript 'beforHover'

Length of output: 474


Script:

#!/bin/bash
# Description: Check for any remaining occurrences of 'beforHover' in TypeScript files

# Test: Search for 'beforHover' in .ts and .tsx files. Expect: No results.
rg 'beforHover' --glob '*.ts' --glob '*.tsx'

Length of output: 44


69-72: Menu selector updates approved.

The dashboard menu selectors have been updated to reflect a more specific structure (e.g., dashboardVendor.menus.primary.dashboard instead of dashboardVendor.menus.dashboard). This change likely accommodates a more complex menu hierarchy.

Please run the following script to verify the new selector structure:

Verification successful

Menu selector updates verified successfully.

The new menu selector structures have been confirmed, and the old selectors are no longer present in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new menu selector structure

# Test 1: Check for the existence of the new selector structure
ast-grep --lang typescript --pattern 'dashboardVendor.menus.primary.$_'

# Test 2: Ensure there are no remaining occurrences of the old selector structure
rg --type typescript 'dashboardVendor\.menus\.(dashboard|settings)\b'

Length of output: 474


Script:

#!/bin/bash
# Description: Re-verify the absence of old menu selector structures without relying on predefined file types

# Test 1: Check for the existence of the new selector structure
ast-grep --lang typescript --pattern 'dashboardVendor.menus.primary.$_'

# Test 2: Ensure there are no remaining occurrences of the old selector structure by explicitly searching .ts files
rg 'dashboardVendor\.menus\.(dashboard|settings)\b' --glob '*.ts'

Length of output: 435

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

9-9: LGTM: New constant for vendor dashboard selector.

The addition of the vendorDashboard constant is appropriate and consistent with the existing code style. It provides a clear reference to the vendor dashboard selectors, which will be useful in the newly added viewPermittedMenus method.

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

47-50: LGTM! Verify other occurrences of the old selector.

The update to the selector in the disableVendorSetupWizardSetting method looks good. It reflects a possible restructuring of the dashboard menu, introducing a more specific primary submenu.

To ensure consistency across the test suite, please run the following script to check for any other occurrences of the old selector that might need updating:

If any occurrences are found, please review them to determine if they also need to be updated to use the new primary submenu structure.

Verification successful

Verification Complete: No other occurrences of the old selector found.

All instances of the old selector selector.vendor.vDashboard.menus.dashboard have been successfully updated to selector.vendor.vDashboard.menus.primary.dashboard. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for other occurrences of the old dashboard selector

# Test: Search for the old selector pattern
echo "Searching for occurrences of the old selector pattern:"
rg --type typescript "selector\.vendor\.vDashboard\.menus\.dashboard"

echo "Searching for similar selector patterns that might need updating:"
rg --type typescript "selector\.vendor\.vDashboard\.menus\.[a-zA-Z]+"

Length of output: 473


Script:

#!/bin/bash
# Description: Search for other occurrences of the old dashboard selector with corrected file type

# Test: Search for the old selector pattern
echo "Searching for occurrences of the old selector pattern with type 'ts':"
rg --type ts "selector\.vendor\.vDashboard\.menus\.dashboard"

echo "Searching for similar selector patterns that might need updating with type 'ts':"
rg --type ts "selector\.vendor\.vDashboard\.menus\.[a-zA-Z]+"

Length of output: 688

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

8-8: LGTM: Good use of a constant for the vendor dashboard selector.

This change improves code readability and maintainability by centralizing the selector reference. It's consistent with the existing pattern of using constants for selectors.


38-38: LGTM: Consistent use of the new vendorDashboard constant.

This change aligns with the introduction of the vendorDashboard constant, improving code consistency and maintainability.


49-49: LGTM: Consistent use of the vendorDashboard constant.

This change maintains consistency with the previous updates, further improving code readability and maintainability.


61-61: LGTM: Improved code organization and consistency.

The changes in the renameMenu method:

  1. Use the new goToMenuManagerSettings method, reducing code duplication and improving maintainability.
  2. Consistently use the vendorDashboard constant, aligning with previous updates.

These modifications enhance the overall code quality and readability.

Also applies to: 71-71


75-75: LGTM: Consistent use of the new navigation method.

The cantRenameMenuBeyondLimit and cantRenameMenu methods now use the goToMenuManagerSettings method for navigation. This change:

  1. Reduces code duplication.
  2. Improves maintainability by centralizing navigation logic.
  3. Maintains consistency across the class.

Also applies to: 88-88


95-95: LGTM: Consistent improvements across multiple methods.

The changes in cantAlterMenu, reorderMenu, and resetMenuManagerSettings methods:

  1. Consistently use the new goToMenuManagerSettings method, reducing code duplication and centralizing navigation logic.
  2. In reorderMenu, the vendorDashboard constant is used consistently, aligning with previous updates.

These changes contribute to improved code organization, readability, and maintainability throughout the class.

Also applies to: 104-104, 118-119, 127-127

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

11-11: LGTM: Good use of a constant for the vendor dashboard selector.

The introduction of the vendorDashboard constant is a positive change. It centralizes the reference to the vendor dashboard selector, which can improve code maintainability and readability. The naming convention is also consistent with JavaScript/TypeScript best practices.


Line range hint 1-190: Summary: Changes align well with PR objectives and improve code quality.

The introduced changes in this file contribute positively to the PR's objective of enhancing the testing framework for the Pro module. The addition of the vendorDashboard constant and its subsequent use in the vendorCantWithdraw and vendorStatusInactive methods improve code maintainability and readability.

These changes are consistent with best practices for test automation and will likely make future updates to vendor dashboard selectors easier to manage. The modifications align well with the goal of adding automated tests for wholesale and vendor staff functionalities in the Pro module.

tests/pw/pages/wholesalePage.ts (7)

11-11: LGTM: Consistent selector renaming.

The change from wholesaleCustomersAdmin to wholesaleAdmin aligns with the class renaming mentioned in the summary. This improves consistency throughout the file.


29-41: LGTM: Consistent selector updates.

The changes in the adminWholesaleCustomersRenderProperly method correctly update all occurrences of wholesaleCustomersAdmin to wholesaleAdmin, maintaining consistency with the earlier selector renaming.


47-50: LGTM: Consistent selector updates in searchWholesaleCustomer method.

The changes in the searchWholesaleCustomer method correctly update all occurrences of wholesaleCustomersAdmin to wholesaleAdmin, maintaining consistency with the earlier selector renaming.


56-57: LGTM: Consistent selector updates in editWholesaleCustomer method.

The changes in the editWholesaleCustomer method correctly update all occurrences of wholesaleCustomersAdmin to wholesaleAdmin, maintaining consistency with the earlier selector renaming.


114-115: LGTM: Consistent selector updates across multiple methods.

The changes in the viewWholesaleCustomerOrders, updateWholesaleCustomer, and wholesaleCustomerBulkAction methods correctly update all occurrences of wholesaleCustomersAdmin to wholesaleAdmin, maintaining consistency with the earlier selector renaming.

Also applies to: 125-125, 129-129, 133-134, 151-151, 153-155


Line range hint 1-214: Overall assessment: Well-structured and consistent changes.

The changes in this file align well with the PR objectives of enhancing the testing framework for the Pro module. The renaming of the class and selectors has been consistently applied throughout the file, improving readability and maintainability. The enhanced viewWholeSalePrice method provides more flexible testing scenarios, which is a valuable addition to the test suite.

Key points:

  1. Consistent renaming of WholesaleCustomersPage to WholesalePage and related selectors.
  2. Improved flexibility in the viewWholeSalePrice method with new parameters.
  3. No major issues were identified during the review.

Great job on these improvements!


14-14: LGTM: Class renaming is consistent.

The class renaming from WholesaleCustomersPage to WholesalePage is consistent with the AI summary. This change improves the naming convention.

Please verify that all import statements in other files using this class have been updated accordingly. Run the following script to check for any remaining references to the old class name:

tests/pw/fixtures/page.ts (2)

67-67: LGTM: Import statement for WholesalePage added correctly.

The import statement for WholesalePage has been added correctly, following the established pattern in the file. This change aligns with the PR objectives of adding tests for the wholesale functionality.


Line range hint 1-414: Summary: WholesalePage integration successful with minor suggestions.

The changes to integrate the WholesalePage into the test fixtures have been implemented successfully. These modifications align well with the PR objectives of adding tests for the wholesale functionality. To further improve the code quality and consistency, please consider the following recommendations:

  1. Maintain consistent naming conventions by using lowercase for property and fixture names (e.g., wholesalePage instead of WholesalePage).
  2. Remove or provide explanations for the commented-out code at the end of the file.

Overall, the changes look good and achieve the intended purpose of adding support for wholesale functionality testing.

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

Line range hint 1-303: Overall, the ProductQAPage class is well-structured and comprehensive.

The class provides a robust set of methods for testing various aspects of the product Q&A functionality, including admin, vendor, and customer interactions. The use of selectors and helper methods promotes maintainability and readability. The recent change to correct the method name casing further improves the code quality.

tests/pw/pages/vendorPage.ts (4)

18-18: LGTM: Improved code maintainability

The introduction of the vendorDashboard constant centralizes the reference to the vendor dashboard selector. This change can improve code maintainability by reducing duplication and making it easier to update the selector in the future if needed.


213-213: LGTM: Consistent use of the new constant

The modification to use vendorDashboard.menus.primary.dashboard is consistent with the introduction of the vendorDashboard constant. This change improves code readability and maintainability.


250-250: LGTM: Consistent use of the new constant

The modification to use vendorDashboard.atAGlance.earningValue is consistent with the introduction of the vendorDashboard constant. This change improves code readability and maintainability.


317-320: LGTM: Consistent use of the new constant

The modifications to use vendorDashboard.menus.primary.visitStore are consistent with the introduction of the vendorDashboard constant. These changes improve code readability and maintainability while preserving the original logic of the method.

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

128-128: Selector update looks good, verify consistency across codebase.

The change to use selector.vendor.vDashboard.menus.primary.dashboard reflects an update in the vendor dashboard menu structure. This modification appears to be correct and more specific.

To ensure consistency, let's check if this new selector is used correctly across the codebase:

Verification successful

Selector update is consistent across the codebase.

All usages have been updated to selector.vendor.vDashboard.menus.primary.dashboard, and there are no remaining references to the old selector.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of the new selector structure
rg "selector\.vendor\.vDashboard\.menus\.primary" --type typescript

# Search for any remaining usage of the old selector structure
rg "selector\.vendor\.vDashboard\.menus\.dashboard" --type typescript

Length of output: 211


Script:

#!/bin/bash
# Search for usage of the new selector structure
rg "selector\.vendor\.vDashboard\.menus\.primary" -g "*.ts"

# Search for any remaining usage of the old selector structure
rg "selector\.vendor\.vDashboard\.menus\.dashboard" -g "*.ts"

Length of output: 354

tests/pw/feature-map/feature-map.yml (4)

79-79: LGTM: Enhanced vendor dashboard functionality

This change allows vendors to view dashboard menus in the lite version, which is a positive enhancement to the vendor experience.


693-695: LGTM: Enhanced vendor product management capabilities

These changes allow vendors to add min-max options for products and set min-max settings, which provides more flexibility in product management.

To ensure these new features work as expected, please add appropriate test cases. You can use the following command to check for existing tests related to these features:

#!/bin/bash
# Check for existing tests related to min-max options and settings
grep -rn "test.*min-max" tests/

If no relevant tests are found, consider adding new ones to cover these scenarios.


901-902: LGTM: Added ShipStation settings capability for vendors

Allowing vendors to set ShipStation settings will improve their ability to manage shipping effectively.

To ensure this new feature works as expected, please add appropriate test cases. You can use the following command to check for existing tests related to this feature:

#!/bin/bash
# Check for existing tests related to ShipStation settings
grep -rn "test.*shipStation" tests/

If no relevant tests are found, consider adding new ones to cover this scenario.

Update the vendor documentation to include instructions on how to use this new ShipStation settings feature.


999-1003: LGTM: Enhanced shipping methods and wholesale features

These changes introduce new shipping methods (table rate and distance rate) for both admins and vendors, and modify wholesale pricing visibility and purchasing for customers. These enhancements provide more flexibility in shipping options and improve the wholesale experience.

To ensure these new features work as expected, please add appropriate test cases. You can use the following commands to check for existing tests related to these features:

If no relevant tests are found, consider adding new ones to cover these scenarios.

Update the admin, vendor, and customer documentation to reflect these new shipping methods and wholesale feature changes.

Also applies to: 1107-1109

Verification successful

: Tests for shipping methods and wholesale features are present.

All necessary test cases for the new shipping methods and wholesale features have been found and are in place.

Please update the admin, vendor, and customer documentation to reflect these changes.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for existing tests related to new shipping methods
grep -rn "test.*table rate shipping" tests/
grep -rn "test.*distance rate shipping" tests/

# Check for existing tests related to wholesale features
grep -rn "test.*wholesale price" tests/
grep -rn "test.*wholesale product" tests/

Length of output: 1595

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

195-197: Method name corrected for better readability.

The method name has been updated from clickAndWaitForLocatorTobeVisible to clickAndWaitForLocatorToBeVisible. This change improves readability by correctly capitalizing "Be" in the method name.


Line range hint 1-1777: Overall improvements in code quality and consistency.

The changes made to this file are minimal but positive. They improve code readability, correct typos, and simplify implementations. The updates align well with the existing codebase and maintain consistency across methods.

To further enhance the file:

  1. Consider adding more detailed comments for complex methods.
  2. Review other similar methods in the class for potential simplification using the clickAndWaitForResponse pattern.
  3. Ensure all method names follow the same capitalization convention (e.g., toBeVisible vs ToBeVisible).
tests/pw/utils/apiUtils.ts (3)

1318-1336: Improved vendor staff creation with additional return value

The createVendorStaff function has been successfully updated to include the staffName in its return values. This enhancement provides more detailed information about the created or updated staff member, improving the function's utility.

Key improvements:

  1. The function now handles both new staff creation and existing staff updates.
  2. Error handling is in place for cases where the staff member already exists.
  3. The staffName is correctly assigned in both creation and update scenarios.
  4. The return statement has been updated to include the new staffName value.

These changes enhance the function's functionality and align with the PR objectives of improving the Pro module tests.


1345-1349: New function added for updating staff capabilities

The updateStaffCapabilities function is a valuable addition to the ApiUtils class. This new function enhances the vendor management capabilities by allowing the update of staff member permissions.

Key points:

  1. The function follows the established pattern of other API utility methods in the class.
  2. It provides a clear and concise way to update staff capabilities using a PUT request.
  3. The function signature includes all necessary parameters: staffId, payload, and optional auth.
  4. It returns a Promise<responseBody>, maintaining consistency with other API methods.

This addition aligns well with the PR objectives of enhancing the Pro module tests, particularly for vendor staff functionality.


Line range hint 1-1350: Summary of changes: Enhanced vendor staff management capabilities

The modifications to this file have successfully improved the vendor staff management functionality within the ApiUtils class. The key changes are:

  1. Updated createVendorStaff function (lines 1318-1336):

    • Now returns an additional staffName value.
    • Improved handling of both new staff creation and existing staff updates.
  2. Added new updateStaffCapabilities function (lines 1345-1349):

    • Allows updating of staff member permissions.
    • Follows the established pattern of other API utility methods.

These changes align well with the PR objectives of enhancing the Pro module tests, specifically for wholesale and vendor staff functionalities. The modifications are consistent with the existing code style and patterns, maintaining the overall integrity of the ApiUtils class.

The enhancements provide more detailed information and greater flexibility in managing vendor staff, which should facilitate more comprehensive testing and improved vendor management capabilities.

tests/pw/utils/testData.ts (2)

922-922: Approved: Improved naming consistency

The changes from bookedDayBlockes to bookedDayBlocks and fullname to fullName are good improvements. They enhance code consistency and adhere to common naming conventions in JavaScript/TypeScript.

  • bookedDayBlocks: Corrects the plural form and matches the camelCase convention.
  • fullName: Follows the camelCase convention for compound words.

These small changes can significantly improve code readability and reduce potential confusion for developers working with this data structure.

Also applies to: 1442-1442


Line range hint 1-2275: Final review: File structure and changes are appropriate

After reviewing the entire file, I can confirm that the changes made improve the code quality without introducing any new issues. The file maintains a consistent structure, and the additions fit well within the existing data object.

Key points:

  1. Naming inconsistencies were corrected (bookedDayBlocks and fullName).
  2. A new vendorStaff object was added with a clear structure for managing staff capabilities.
  3. The overall organization of the data object remains logical and easy to navigate.

The file appears to be in good shape, with the recent changes enhancing its maintainability and consistency.

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

86-86: Verify the Method 'updateOptionValue'

The method dbUtils.updateOptionValue is used to update the wholesale settings. Ensure that this method exists and is the correct choice over setOptionValue. Confirm that it updates the options as intended.

You can run the following script to verify the method's presence and usage:

Verification successful

Verified the updateOptionValue method exists and is correctly utilized in the codebase.

  • Method updateOptionValue is defined in tests/pw/utils/dbUtils.ts.
  • It is actively used across multiple test files to update various settings, confirming it functions as intended.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if 'updateOptionValue' method exists in dbUtils.

# Test: Search for 'updateOptionValue' method definition.
# Expect: Method definition should be found in dbUtils module.
rg --type js 'updateOptionValue' $(fd dbUtils.js)

Length of output: 49


Script:

#!/bin/bash
# Search for all JavaScript files related to dbUtils
fd 'dbUtils' --type f --extension js

# Search for the 'updateOptionValue' method across the entire codebase
rg --type js 'updateOptionValue'

Length of output: 69


Script:

#!/bin/bash
# Search for all JavaScript and TypeScript files related to dbUtils
fd 'dbUtils' --type f --extension js --extension ts

# Search for the 'updateOptionValue' method across JavaScript and TypeScript files
rg --type js --type ts 'updateOptionValue'

Length of output: 6926

tests/pw/pages/vendorStaffPage.ts Show resolved Hide resolved
tests/pw/tests/e2e/vendorBooking.spec.ts Show resolved Hide resolved
tests/pw/feature-map/feature-map.yml Show resolved Hide resolved
let customer: WholesaleCustomersPage;
test.describe('Wholesale test (admin)', () => {
let admin: WholesalePage;
let customer: WholesalePage;
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

Potential Confusion with Variable 'customer' Typed as 'WholesalePage'

In the 'Wholesale test (admin)' suite, the variable customer is declared as WholesalePage, which might be confusing since it represents a customer context. To improve clarity, consider renaming the variable to reflect its purpose or verifying if it should be of type CustomerPage.

tests/pw/tests/e2e/wholesale.spec.ts Show resolved Hide resolved
tests/pw/tests/e2e/wholesale.spec.ts Show resolved Hide resolved
tests/pw/tests/e2e/wholesale.spec.ts Show resolved Hide resolved
tests/pw/tests/e2e/wholesale.spec.ts Outdated Show resolved Hide resolved
tests/pw/tests/e2e/wholesale.spec.ts Show resolved Hide resolved
tests/pw/tests/e2e/wholesale.spec.ts Show resolved Hide resolved
@shashwatahalder01 shashwatahalder01 added QA approved This PR is approved by the QA team Test Automation labels Sep 25, 2024
@shashwatahalder01 shashwatahalder01 merged commit 90d99d8 into getdokan:develop Sep 25, 2024
2 checks passed
@shashwatahalder01 shashwatahalder01 deleted the miscellaneous branch September 25, 2024 07:31
@coderabbitai coderabbitai bot mentioned this pull request Sep 26, 2024
12 tasks
shashwatahalder01 added a commit to shashwatahalder01/dokan that referenced this pull request Sep 26, 2024
* Add Pro module tests(wholesale, vendorstaff) (test automation) (getdokan#2379)

* Add Wholesale module tests

* Update featureMap

* Add vendor staff & menu tests

* Fix locator issue

* Fix typos

* Update featureMap

* Rename context

* Update: Refactor base-page methods

* Add: add new setup tests to both e2e & api suite

* Update: revert typescript version

* Fix: fix a flaky test

* Add: add new helper methods

* Update: update feature-map

* Update: update test-data & interface

* Update: remove a method

* Fix: fix a failed test

* Fix: resolve pr reviews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA approved This PR is approved by the QA team Test Automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant