Skip to content

Expand tests coverage #248

@martynmjones

Description

@martynmjones

Describe the issue

As part of the recent efforts to improve consistency across event data structures, #245 to avoid introducing issues in the future.

Now that there is a framework in place for unit testing the backend we should look to expand test coverage for the extension.

E2E tests

In #385 we added coverage for E2E tests, as a follow up to that PR we have the following list of things which aren't being tested:

  • Remove from cart with shortcode [woocommerce_cart] isn't always tracked because of immediate page redirect (not in E2E)
  • Remove from cart / Begin checkout is not consistent between blocks and shortcode, category and variation data differ.
  • Change cart quantity is not tracked with shortcode [woocommerce_cart] or with blocks (PR Remove unused function from formatters #375 removes it)
  • Add shipping info doesn't seem to be used anywhere (mentioned in Remove unused function from formatters #375 (comment))
  • Select content is difficult to test if it is followed up by a page redirect (no E2E tests written yet)
  • begin_checkout logs total item price (including discounts and price * quantity), purchase logs product object price (not final price we paid in the order). Should these be consistent?
  • When we hook into woocommerce_add_to_cart, should we get final price from cart_item_data? Otherwise we'll track product prices vs. discounted price.
  • When we change the settings to redirect to cart page after add_to_cart, do we still capture all details?
  • Testing with grouped / bundled products (grouped product seems to only track first product added to cart)
  • Shipping total and Tax total in purchase event
  • Tests for the All Products block (no longer used for the default shop page)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions