woocommerce / google-listings-and-ads

Sync your store with Google to list products for free, run paid ads, and track performance straight from your store dashboard.
https://woo.com/products/google-listings-and-ads/
GNU General Public License v3.0
45 stars 21 forks source link

[API PULL] Adding more tests for Notifications #2482

Closed puntope closed 1 month ago

puntope commented 1 month ago

Changes proposed in this Pull Request:

This PR adds more tests for Notification Schedules in API Pull

Screenshots:

Screenshot 2024-07-28 at 17 18 55

Detailed test instructions:

  1. See the test passing locally in your machine npm run test:e2e notifications
  2. See the test passing in GH Actions
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 63.5%. Comparing base (c3f4679) to head (a1a0ff7).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2482/graphs/tree.svg?width=650&height=150&src=pr&token=UROWUPF1LX&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce)](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2482?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) ```diff @@ Coverage Diff @@ ## develop #2482 +/- ## ============================================ - Coverage 64.5% 63.5% -1.0% ============================================ Files 795 322 -473 Lines 22844 5043 -17801 Branches 1220 1220 ============================================ - Hits 14739 3204 -11535 + Misses 7938 1672 -6266 Partials 167 167 ``` | [Flag](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2482/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | Coverage Δ | | |---|---|---| | [js-unit-tests](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2482/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | `63.5% <ø> (ø)` | | | [php-unit-tests](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2482/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | `?` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#carryforward-flags-in-the-pull-request-comment) to find out more. [see 473 files with indirect coverage changes](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2482/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce)
puntope commented 1 month ago

Thanks for adding e2e tests for notifications. All the tests have passed in my local, LGTM.

Just a note that it initially failed in my local with the following error:

✘  6 [chromium] › notifications/notifications-schedule.test.js:67:6 › Notifications Schedule › When Notifications are ready. Notifications are scheduled (35.2s)

      at ../utils/product-editor.js:263

  261 |           return expect(
  262 |               page.locator( '.product_data_tabs li.active' )
> 263 |           ).toHaveCount( 1 );
      |             ^
  264 |       },
  265 |
  266 |       async clickPluginTab() {

    at Object.waitForInteractionReady (/Users/ianlin/dev/automattic/google-listings-and-ads/tests/e2e/utils/product-editor.js:263:6)
    at Object.gotoAddProductPage (/Users/ianlin/dev/automattic/google-listings-and-ads/tests/e2e/utils/product-editor.js:170:15)
    at /Users/ianlin/dev/automattic/google-listings-and-ads/tests/e2e/specs/notifications/notifications-schedule.test.js:69:3

After checking a bit and found it's because my local wp-env docker was built previously, and it had the new product block editor feature enabled. In your tests it tested on the classic product editor so the error occurred. Maybe we could make it a follow up by disabling the new product block editor feature when testing on classic product editor. We currently turn on the product block feature when testing it, but not the other way around.

INteresting @ianlin Yes. I will create an issue for this.