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

Help Finding Product Type Selector #430

Draft
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Draft

Help Finding Product Type Selector #430

wants to merge 6 commits into from

Conversation

faisal-alvi
Copy link
Member

@faisal-alvi faisal-alvi commented May 17, 2024

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

After a thorough debugging and investigation, it is found that the search for the selector for the product type was incorrectly coded (or maybe the HTML changed in recent WP/Woo releases). This PR tweaks the code so that the selector is found and the proper class is applied to the dates, making them display as fully booked when required, ultimately fixing the reported issue (#417).

Note: in the reported issue it is mentioned that it occurs only when the "Display visitor's local time" setting is enabled but it was occurring regardless of this setting.

Closes #417.

Steps to test the changes in this Pull Request:

  1. Create an accommodation product for day booking.
  2. Set "Number of rooms available" to 1 in availability settings.
  3. Book a room for a day, for example, the 25th of the month.
  4. After successful booking placement, return to the calendar and note that the 25th should appear as booked, not available to select as start date.

Changelog entry

Fix - Unavailable accommodation days appear available even when booked

/home/runner/work/woocommerce-accommodation-bookings/woocommerce-accommodation-bookings/assets/js/utils.js
  12:22  error  Replace `⏎↹↹.closest('.product.product-type-accommodation-booking')` with `.closest('.product.product-type-accommodation-booking')⏎↹↹`  prettier/prettier

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.
@faisal-alvi faisal-alvi self-assigned this May 17, 2024
@faisal-alvi faisal-alvi added this to the Future Release milestone May 17, 2024
@faisal-alvi faisal-alvi requested a review from dkotter May 17, 2024 15:02
faisal-alvi and others added 3 commits May 17, 2024 20:34
/home/runner/work/woocommerce-accommodation-bookings/woocommerce-accommodation-bookings/assets/js/utils.js
  12:9  error  Insert `(⏎↹↹`                                 prettier/prettier
  13:3  error  Replace `.length·>·0` with `↹.length·>·0⏎↹)`  prettier/prettier

✖ 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.
Copy link
Contributor

@dkotter dkotter left a comment

Choose a reason for hiding this comment

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

Code looks good to me but wondering if there's an E2E test we want to add here? If this is truly an issue due to a WordPress or Woo update that changed the markup, I would have expected a failing E2E test to catch this, though that doesn't seem to be the case.

@faisal-alvi
Copy link
Member Author

faisal-alvi commented May 28, 2024

@dkotter I checked and found the following e2e test code that covers checking the existence of the unavailable start day. The E2E test is expected to fail but it requires an investigation. The original issue is that we do not see the unavailable day, rather we see a green/available day; the following test code checks for it.

await expect(
page
.locator('.ui-datepicker-calendar td.fully_booked_start_days')
.first()
).toBeVisible();

image

@ankitguptaindia
Copy link
Member

@faisal-alvi I am checking this issue with the trunk branch and it works as expected with trunk. Can you check once if you still able to reproduce with trunk?

Recording.675.mp4

@faisal-alvi
Copy link
Member Author

I tested again in trunk and I can reproduce the issue. The following are the plugin versions/settings in use.

  • WooCommerce Accommodation Bookings v1.2.6 (trunk branch)
  • WooCommerce Bookings v2.1.2 (trunk branch)
  • WordPress v6.5.4
  • WooCommerce v8.8.3
  • Timezone Settings: Display visitor's local time

Please make sure you re-build the project when you move to the trunk branch from this PR branch. If it still does not work, let's plan a 1:1 connection.

@ankitguptaindia
Copy link
Member

ankitguptaindia commented Jun 7, 2024

@faisal-alvi I checked again with the older Woo version 8.8.3 as mentioned above and also tried without using fixes of this PR#3755 as having time zone-related fixes but I am still not able to reproduce it. Let's have a 1:1 when you have time. I will try on your setup.

@ankitguptaindia
Copy link
Member

ankitguptaindia commented Jun 21, 2024

Issue background:

This issue was reported approximately 3 months ago, and recent testing showed it was not reproducible. we tried on various environments, but it was hard to reproduce.

After in-depth debugging, it was found that this issue is only reproducible with the TT4 theme and works fine with the Storefront theme, although at the time of reporting, the issue was also happening with the Storefront theme.

Please have a look at the screencast below to know more (with trunk/stable branch):

Recording.709.mp4

The below QA report shows that the current PR fixes the issue for TT4 as well.

@ankitguptaindia
Copy link
Member

QA/Test Report-

Testing Environment -

  • WordPress: 6.5.4
  • Theme: Storefront Version: 4.6.0 / Twenty Twenty-Four Version: 1.1
  • WooCommerce - Version 9.0
  • PHP: 8.3
  • Web Server: Nginx
  • Browser: Chrome - Version 126
  • OS: macOS Sonoma 14.4.1
  • Git Branch: fix/417

Test Results - Issue has been fixed and working fine with Storefront as well as Twenty Twenty Four theme.

Functional Demo / Screencast -

After Fix:

Recording.710.mp4

Before Fix:

Recording.709.mp4

Next Step- Ready for UAT.

@ankitguptaindia
Copy link
Member

Regression+Smoke Test Report-

Testing Environment -

  • WordPress: 6.5.5
  • Theme: Storefront Version: 4.6.0 / Twenty Twenty Four: Version: 1.1
  • WooCommerce - Version 9.0.2
  • PHP: 8.3.0
  • Web Server: Nginx
  • Browser: Chrome - Version 126
  • OS: macOS Sonoma V 14.4.1

Tested with Archive File created via

php woorelease.phar build https://github.com/woocommerce/woocommerce-accommodation-bookings/tree/smoke-testing

  • Composer version - v2.3.5
  • npm version - v10.8.1
  • node version - v20.140

Please note that this plugin has been tested with the build created by the specified versions ☝🏼 of Composer, Node, and NPM.

Status- Working as expected. Ready to merge 🚀

cc: @vikrampm1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unavailable accommodation days appear as available when the "Display visitor's local time" setting is enabled.
3 participants