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 new tests & update flaky tests #2365

Merged
merged 12 commits into from
Sep 10, 2024

Conversation

shashwatahalder01
Copy link
Contributor

@shashwatahalder01 shashwatahalder01 commented Sep 10, 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

    • Enhanced filtering functionality on the Abuse Reports and Store Reviews pages for improved user experience.
    • Added new test cases for admin settings management in the Dokan application.
    • Introduced new selectors for better interaction with UI elements.
  • Bug Fixes

    • Improved visibility checks for various elements to prevent interaction errors.
    • Streamlined navigation methods to enhance reliability during testing.
  • Documentation

    • Updated comments for clarity regarding functionality and expected behaviors.
  • Chores

    • Removed unused imports to clean up the codebase.
    • Refactored test cases for better maintainability and clarity.

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

coderabbitai bot commented Sep 10, 2024

Walkthrough

The pull request encompasses a series of modifications across various test files and utility classes. Key changes include enhancements to filtering mechanisms, navigation methods, and the addition of new test scripts for improved testing capabilities. The updates also involve refining existing methods, improving visibility checks, and adjusting the handling of product-related actions. Additionally, several interface properties have been expanded for better clarity, and the overall structure of test data has been organized for improved usability.

Changes

Files Change Summary
tests/pw/e2e.config.ts, tests/pw/package.json Added new test scripts and a commented-out option for enabling Chrome DevTools in the configuration file.
tests/pw/pages/*.ts Enhanced filtering functionality, visibility checks, and navigation methods across various page classes. Added new methods and properties to improve interaction with UI elements and streamline test logic.
tests/pw/utils/apiUtils.ts, tests/pw/utils/helpers.ts, tests/pw/utils/interfaces.ts, tests/pw/utils/testData.ts Modified return types and added properties in utility functions and interfaces to enhance data handling and improve clarity in settings.
tests/pw/tests/e2e/*.spec.ts Adjusted test cases to improve variable management, removed unnecessary slow flags, and added new tests for menu manager settings and product actions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant API
    participant Database

    User->>UI: Interact with product filter
    UI->>API: Send filter request
    API->>Database: Query filtered results
    Database-->>API: Return filtered results
    API-->>UI: Display filtered results
    UI-->>User: Show updated product list
Loading

🐇 In the meadow where bunnies hop,
Changes made, we’ll never stop!
With filters bright and tests anew,
We leap and bound, our work is true!
Hooray for code, let’s celebrate,
With every change, we elevate! 🎉

Tip

Announcements
  • The review status is no longer posted as a separate comment when there are no actionable or nitpick comments. In such cases, the review status is included in the walkthrough comment.
  • We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs: Walkthrough comment now includes a list of potentially related PRs to help you recall past context. Please share any feedback in the discussion post on our Discord.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs in the walkthrough comment. You can also provide custom labeling instructions in the UI or configuration file.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 616b620 and 4674ead.

Files selected for processing (37)
  • tests/pw/e2e.config.ts (1 hunks)
  • tests/pw/package.json (1 hunks)
  • tests/pw/pages/abuseReportsPage.ts (4 hunks)
  • tests/pw/pages/announcementsPage.ts (1 hunks)
  • tests/pw/pages/basePage.ts (8 hunks)
  • tests/pw/pages/customerPage.ts (1 hunks)
  • tests/pw/pages/privacyPolicyPage.ts (1 hunks)
  • tests/pw/pages/productAdvertisingPage.ts (3 hunks)
  • tests/pw/pages/productQAPage.ts (10 hunks)
  • tests/pw/pages/productReviewsPage.ts (1 hunks)
  • tests/pw/pages/productsPage.ts (3 hunks)
  • tests/pw/pages/requestForQuotationsPage.ts (1 hunks)
  • tests/pw/pages/selectors.ts (12 hunks)
  • tests/pw/pages/sellerBadgesPage.ts (1 hunks)
  • tests/pw/pages/settingsPage.ts (3 hunks)
  • tests/pw/pages/singleProductPage.ts (2 hunks)
  • tests/pw/pages/singleStorePage.ts (1 hunks)
  • tests/pw/pages/spmvPage.ts (1 hunks)
  • tests/pw/pages/storeReviewsPage.ts (3 hunks)
  • tests/pw/pages/storesPage.ts (1 hunks)
  • tests/pw/pages/vendorBookingPage.ts (2 hunks)
  • tests/pw/pages/vendorPage.ts (1 hunks)
  • tests/pw/pages/vendorSubscriptionsPage.ts (1 hunks)
  • tests/pw/pages/vendorVerificationsPage.ts (2 hunks)
  • tests/pw/pages/wholesaleCustomersPage.ts (1 hunks)
  • tests/pw/pages/withdrawsPage.ts (2 hunks)
  • tests/pw/tests/e2e/coupons.spec.ts (1 hunks)
  • tests/pw/tests/e2e/plugin.spec.ts (1 hunks)
  • tests/pw/tests/e2e/productAdvertising.spec.ts (4 hunks)
  • tests/pw/tests/e2e/productQA.spec.ts (1 hunks)
  • tests/pw/tests/e2e/settings.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorBooking.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorVerifications.spec.ts (1 hunks)
  • tests/pw/utils/apiUtils.ts (3 hunks)
  • tests/pw/utils/helpers.ts (1 hunks)
  • tests/pw/utils/interfaces.ts (13 hunks)
  • tests/pw/utils/testData.ts (14 hunks)
Files skipped from review due to trivial changes (10)
  • tests/pw/e2e.config.ts
  • tests/pw/pages/privacyPolicyPage.ts
  • tests/pw/pages/singleStorePage.ts
  • tests/pw/pages/vendorPage.ts
  • tests/pw/pages/vendorSubscriptionsPage.ts
  • tests/pw/pages/wholesaleCustomersPage.ts
  • tests/pw/tests/e2e/coupons.spec.ts
  • tests/pw/tests/e2e/plugin.spec.ts
  • tests/pw/tests/e2e/vendorBooking.spec.ts
  • tests/pw/tests/e2e/vendorVerifications.spec.ts
Additional context used
Biome
tests/pw/pages/basePage.ts

[error] 590-590: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Additional comments not posted (71)
tests/pw/package.json (2)

14-14: LGTM!

The test:env:setup script is approved. It enhances the testing capabilities by allowing for a more structured setup process for the testing environment.


15-15: LGTM!

The test:site:reset script is approved. It facilitates better management of test scenarios by allowing for a structured reset process for the testing environment.

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

67-67: LGTM!

The change is approved. It enhances the reliability of the test by preventing flakiness that could arise from the row actions being hidden during the execution of the hover and click operations that follow.

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

Line range hint 1-1: LGTM!

The removal of the productName variable from the scope of the test suite is approved. It enhances the clarity of the test by ensuring that productName is only instantiated when required, thereby reducing its scope and potential for unintended side effects.


Line range hint 16-22: LGTM!

The changes in the beforeAll hook are approved. The omission of the assignment to productName enhances the clarity of the test by making the variable's lifecycle more explicit and localized.


37-38: LGTM!

The changes in the test case for adding a product advertisement are approved. Creating the product name directly within the test case enhances the clarity of the test by making the variable's lifecycle more explicit and localized.


54-55: LGTM!

The changes in the test case for expiring an advertised product are approved. Creating a new product advertisement within the test itself not only updates the logic for how advertised products are handled but also ensures that the correct product is referenced when expiring an advertisement.

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

49-49: LGTM!

The changes to the filterAbuseReports function are approved. The updates improve the filtering functionality and user experience.

Key improvements:

  • Navigation method updated to goto for streamlined code.
  • Filtering logic refined to use clickAndWaitForResponse with filteredResult for better responsiveness and accuracy.
  • Clear filter action added to enhance user experience.

Also applies to: 59-59, 65-65, 73-75

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

24-24: LGTM!

The addition of productAddedSuccessMessage and productWithQuantityAddedSuccessMessage to the destructured object is approved. This change enhances the information available for rendering or processing on the page.


66-67: LGTM!

The modification of the visibility check for the product location elements is approved. The change ensures that the test remains reliable despite external factors affecting the product location's visibility.

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

59-61: LGTM!

The addition of the new test case "admin can set Dokan menu manager settings" is approved. This test case enhances the test coverage for the admin functionalities related to menu management and is seamlessly integrated into the existing test suite.

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

33-33: LGTM!

The change to include filteredResult in the destructuring of storeReviewsAdmin.filters is approved. This change likely enhances how filtered results are processed and displayed, allowing for more dynamic interaction with the filtered results in the UI.


106-111: LGTM!

Encapsulating the logic for selecting all items within a new asynchronous function, toPass, is approved. This change introduces a conditional check that ensures the bulk action is only applied when appropriate, thereby improving the robustness of the bulk actions feature.

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

76-77: LGTM!

Capturing the answer created in the createProductQuestionAnswer function call and passing both the questionId and the newly captured answer to the deleteAnswer function is approved. This change enhances the test's accuracy by ensuring that the correct answer is being deleted, reflecting a more realistic scenario in the testing process.

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

60-60: LGTM!

Replacing the goIfNotThere method with goto in the addNewProductAdvertisement method is approved. This change simplifies the navigation logic by directly navigating to the specified URL without the conditional check that goIfNotThere presumably performed. The overall functionality of adding a new product advertisement remains intact.


83-83: LGTM!

Replacing the goIfNotThere method with goto in the searchAdvertisedProduct method is approved. This change simplifies the navigation logic by directly navigating to the specified URL without the conditional check that goIfNotThere presumably performed. The overall functionality of searching for an advertised product remains intact.

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

76-76: LGTM!

The added visibility check for the announcement cell is a good enhancement to the editAnnouncement method. It ensures that the UI element is present and interactable before proceeding with the hover and click actions, thereby improving the robustness of the editing process.

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

117-117: Verify the impact of the URL endpoint change.

The URL endpoint used in the clickAndWaitForResponseAndLoadState function call has been changed from data.subUrls.frontend.vDashboard.products to data.subUrls.ajax.

Please ensure that this change is thoroughly tested to confirm that it behaves as expected and does not introduce any unintended side effects or break the product cloning functionality.

Run the following script to verify the URL endpoint change:

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

36-36: LGTM!

The addition of filteredResult in the destructured variables of withdrawsAdmin.filters is a good enhancement to the filtering functionality. It allows the class to utilize filteredResult in subsequent operations, potentially improving the filtering mechanism.


56-56: LGTM!

The change from pressAndWaitForResponse with data.key.enter to clickAndWaitForResponse with withdrawsAdmin.filters.filteredResult(input) is a good improvement to the filtering functionality within the 'by-vendor' case.

This adjustment suggests a shift from simulating a keyboard action to directly invoking a method that likely processes the filtered results, potentially leading to a more efficient and accurate filtering operation.

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

1-1: LGTM!

The removal of expect from the import statement is approved. It does not affect the functionality of the code.

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

291-291: Streamlined user interaction.

The change from keyboard interactions to a direct click on the search result corresponding to the customer's name is approved. It streamlines the user interaction and makes it more intuitive.


308-309: Enhanced navigation logic.

The change from goto to gotoUntilNetworkidle and the addition of a check to ensure that a calendar loader is not visible are approved. These changes enhance the navigation logic to ensure that the page has fully loaded and all network requests have settled before proceeding. They also ensure that the application is in a stable state before further actions are taken.

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

22-24: New method for navigation.

The addition of the goToProductQA method is approved. It encapsulates the navigation logic, making it easier to manage and modify in the future.


26-28: New method for navigation.

The addition of the goToQuestionDetails method is approved. It encapsulates the navigation logic, making it easier to manage and modify in the future.


34-34: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToProductQA method is approved. It improves readability and centralizes the navigation logic.


56-56: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method is approved. It improves readability and centralizes the navigation logic.


79-79: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToProductQA method is approved. It improves readability and centralizes the navigation logic.


105-111: Improved readability, centralized navigation logic, and enhanced reliability.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method and the replacement of await this.wait(1) with a more robust handling of asynchronous operations using toPass are approved. These changes improve readability, centralize the navigation logic, and enhance the reliability of the tests by reducing flakiness associated with timing issues.


117-117: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method is approved. It improves readability and centralizes the navigation logic.


127-129: Improved readability, centralized navigation logic, and enhanced reliability.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method and the replacement of await this.wait(1) with a more robust handling of asynchronous operations using toBeVisible are approved. These changes improve readability, centralize the navigation logic, and enhance the reliability of the tests by reducing flakiness associated with timing issues.


138-153: Improved readability, centralized navigation logic, and enhanced reliability.

The replacement of direct calls to goIfNotThere with the newly introduced goToQuestionDetails method and the replacement of await this.wait(1) with a more robust handling of asynchronous operations using toPass are approved. These changes improve readability, centralize the navigation logic, and enhance the reliability of the tests by reducing flakiness associated with timing issues.


159-161: Improved reliability, readability, and centralized navigation logic.

The modification of the deleteAnswer method to accept an additional parameter, answer, which is used to check for the presence of the answer text before proceeding with the deletion, and the replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method are approved. These changes improve the reliability of the tests by ensuring that the answer text is present before proceeding with the deletion. They also improve readability and centralize the navigation logic.


169-169: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method is approved. It improves readability and centralizes the navigation logic.

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

65-66: LGTM!

The changes to the stringBetweenTags function look good:

  • Using match with a more general regular expression makes the function more versatile and able to handle various input strings.
  • Returning an empty string when no match is found is safer than potentially returning undefined.

The code changes are approved.

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

152-153: LGTM!

The addition of resetting previous filters before applying new ones in the filterVerificationRequests function is a good improvement:

  • It ensures a clean state before applying new filters.
  • It avoids any unintended filtering behavior caused by previous filters.

The code changes are approved.

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

1-1: Verify the impact of removing the expect import on the tests.

The import statement for the expect function from @playwright/test has been removed. This change suggests a potential shift in the testing strategy or a refactoring of how assertions are handled within the tests defined in this file.

Please ensure that:

  1. The removal of the expect import does not break any existing tests in this file.
  2. If assertions are now being handled differently, the new approach is consistently applied throughout the file.
  3. If expect is no longer necessary, all its usages have been removed from the test cases.

To verify the impact of removing the expect import, you can run the following script:

If the tests pass without any issues and there are no remaining usages of expect in the file, then the removal of the import statement is safe. Otherwise, please investigate and fix any broken tests or inconsistencies in how assertions are handled.

Verification successful

Removal of expect import is safe.

The expect function is not used in the tests/pw/pages/storesPage.ts file, so its import can be safely removed without impacting the tests.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash

# Description: 
# Verify that removing the `expect` import does not break any tests in this file.

# Test 1: Search for usages of `expect` in this file. 
# Expect: No occurrences of `expect` (ignoring the import statement).
rg --type typescript -g '!import' -w 'expect' tests/pw/pages/storesPage.ts

# Test 2: Run the tests defined in this file.
# Expect: All tests pass without any issues related to missing `expect`.
npm run test:pw tests/pw/pages/storesPage.test.ts

Length of output: 233


Script:

#!/bin/bash

# Search for usages of `expect` in the file, excluding import statements.
rg -w 'expect' tests/pw/pages/storesPage.ts

Length of output: 43

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

210-210: LGTM!

The visibility check for the quote cell is a good practice to ensure the element is present before interacting with it. This helps prevent potential errors.


217-217: LGTM!

The visibility check for the quote cell is a good practice to ensure the element is present before interacting with it. This helps prevent potential errors.


224-224: LGTM!

The visibility check for the quote cell is a good practice to ensure the element is present before interacting with it. This helps prevent potential errors.

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

232-232: LGTM!

The change enhances the specificity of the success message displayed to the user when no quantity is specified. It improves the user experience by providing clearer feedback on the action taken.


234-234: LGTM!

The change enhances the specificity of the success message displayed to the user when a quantity is provided. It improves the user experience by providing clearer feedback on the action taken, reflecting the quantity of the product added to the cart.

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

111-111: LGTM!

The modification to the setDokanSellingSettings method to utilize the new goToSingleDokanSettings method streamlines the process of accessing selling options. It improves the consistency and maintainability of the code by utilizing the new method across the codebase.


271-311: LGTM!

The new setDokanMenuManagerSettings method enhances the functionality of the SettingsPage class by providing a convenient way to manage Dokan menu settings. It improves the automation of menu configuration by iterating over a predefined list of options and enabling them programmatically.

The verification step ensures that the changes are successfully applied by checking the background color of the switchers, adding robustness to the configuration process.

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

Line range hint 1415-1495: LGTM!

The addition of the settingTitle property to various sections within the dokanSettings interface enhances the structure by providing a title or label for each respective section. This improves clarity and usability without altering existing functionality.

Also applies to: 1499-1507, 1515-1522, 1529-1536, 1544-1583, 1591-1600, 1607-1613, 1628-1637, 1650-1657, 1667-1677

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

484-484: Improved reliability by forcing visibility of row actions.

The change to the goToProductEdit method, which forces the visibility of row actions by removing a specific class from the product vendor's row actions element, aims to mitigate flakiness in the UI tests. This ensures that the necessary elements are visible before interaction, enhancing the reliability of the test.


570-570: Expanded destructuring to handle additional product addition messages.

The expansion of the productDetails destructuring in the multipleElementVisible method to include productAddedSuccessMessage and productWithQuantityAddedSuccessMessage suggests that the UI now handles additional messages related to product addition. These properties may be relevant for user feedback or assertions in the tests.


677-685: Enhanced reliability of enabling wholesale price option.

The refactoring of the addProductWholesaleOptions method to include a new asynchronous function improves the method's reliability. The function checks the visibility of the wholesale price option and enables it if not visible. This conditional check ensures that the necessary UI elements are present before proceeding with further actions. The added assertion to confirm the visibility of the option strengthens the test's validation logic.

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

587-591: Improved element manipulation and validation with new methods.

The addition of new methods like setElementCssStyle, checkIfNotChecked, and methods for retrieving selected values and text from select elements enhances the functionality of the BasePage class. These methods provide more robust ways to interact with and validate web elements, improving the overall usability of the class.

Also applies to: 745-749, 770-776, 823-842, 1414-1417, 1425-1426, 1435-1436, 1459-1465

Tools
Biome

[error] 590-590: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


1425-1426: More flexible assertions with updated methods.

The updates to existing methods like toBeChecked and toContainText to accept additional options allow for more flexible assertions. These changes enhance the assertion capabilities of the BasePage class, providing more control over the validation process.

Also applies to: 1435-1436


1459-1465: Strengthened validation with new assertion method.

The addition of the toHaveSelectedValue assertion method strengthens the validation capabilities of the BasePage class for select elements. This method allows for verifying that a select element has a specific value, improving the robustness of the test assertions.


590-590: False positive: Assignment in expression is intentional.

The static analysis hint flagging the assignment in the expression on line 590 appears to be a false positive. In this context, the assignment is intentional and does not introduce confusion or side effects. The use of the assignment is clear and does not negatively impact the readability or maintainability of the code.

Tools
Biome

[error] 590-590: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

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

1367-1371: LGTM!

The changes to the createProductQuestion method look good:

  • The return type has been updated to include the question text as an additional string in the returned tuple.
  • The question text is correctly extracted from the responseBody and returned.

This improves the utility of the method by providing more information about the created product question.


1394-1398: Looks good!

The changes to the createProductQuestionAnswer method are approved:

  • The return type now includes the processed answer text as an additional string in the returned tuple.
  • The stringBetweenTags helper function is used to correctly extract the relevant part of the answer text from the responseBody.

Returning the processed answer text improves the utility of this method.

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

922-922: LGTM!

The addition of the bookedDayBlockes property to the data export looks good. It provides a URL for retrieving booked day blocks, which will be useful for testing booking-related functionality.


1441-1441: LGTM!

The modification of the lastname property in the customer object from 'ln' to 'c1' is approved. It simplifies the test customer's last name without causing any problems.


1442-1442: LGTM!

The addition of the fullname property to the customer object is approved. It provides a convenient way to access the full name of the test customer by concatenating the CUSTOMER environment variable with the last name 'c1'. This enhances the test data without causing any problems.


1443-1443: LGTM!

The addition of the email property to the customer object is approved. It provides a convenient way to access the email address of the test customer by concatenating the CUSTOMER environment variable with the email domain '@email.com'. This enhances the test data without causing any problems.


1888-1888: LGTM!

The addition of the settingTitle property with the value 'General Settings' to the general object in dokanSettings is approved. It provides a clear and accurate title for the general settings section, improving the organization of the test data.


1899-1899: LGTM!

The addition of the settingTitle property with the value 'Selling Option Settings' to the selling object in dokanSettings is approved. It provides a clear and accurate title for the selling options settings section, improving the organization of the test data.


1912-1912: LGTM!

The addition of the settingTitle property with the value 'Withdraw Settings' to the withdraw object in dokanSettings is approved. It provides a clear and accurate title for the withdraw settings section, improving the organization of the test data.


1936-1936: LGTM!

The addition of the settingTitle property with the value 'Reverse Withdrawal Settings' to the reverseWithdraw object in dokanSettings is approved. It provides a clear and accurate title for the reverse withdrawal settings section, improving the organization of the test data.


1945-1945: LGTM!

The addition of the settingTitle property with the value 'Site and Store Page Settings' to the page object in dokanSettings is approved. It provides a clear and accurate title for the site and store page settings section, improving the organization of the test data.


1955-1955: LGTM!

The addition of the settingTitle property with the value 'Appearance Settings' to the appearance object in dokanSettings is approved. It provides a clear and accurate title for the appearance settings section, improving the organization of the test data.


1966-1966: LGTM!

The addition of the settingTitle property with the value 'Menu Manager Settings' to the menuManager object in dokanSettings is approved. It provides a clear and accurate title for the menu manager settings section, improving the organization of the test data.


1972-1972: LGTM!

The addition of the settingTitle property with the value 'Privacy Settings' to the privacyPolicy object in dokanSettings is approved. It provides a clear and accurate title for the privacy settings section, improving the organization of the test data.


1980-1980: LGTM!

The addition of the settingTitle property with the value 'Colors Settings' to the colors object in dokanSettings is approved. It provides a clear and accurate title for the colors settings section, improving the organization of the test data.


2048-2048: LGTM!

The addition of the settingTitle property with the value 'Shipping Status Settings' to the shippingStatus object in dokanSettings is approved. It provides a clear and accurate title for the shipping status settings section, improving the organization of the test data.

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

1738-1738: LGTM!

The verificationRequestCell selector looks good and should correctly locate the table cell containing the specified requestId. The line range is also specified accurately.


6835-6835: LGTM!

The productAddedSuccessMessage selector looks good and should correctly locate the success message containing the specified productName after adding a product to the cart. The line range is also specified accurately.


6836-6836: LGTM!

The productWithQuantityAddedSuccessMessage selector looks good and should correctly locate the success message containing the specified productName and quantity after adding a product to the cart. The line range is also specified accurately.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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: 2

Outside diff range, codebase verification and nitpick comments (3)
tests/pw/pages/vendorBookingPage.ts (1)

298-298: Inconsistent URL endpoint usage detected.

The new URL endpoint data.subUrls.frontend.bookedDayBlockes has been added, but the old endpoint data.subUrls.frontend.vDashboard.addBooking is still present in multiple locations within the vendorBookingPage.ts file. This inconsistency could lead to potential issues in the booking functionality. Please review and update the usage of the old endpoint to ensure consistency and correctness.

  • data.subUrls.frontend.vDashboard.addBooking is still used in several places in vendorBookingPage.ts.
Analysis chain

URL endpoint update.

The change in the URL endpoint from data.subUrls.frontend.vDashboard.addBooking to data.subUrls.frontend.bookedDayBlockes is approved.

However, ensure that this change is thoroughly tested to confirm that it behaves as expected and does not break the booking functionality.

Run the following script to verify the booking functionality:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the booking functionality after the URL endpoint update.

# Test: Search for the usage of the new URL endpoint. Expect: Only occurrences of the new endpoint.
rg --type typescript -A 5 $'data.subUrls.frontend.bookedDayBlockes'

# Test: Search for the usage of the old URL endpoint. Expect: No occurrences of the old endpoint.
rg --type typescript -A 5 $'data.subUrls.frontend.vDashboard.addBooking'

Length of output: 208


Script:

#!/bin/bash
# Description: Verify the booking functionality after the URL endpoint update.

# Test: Search for the usage of the new URL endpoint. Expect: Only occurrences of the new endpoint.
rg -A 5 'data.subUrls.frontend.bookedDayBlockes'

# Test: Search for the usage of the old URL endpoint. Expect: No occurrences of the old endpoint.
rg -A 5 'data.subUrls.frontend.vDashboard.addBooking'

Length of output: 2786

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

336-336: Add line range for the code segment.

The code segment for the filteredResult selector is missing the line range in the review comment. Please add the line range to clearly specify the location of the selector within the file.


6740-6741: Correct the typo in the selector name.

The selector name calanderLoader contains a typo. It should be calendarLoader instead. Please update the selector name to fix the typo and improve code readability.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 616b620 and 4674ead.

Files selected for processing (37)
  • tests/pw/e2e.config.ts (1 hunks)
  • tests/pw/package.json (1 hunks)
  • tests/pw/pages/abuseReportsPage.ts (4 hunks)
  • tests/pw/pages/announcementsPage.ts (1 hunks)
  • tests/pw/pages/basePage.ts (8 hunks)
  • tests/pw/pages/customerPage.ts (1 hunks)
  • tests/pw/pages/privacyPolicyPage.ts (1 hunks)
  • tests/pw/pages/productAdvertisingPage.ts (3 hunks)
  • tests/pw/pages/productQAPage.ts (10 hunks)
  • tests/pw/pages/productReviewsPage.ts (1 hunks)
  • tests/pw/pages/productsPage.ts (3 hunks)
  • tests/pw/pages/requestForQuotationsPage.ts (1 hunks)
  • tests/pw/pages/selectors.ts (12 hunks)
  • tests/pw/pages/sellerBadgesPage.ts (1 hunks)
  • tests/pw/pages/settingsPage.ts (3 hunks)
  • tests/pw/pages/singleProductPage.ts (2 hunks)
  • tests/pw/pages/singleStorePage.ts (1 hunks)
  • tests/pw/pages/spmvPage.ts (1 hunks)
  • tests/pw/pages/storeReviewsPage.ts (3 hunks)
  • tests/pw/pages/storesPage.ts (1 hunks)
  • tests/pw/pages/vendorBookingPage.ts (2 hunks)
  • tests/pw/pages/vendorPage.ts (1 hunks)
  • tests/pw/pages/vendorSubscriptionsPage.ts (1 hunks)
  • tests/pw/pages/vendorVerificationsPage.ts (2 hunks)
  • tests/pw/pages/wholesaleCustomersPage.ts (1 hunks)
  • tests/pw/pages/withdrawsPage.ts (2 hunks)
  • tests/pw/tests/e2e/coupons.spec.ts (1 hunks)
  • tests/pw/tests/e2e/plugin.spec.ts (1 hunks)
  • tests/pw/tests/e2e/productAdvertising.spec.ts (4 hunks)
  • tests/pw/tests/e2e/productQA.spec.ts (1 hunks)
  • tests/pw/tests/e2e/settings.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorBooking.spec.ts (1 hunks)
  • tests/pw/tests/e2e/vendorVerifications.spec.ts (1 hunks)
  • tests/pw/utils/apiUtils.ts (3 hunks)
  • tests/pw/utils/helpers.ts (1 hunks)
  • tests/pw/utils/interfaces.ts (13 hunks)
  • tests/pw/utils/testData.ts (14 hunks)
Files skipped from review due to trivial changes (10)
  • tests/pw/e2e.config.ts
  • tests/pw/pages/privacyPolicyPage.ts
  • tests/pw/pages/singleStorePage.ts
  • tests/pw/pages/vendorPage.ts
  • tests/pw/pages/vendorSubscriptionsPage.ts
  • tests/pw/pages/wholesaleCustomersPage.ts
  • tests/pw/tests/e2e/coupons.spec.ts
  • tests/pw/tests/e2e/plugin.spec.ts
  • tests/pw/tests/e2e/vendorBooking.spec.ts
  • tests/pw/tests/e2e/vendorVerifications.spec.ts
Additional context used
Biome
tests/pw/pages/basePage.ts

[error] 590-590: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Additional comments not posted (71)
tests/pw/package.json (2)

14-14: LGTM!

The test:env:setup script is approved. It enhances the testing capabilities by allowing for a more structured setup process for the testing environment.


15-15: LGTM!

The test:site:reset script is approved. It facilitates better management of test scenarios by allowing for a structured reset process for the testing environment.

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

67-67: LGTM!

The change is approved. It enhances the reliability of the test by preventing flakiness that could arise from the row actions being hidden during the execution of the hover and click operations that follow.

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

Line range hint 1-1: LGTM!

The removal of the productName variable from the scope of the test suite is approved. It enhances the clarity of the test by ensuring that productName is only instantiated when required, thereby reducing its scope and potential for unintended side effects.


Line range hint 16-22: LGTM!

The changes in the beforeAll hook are approved. The omission of the assignment to productName enhances the clarity of the test by making the variable's lifecycle more explicit and localized.


37-38: LGTM!

The changes in the test case for adding a product advertisement are approved. Creating the product name directly within the test case enhances the clarity of the test by making the variable's lifecycle more explicit and localized.


54-55: LGTM!

The changes in the test case for expiring an advertised product are approved. Creating a new product advertisement within the test itself not only updates the logic for how advertised products are handled but also ensures that the correct product is referenced when expiring an advertisement.

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

49-49: LGTM!

The changes to the filterAbuseReports function are approved. The updates improve the filtering functionality and user experience.

Key improvements:

  • Navigation method updated to goto for streamlined code.
  • Filtering logic refined to use clickAndWaitForResponse with filteredResult for better responsiveness and accuracy.
  • Clear filter action added to enhance user experience.

Also applies to: 59-59, 65-65, 73-75

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

24-24: LGTM!

The addition of productAddedSuccessMessage and productWithQuantityAddedSuccessMessage to the destructured object is approved. This change enhances the information available for rendering or processing on the page.


66-67: LGTM!

The modification of the visibility check for the product location elements is approved. The change ensures that the test remains reliable despite external factors affecting the product location's visibility.

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

59-61: LGTM!

The addition of the new test case "admin can set Dokan menu manager settings" is approved. This test case enhances the test coverage for the admin functionalities related to menu management and is seamlessly integrated into the existing test suite.

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

33-33: LGTM!

The change to include filteredResult in the destructuring of storeReviewsAdmin.filters is approved. This change likely enhances how filtered results are processed and displayed, allowing for more dynamic interaction with the filtered results in the UI.


106-111: LGTM!

Encapsulating the logic for selecting all items within a new asynchronous function, toPass, is approved. This change introduces a conditional check that ensures the bulk action is only applied when appropriate, thereby improving the robustness of the bulk actions feature.

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

76-77: LGTM!

Capturing the answer created in the createProductQuestionAnswer function call and passing both the questionId and the newly captured answer to the deleteAnswer function is approved. This change enhances the test's accuracy by ensuring that the correct answer is being deleted, reflecting a more realistic scenario in the testing process.

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

60-60: LGTM!

Replacing the goIfNotThere method with goto in the addNewProductAdvertisement method is approved. This change simplifies the navigation logic by directly navigating to the specified URL without the conditional check that goIfNotThere presumably performed. The overall functionality of adding a new product advertisement remains intact.


83-83: LGTM!

Replacing the goIfNotThere method with goto in the searchAdvertisedProduct method is approved. This change simplifies the navigation logic by directly navigating to the specified URL without the conditional check that goIfNotThere presumably performed. The overall functionality of searching for an advertised product remains intact.

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

76-76: LGTM!

The added visibility check for the announcement cell is a good enhancement to the editAnnouncement method. It ensures that the UI element is present and interactable before proceeding with the hover and click actions, thereby improving the robustness of the editing process.

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

117-117: Verify the impact of the URL endpoint change.

The URL endpoint used in the clickAndWaitForResponseAndLoadState function call has been changed from data.subUrls.frontend.vDashboard.products to data.subUrls.ajax.

Please ensure that this change is thoroughly tested to confirm that it behaves as expected and does not introduce any unintended side effects or break the product cloning functionality.

Run the following script to verify the URL endpoint change:

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

36-36: LGTM!

The addition of filteredResult in the destructured variables of withdrawsAdmin.filters is a good enhancement to the filtering functionality. It allows the class to utilize filteredResult in subsequent operations, potentially improving the filtering mechanism.


56-56: LGTM!

The change from pressAndWaitForResponse with data.key.enter to clickAndWaitForResponse with withdrawsAdmin.filters.filteredResult(input) is a good improvement to the filtering functionality within the 'by-vendor' case.

This adjustment suggests a shift from simulating a keyboard action to directly invoking a method that likely processes the filtered results, potentially leading to a more efficient and accurate filtering operation.

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

1-1: LGTM!

The removal of expect from the import statement is approved. It does not affect the functionality of the code.

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

291-291: Streamlined user interaction.

The change from keyboard interactions to a direct click on the search result corresponding to the customer's name is approved. It streamlines the user interaction and makes it more intuitive.


308-309: Enhanced navigation logic.

The change from goto to gotoUntilNetworkidle and the addition of a check to ensure that a calendar loader is not visible are approved. These changes enhance the navigation logic to ensure that the page has fully loaded and all network requests have settled before proceeding. They also ensure that the application is in a stable state before further actions are taken.

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

22-24: New method for navigation.

The addition of the goToProductQA method is approved. It encapsulates the navigation logic, making it easier to manage and modify in the future.


26-28: New method for navigation.

The addition of the goToQuestionDetails method is approved. It encapsulates the navigation logic, making it easier to manage and modify in the future.


34-34: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToProductQA method is approved. It improves readability and centralizes the navigation logic.


56-56: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method is approved. It improves readability and centralizes the navigation logic.


79-79: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToProductQA method is approved. It improves readability and centralizes the navigation logic.


105-111: Improved readability, centralized navigation logic, and enhanced reliability.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method and the replacement of await this.wait(1) with a more robust handling of asynchronous operations using toPass are approved. These changes improve readability, centralize the navigation logic, and enhance the reliability of the tests by reducing flakiness associated with timing issues.


117-117: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method is approved. It improves readability and centralizes the navigation logic.


127-129: Improved readability, centralized navigation logic, and enhanced reliability.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method and the replacement of await this.wait(1) with a more robust handling of asynchronous operations using toBeVisible are approved. These changes improve readability, centralize the navigation logic, and enhance the reliability of the tests by reducing flakiness associated with timing issues.


138-153: Improved readability, centralized navigation logic, and enhanced reliability.

The replacement of direct calls to goIfNotThere with the newly introduced goToQuestionDetails method and the replacement of await this.wait(1) with a more robust handling of asynchronous operations using toPass are approved. These changes improve readability, centralize the navigation logic, and enhance the reliability of the tests by reducing flakiness associated with timing issues.


159-161: Improved reliability, readability, and centralized navigation logic.

The modification of the deleteAnswer method to accept an additional parameter, answer, which is used to check for the presence of the answer text before proceeding with the deletion, and the replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method are approved. These changes improve the reliability of the tests by ensuring that the answer text is present before proceeding with the deletion. They also improve readability and centralize the navigation logic.


169-169: Improved readability and centralized navigation logic.

The replacement of a direct call to goIfNotThere with the newly introduced goToQuestionDetails method is approved. It improves readability and centralizes the navigation logic.

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

65-66: LGTM!

The changes to the stringBetweenTags function look good:

  • Using match with a more general regular expression makes the function more versatile and able to handle various input strings.
  • Returning an empty string when no match is found is safer than potentially returning undefined.

The code changes are approved.

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

152-153: LGTM!

The addition of resetting previous filters before applying new ones in the filterVerificationRequests function is a good improvement:

  • It ensures a clean state before applying new filters.
  • It avoids any unintended filtering behavior caused by previous filters.

The code changes are approved.

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

1-1: Verify the impact of removing the expect import on the tests.

The import statement for the expect function from @playwright/test has been removed. This change suggests a potential shift in the testing strategy or a refactoring of how assertions are handled within the tests defined in this file.

Please ensure that:

  1. The removal of the expect import does not break any existing tests in this file.
  2. If assertions are now being handled differently, the new approach is consistently applied throughout the file.
  3. If expect is no longer necessary, all its usages have been removed from the test cases.

To verify the impact of removing the expect import, you can run the following script:

If the tests pass without any issues and there are no remaining usages of expect in the file, then the removal of the import statement is safe. Otherwise, please investigate and fix any broken tests or inconsistencies in how assertions are handled.

Verification successful

Removal of expect import is safe.

The expect function is not used in the tests/pw/pages/storesPage.ts file, so its import can be safely removed without impacting the tests.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash

# Description: 
# Verify that removing the `expect` import does not break any tests in this file.

# Test 1: Search for usages of `expect` in this file. 
# Expect: No occurrences of `expect` (ignoring the import statement).
rg --type typescript -g '!import' -w 'expect' tests/pw/pages/storesPage.ts

# Test 2: Run the tests defined in this file.
# Expect: All tests pass without any issues related to missing `expect`.
npm run test:pw tests/pw/pages/storesPage.test.ts

Length of output: 233


Script:

#!/bin/bash

# Search for usages of `expect` in the file, excluding import statements.
rg -w 'expect' tests/pw/pages/storesPage.ts

Length of output: 43

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

210-210: LGTM!

The visibility check for the quote cell is a good practice to ensure the element is present before interacting with it. This helps prevent potential errors.


217-217: LGTM!

The visibility check for the quote cell is a good practice to ensure the element is present before interacting with it. This helps prevent potential errors.


224-224: LGTM!

The visibility check for the quote cell is a good practice to ensure the element is present before interacting with it. This helps prevent potential errors.

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

232-232: LGTM!

The change enhances the specificity of the success message displayed to the user when no quantity is specified. It improves the user experience by providing clearer feedback on the action taken.


234-234: LGTM!

The change enhances the specificity of the success message displayed to the user when a quantity is provided. It improves the user experience by providing clearer feedback on the action taken, reflecting the quantity of the product added to the cart.

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

111-111: LGTM!

The modification to the setDokanSellingSettings method to utilize the new goToSingleDokanSettings method streamlines the process of accessing selling options. It improves the consistency and maintainability of the code by utilizing the new method across the codebase.


271-311: LGTM!

The new setDokanMenuManagerSettings method enhances the functionality of the SettingsPage class by providing a convenient way to manage Dokan menu settings. It improves the automation of menu configuration by iterating over a predefined list of options and enabling them programmatically.

The verification step ensures that the changes are successfully applied by checking the background color of the switchers, adding robustness to the configuration process.

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

Line range hint 1415-1495: LGTM!

The addition of the settingTitle property to various sections within the dokanSettings interface enhances the structure by providing a title or label for each respective section. This improves clarity and usability without altering existing functionality.

Also applies to: 1499-1507, 1515-1522, 1529-1536, 1544-1583, 1591-1600, 1607-1613, 1628-1637, 1650-1657, 1667-1677

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

484-484: Improved reliability by forcing visibility of row actions.

The change to the goToProductEdit method, which forces the visibility of row actions by removing a specific class from the product vendor's row actions element, aims to mitigate flakiness in the UI tests. This ensures that the necessary elements are visible before interaction, enhancing the reliability of the test.


570-570: Expanded destructuring to handle additional product addition messages.

The expansion of the productDetails destructuring in the multipleElementVisible method to include productAddedSuccessMessage and productWithQuantityAddedSuccessMessage suggests that the UI now handles additional messages related to product addition. These properties may be relevant for user feedback or assertions in the tests.


677-685: Enhanced reliability of enabling wholesale price option.

The refactoring of the addProductWholesaleOptions method to include a new asynchronous function improves the method's reliability. The function checks the visibility of the wholesale price option and enables it if not visible. This conditional check ensures that the necessary UI elements are present before proceeding with further actions. The added assertion to confirm the visibility of the option strengthens the test's validation logic.

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

587-591: Improved element manipulation and validation with new methods.

The addition of new methods like setElementCssStyle, checkIfNotChecked, and methods for retrieving selected values and text from select elements enhances the functionality of the BasePage class. These methods provide more robust ways to interact with and validate web elements, improving the overall usability of the class.

Also applies to: 745-749, 770-776, 823-842, 1414-1417, 1425-1426, 1435-1436, 1459-1465

Tools
Biome

[error] 590-590: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


1425-1426: More flexible assertions with updated methods.

The updates to existing methods like toBeChecked and toContainText to accept additional options allow for more flexible assertions. These changes enhance the assertion capabilities of the BasePage class, providing more control over the validation process.

Also applies to: 1435-1436


1459-1465: Strengthened validation with new assertion method.

The addition of the toHaveSelectedValue assertion method strengthens the validation capabilities of the BasePage class for select elements. This method allows for verifying that a select element has a specific value, improving the robustness of the test assertions.


590-590: False positive: Assignment in expression is intentional.

The static analysis hint flagging the assignment in the expression on line 590 appears to be a false positive. In this context, the assignment is intentional and does not introduce confusion or side effects. The use of the assignment is clear and does not negatively impact the readability or maintainability of the code.

Tools
Biome

[error] 590-590: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

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

1367-1371: LGTM!

The changes to the createProductQuestion method look good:

  • The return type has been updated to include the question text as an additional string in the returned tuple.
  • The question text is correctly extracted from the responseBody and returned.

This improves the utility of the method by providing more information about the created product question.


1394-1398: Looks good!

The changes to the createProductQuestionAnswer method are approved:

  • The return type now includes the processed answer text as an additional string in the returned tuple.
  • The stringBetweenTags helper function is used to correctly extract the relevant part of the answer text from the responseBody.

Returning the processed answer text improves the utility of this method.

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

922-922: LGTM!

The addition of the bookedDayBlockes property to the data export looks good. It provides a URL for retrieving booked day blocks, which will be useful for testing booking-related functionality.


1441-1441: LGTM!

The modification of the lastname property in the customer object from 'ln' to 'c1' is approved. It simplifies the test customer's last name without causing any problems.


1442-1442: LGTM!

The addition of the fullname property to the customer object is approved. It provides a convenient way to access the full name of the test customer by concatenating the CUSTOMER environment variable with the last name 'c1'. This enhances the test data without causing any problems.


1443-1443: LGTM!

The addition of the email property to the customer object is approved. It provides a convenient way to access the email address of the test customer by concatenating the CUSTOMER environment variable with the email domain '@email.com'. This enhances the test data without causing any problems.


1888-1888: LGTM!

The addition of the settingTitle property with the value 'General Settings' to the general object in dokanSettings is approved. It provides a clear and accurate title for the general settings section, improving the organization of the test data.


1899-1899: LGTM!

The addition of the settingTitle property with the value 'Selling Option Settings' to the selling object in dokanSettings is approved. It provides a clear and accurate title for the selling options settings section, improving the organization of the test data.


1912-1912: LGTM!

The addition of the settingTitle property with the value 'Withdraw Settings' to the withdraw object in dokanSettings is approved. It provides a clear and accurate title for the withdraw settings section, improving the organization of the test data.


1936-1936: LGTM!

The addition of the settingTitle property with the value 'Reverse Withdrawal Settings' to the reverseWithdraw object in dokanSettings is approved. It provides a clear and accurate title for the reverse withdrawal settings section, improving the organization of the test data.


1945-1945: LGTM!

The addition of the settingTitle property with the value 'Site and Store Page Settings' to the page object in dokanSettings is approved. It provides a clear and accurate title for the site and store page settings section, improving the organization of the test data.


1955-1955: LGTM!

The addition of the settingTitle property with the value 'Appearance Settings' to the appearance object in dokanSettings is approved. It provides a clear and accurate title for the appearance settings section, improving the organization of the test data.


1966-1966: LGTM!

The addition of the settingTitle property with the value 'Menu Manager Settings' to the menuManager object in dokanSettings is approved. It provides a clear and accurate title for the menu manager settings section, improving the organization of the test data.


1972-1972: LGTM!

The addition of the settingTitle property with the value 'Privacy Settings' to the privacyPolicy object in dokanSettings is approved. It provides a clear and accurate title for the privacy settings section, improving the organization of the test data.


1980-1980: LGTM!

The addition of the settingTitle property with the value 'Colors Settings' to the colors object in dokanSettings is approved. It provides a clear and accurate title for the colors settings section, improving the organization of the test data.


2048-2048: LGTM!

The addition of the settingTitle property with the value 'Shipping Status Settings' to the shippingStatus object in dokanSettings is approved. It provides a clear and accurate title for the shipping status settings section, improving the organization of the test data.

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

1738-1738: LGTM!

The verificationRequestCell selector looks good and should correctly locate the table cell containing the specified requestId. The line range is also specified accurately.


6835-6835: LGTM!

The productAddedSuccessMessage selector looks good and should correctly locate the success message containing the specified productName after adding a product to the cart. The line range is also specified accurately.


6836-6836: LGTM!

The productWithQuantityAddedSuccessMessage selector looks good and should correctly locate the success message containing the specified productName and quantity after adding a product to the cart. The line range is also specified accurately.

tests/pw/pages/settingsPage.ts Show resolved Hide resolved
tests/pw/pages/selectors.ts Show resolved Hide resolved
@shashwatahalder01 shashwatahalder01 changed the title Add & update flaky tests Add new tests & update flaky tests Sep 10, 2024
@shashwatahalder01 shashwatahalder01 merged commit 656056f into getdokan:develop Sep 10, 2024
2 checks passed
@shashwatahalder01 shashwatahalder01 deleted the flaky branch September 10, 2024 08:42
@shashwatahalder01 shashwatahalder01 added QA approved This PR is approved by the QA team Test Automation labels Sep 25, 2024
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