Commit Graph

175 Commits

Author SHA1 Message Date
Jeff Stieler 8207bd7649 Add tests for customers report stats endpoint. 2019-01-23 17:48:22 -07:00
Jeff Stieler 4cfa082d0f Load gutenberg from test plugins directory if required. 2019-01-23 16:59:10 -07:00
Peter Fabian c96b291a6c Added a bit of test for interval=hour order_by=date desc. 2019-01-23 22:13:00 +01:00
Peter Fabian d61a4dd5bd Updated tests to be more stable around hour end. 2019-01-25 00:06:59 +01:00
Peter Fabian 71a9be299a Updated tests to pass before implementing the updated new/returning customer definition.
Context: https://github.com/woocommerce/wc-admin/issues/558#issuecomment-447782060
2019-01-23 13:29:40 +01:00
Peter Fabian 83a0d96f68 Added segmenting to response for revenue/stats test. 2019-01-23 10:37:09 +01:00
Peter Fabian e432a17f1e Added segmenting to response for products/stats test. 2019-01-23 10:36:50 +01:00
Peter Fabian f190c1bad1 Fixed copy-paste bug for testing subtotals in REST response. 2019-01-23 10:36:27 +01:00
Peter Fabian bcb7513f34 Added segmenting to response for coupons/stats test.
Fixed copy-paste error in test for subtotals.
2019-01-23 10:35:48 +01:00
Peter Fabian fed94cbd0c Added segmenting to response for coupons/stats test.
Changed return type for currency.
2019-01-23 10:34:07 +01:00
Peter Fabian 507ee13825 Merge branch 'master' into fix/1035
# Conflicts:
#	client/analytics/report/customers/table.js
#	includes/api/class-wc-admin-rest-reports-orders-stats-controller.php
#	tests/reports/class-wc-tests-reports-orders-stats.php
2019-01-23 10:13:55 +01:00
Jeff Stieler 2d4aea1971 Only install/activate Gutenberg plugin if WP version under test is earlier than 5.0. 2019-01-22 10:44:00 -07:00
Peter Fabian 8a9a2c0673 Fixed interval arithmetic for hours and days. 2019-01-22 17:49:02 +01:00
Justin Shreve 1f8caf106e Fix performance-indicators/allowed schema. 2019-01-21 12:28:32 -05:00
Justin Shreve 01b96ebea5 Hook up performance indicators to the REST API 2019-01-18 08:19:19 -05:00
Justin Shreve 96fc10747f Add label and generated report URL to the performance indicator response. 2019-01-18 08:16:52 -05:00
Joshua T Flowers 7cdbbf87e8 Update all wc-admin endpoints to v4 (https://github.com/woocommerce/woocommerce-admin/pull/1298)
* Update all wc-admin endpoints to v4

* Add namespace for products and customers controllers

* Include product quantity in orders data store

* Add coupons to extended data in the orders data store

* Format order statuses response from database

* Hook up orders table to orders endpoint

* Add namespace to data endpoint controller

* Add namespaces to remaining extended controllers

* Use NAMESPACE var in place of wc/v4

* Update product links in orders table to products reports

* Add coupons rest controller override

* Format coupon code in response

Co-Authored-By: joshuatf <joshuatf@gmail.com>
2019-01-18 10:52:58 +08:00
Jeff Stieler 4407e05bc4 Merge pull request woocommerce/woocommerce-admin#1342 from woocommerce/fix/1090-currency-settings-formatting
Honor WooCommerce Settings When Formatting Currency/Price
2019-01-17 17:06:13 -07:00
Jeff Stieler 6ed8ea117a Refactor formatCurrency() to use store settings for formatting rather than store locale. 2019-01-17 00:04:57 -07:00
Joshua T Flowers da22cbdc9d Update returning customer data to use customer ID (https://github.com/woocommerce/woocommerce-admin/pull/1180)
* Change check for returning customers to check customer_id

* Count distinct returning and new customers in totals

* Fix priority action misplacement and order date timestamp

* Change expected num returning/new customers to fix failing tests

Previously these included references to number of returning vs new orders.  Update to refer to the newly updated customer count.

* Use new get_customer_id_by_user_id() to get customer ID

* Fix 0 returning customers expectation

* Move returning customer function to order stats data store

* Sync order stats on order delete

* Change date compare for is_returning_customer

* Add test case for returning customer order

* Add references to  instead of 2
2019-01-17 10:47:30 +08:00
Jeff Stieler c0e6a097fd Fix orders report test. 2019-01-16 09:45:52 -07:00
Jeff Stieler 5c6174066e Add tests for report regeneration batch queuing methods. 2019-01-16 09:45:04 -07:00
Jeff Stieler 1a5af7094d Add WC_Action_Queue test helper class.
The test helper allows inspection of the action queue.
2019-01-16 09:45:04 -07:00
Jeff Stieler 4786938bdf Fix customers report tests. 2019-01-16 09:45:03 -07:00
Peter Fabian 05c7670090 Merge branch 'master' into fix/1035
# Conflicts:
#	includes/class-wc-admin-reports-interval.php
#	includes/data-stores/class-wc-admin-reports-data-store.php
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2019-01-16 12:51:23 +01:00
Joshua T Flowers 33a7cfa1b0 Store all order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1285)
* Store all orders regardless of status in wc_order_stats

* Only query select statuses if status_is or status_is_not is not set

* Fix order stats example query

* Filter category store by default order statuses

* Add table_name to interval functions to avoid ambiguity

* Filter coupon store by default order statuses

* Fix interval stats by adding table_name to interval function

* Filter products store by default order statuses

* Remove unused order_status in coupons data store

* Store products with any order status

* Fix ambiguous order by call in products data store

* Apply status filter after other filters to avoid logical OR matching

* Store all coupon data regardless of order status

* Filter taxes by default order statuses

* Filter customer stats by default order status

* Filter default order statuses in variations data store

* Use excluded statuses to filter reports by default

* DRY up default excluded statuses query

* Fix up new orders data store after rebase
2019-01-16 10:23:00 +08:00
Peter Fabian 29f07f8c57 Re-enable temporarily disabled tests. 2019-01-15 11:51:43 +01:00
Peter Fabian 5ba443fca8 Updated data store used in test to reflect the rename of class. 2019-01-15 11:50:53 +01:00
Peter Fabian c324157483 Merge branch 'master' into fix/1035
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-orders-data-store.php
#	includes/data-stores/class-wc-admin-reports-orders-stats-data-store.php
2019-01-15 11:39:39 +01:00
Peter Fabian f84efa3a58 Added test for segmenting /orders/stats by product. 2019-01-15 11:16:31 +01:00
Joshua T Flowers 14f8f08edf Add v4 orders endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1246)
* Rename orders controllers and data store to order stats

* Add orders data store and controller

* Add coupon, product, and status filters

* Add customer type query filter

* Add extended info for products and categories

* Bump API namespace to v4

* Add missing schema properties

* Set default customer_type and extended_info params

* Add orders endpoint tests

* Only use one JOIN if both excluded and included queries are used

* Optimize query calls to get product and category data

* Split product and category fetch and limit to product_cat taxonomy
2019-01-15 09:53:02 +08:00
Peter Fabian 20090a90e4 Added segments property to revenue test. 2019-01-11 18:39:57 +01:00
Peter Fabian 8059251656 Updated type for products field in response. 2019-01-11 15:29:03 +01:00
Peter Fabian ab4eb674e2 Added segments fields to expected response in tests. 2019-01-11 15:28:28 +01:00
Peter Fabian bc68976fb7 Updated schema tests to reflect latest changes. 2019-01-11 15:27:24 +01:00
Jeff Stieler adf8bbeb23 Merge pull request woocommerce/woocommerce-admin#1260 from woocommerce/fix/1239-handle-between-rest-api-param
Handle *_between params in Reports controllers
2019-01-10 10:52:08 -07:00
Jeff Stieler 2246a1e075 Expect array value for _between params.
Add param validation method and normalize to min/max based by comparing values.
2019-01-09 14:19:37 -07:00
Justin Shreve d46ce1df7a Add store performance indicator endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1255)
* Add store performance REST API endpoint

* Clean up validation, add list of allowed stats to OPTIONS endpoint, and rename endpoint to performance-indicators

* Add tests

* Add additional filters to make extending the performance indiciators area easier.

* Add docblocks for filters
2019-01-09 16:08:39 -05:00
Jeff Stieler b15a4bc804 Add utility method to normalize numeric “between” parameters in REST API requests. 2019-01-08 17:41:24 -07:00
Jeff Stieler d42e04cd59 Short circuit registered customer data update when the given ID is bad. 2019-01-08 10:29:44 -07:00
Jeff Stieler d000d3e42a Add cases using ‘name’ and a date parameter to customers report endpoint tests. 2019-01-08 10:29:42 -07:00
Jeff Stieler 737331dd3b Add missing _gmt date fields to customers report response items. 2019-01-08 10:29:41 -07:00
Jeff Stieler 1a4b890660 Add unit tests for customers report endpoint. 2019-01-08 10:29:41 -07:00
Justin Shreve f37b9319e1 Download Report API: Add path to response, fix ordering, and fix schema typo (https://github.com/woocommerce/woocommerce-admin/pull/1248)
* Add download_path to download report endpoint and fix schema typo

* Fix ordering and add tests
2019-01-08 09:51:28 -05:00
Justin Shreve e3e9ccb6a4 Add `reports/downloads/stats` REST API Endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1142)
* First pass at downloads REST API

* Add reports/downloads/stats endpoint.

* Add tests

* Update cache key
2019-01-03 13:00:48 -05:00
Joshua T Flowers 7bbdd78bde Add missing intervals to product reports (https://github.com/woocommerce/woocommerce-admin/pull/1200)
* Add missing intervals to product reports

* Fix failing tests for product stats API

Before and after query should be within today's date since missing intervals for other days will be filled in with remaining dates.
2018-12-31 13:20:22 +08:00
Joshua T Flowers 268182e75f Add invalid note ID test (https://github.com/woocommerce/woocommerce-admin/pull/1197) 2018-12-28 09:44:53 -08:00
Peter Fabian 48dfb54a48 Switched average order value from gross to net revenue (https://github.com/woocommerce/woocommerce-admin/pull/1158)
* Switched Average order value calculation from gross to net revenue.

* Updated tests to reflect switch of average order value from gross to net revenue.
2018-12-26 15:49:46 -08:00
Joshua T Flowers dcaa35c7bf Add product SKU to products report (https://github.com/woocommerce/woocommerce-admin/pull/1161)
* Add product SKU to products report

* Add tests for SKU data
2018-12-25 11:02:06 +08:00
Justin Shreve 579113910d Add remaining filters to the downloads report (https://github.com/woocommerce/woocommerce-admin/pull/1141)
* Add order number, username, and IP address filters to the downloads report.

* Adds tests
2018-12-21 16:40:41 -08:00
Justin Shreve 49a0f0f6d2 Add `reports/downloads` REST API endpoint. (https://github.com/woocommerce/woocommerce-admin/pull/1122)
* First pass at downloads REST API

* Handle PR feedback
2018-12-21 14:57:46 -08:00
Joshua T Flowers f83b0e0615 Add product categories wc-api and breadcrumbs (https://github.com/woocommerce/woocommerce-admin/pull/1131)
* Add support for product cats in wp rest api

* Add categories to WC API

* Add category breadcrumbs component

* Increase per_page limit size for product cat API

* Use wc/v3 API to pull product categories

* Return category IDs in API

* Add categories to product reports

* Add category IDs test for REST API

* Switch to getResource instead of require for total count selector
2018-12-21 10:44:27 +08:00
Peter Fabian dff8b63271 Merge pull request woocommerce/woocommerce-admin#1010 from woocommerce/fix/845
Added /reports/coupons and /reports/coupons/stats endpoints
2018-12-19 13:55:28 +01:00
Peter Fabian 4802736a0e Switched from using coupon code filter to coupon id filter by query parameter. 2018-12-19 13:37:54 +01:00
Joshua T Flowers 08d3e2c38d Change product_gross_revenue to product_net_revenue (https://github.com/woocommerce/woocommerce-admin/pull/1105)
* Change product_gross_revenue to product_net_revenue

* Change product_gross_revenue to product_net_revenue in category data store

* Change to net_revenue in frontend category report
2018-12-19 08:56:27 +08:00
Jeff Stieler 9581a658f5 Add expected locale settings to JS test setup. 2018-12-18 15:46:46 -07:00
Paul Sealock 15bbbe739d Hook up Categories table to endpoint 2018-12-19 08:36:42 +13:00
Peter Fabian 6c456657e8 Changed coupon_gross_discount to amount. 2018-12-18 12:01:42 +08:00
Peter Fabian db8004aaf7 PHPCS fixes. 2018-12-18 12:01:41 +08:00
Peter Fabian 28f6f7ece5 PHPCS changes so that I will be able to merge master into this branch.
Otherwise I get errors during merge commit.
2018-12-18 12:01:41 +08:00
Peter Fabian 46bf4bedc8 Added basic tests for coupons and coupons/stats. 2018-12-18 12:01:40 +08:00
Peter Fabian 6950522f91 Removed timezone info that was added incorrectly 2018-12-18 12:01:39 +08:00
Joshua T Flowers 9486ab7896 Update/taxes endpoint hookup/941 (https://github.com/woocommerce/woocommerce-admin/pull/1008)
* Hook up taxes to endpoint

* Hook up tax stats endpoint

* Add default tax stat totals for empty results

* Create subtotals from intervals in API

* Change orders to orders_count to keep consistent naming
2018-12-18 10:26:46 +08:00
Claudio Sanches 80f1b2f256 [REST API] Stock endpoint (https://github.com/woocommerce/woocommerce-admin/pull/974)
* New reports stock endpoint

* Register new endpoint

* Unit tests

* Included "name" into stock results

* Fixed sku type

* Improve stock _links returning properly links for variations and parent products

* Fixed docblock

* Sort stock by stock_quantity by default

* Fixed orderby

* Ignore sticky posts

* Fixed variable names
2018-12-14 07:43:39 -08:00
Timmy Crawford 88b899f7cb Remove trailing slash on base_dir variable. (https://github.com/woocommerce/woocommerce-admin/pull/1078) 2018-12-12 13:13:49 -08:00
Peter Fabian 43b60489ff Merge pull request woocommerce/woocommerce-admin#1060 from woocommerce/fix/remove-force-update-in-tests
Removed force update in tests
2018-12-12 19:47:16 +01:00
Justin Shreve 20e202080a Add Live Data to Reviews Panel (https://github.com/woocommerce/woocommerce-admin/pull/1055)
* Add Live Data to Reviews Panel
Adds the ability to embed the product in a product review response

* Clean up code needed to embed some product fields.

* Add API response tests
2018-12-12 08:35:56 -05:00
Peter Fabian 256a7fd708 Test should run without explicitly calling update for lookups.
Same as code in general, tests should also check whether the lookups are updated correctly without explicitly needing to call update on data stores.
2018-12-11 12:41:47 +01:00
Peter Fabian deba4a354a PHPCS updates. 2018-12-11 12:41:35 +01:00
Peter Fabian c612f85c6c PHPCS updates. 2018-12-11 12:39:44 +01:00
Allen Snook de105648be Activity Panel: Inbox: Filter update and error notes out of the inbox (https://github.com/woocommerce/woocommerce-admin/pull/893)
* Filter update and error notes out of the inbox

* Remove redundant trim().

* Fix test for admin notes API type parameter.
2018-12-11 09:00:57 +08:00
Joshua T Flowers 04d3ce6eb1 Add taxes endpoint and data store (https://github.com/woocommerce/woocommerce-admin/pull/1000)
* Add taxes endpoint and data store

* Add sorting options and normalize orderby param

* Add report taxes unit tests

* Add tax rate to response

* Add country, state, priority, and name to response

* Fix tax codes query param

* Add class comment

* Add missing  to record query

* Add comment about ambiguous column
2018-12-11 08:58:05 +08:00
Joshua T Flowers 557cec57cb Add tax stats endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1019) 2018-12-11 08:55:05 +08:00
Paul Sealock 93a7472e54 REST API: Add stock info to products and variations 2018-12-11 07:19:46 +13:00
Joshua T Flowers 755b9c94f7 Reduce order table net revenue by refund total (https://github.com/woocommerce/woocommerce-admin/pull/988)
* Reduce order table net revenue by refund total

* Use order utils to get refund total
2018-12-05 10:06:00 +08:00
Peter Fabian 1c8459244a Merge branch 'master' into fix/749
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2018-12-04 12:07:43 +01:00
Paul Sealock bf0e025b05 REST API: isolate extened info in /reports/products 2018-12-04 13:01:36 +13:00
Peter Fabian 1acb9827e7 Merge branch 'master' into fix/749
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2018-12-03 16:21:04 +01:00
Peter Fabian 6e68247701 Merge pull request woocommerce/woocommerce-admin#953 from woocommerce/fix/740
Added support for ordering by product name in products endpoint.
2018-12-03 11:56:28 +01:00
Paul Sealock 516062975b try/variations-endpoint 2018-12-03 12:02:58 +13:00
Peter Fabian 8b80de9bc2 Added support for ordering by product name in products endpoint. 2018-11-28 15:14:34 +01:00
Paul Sealock 0ab5c735be Remove order statuses wc- prefix 2018-11-28 15:58:17 +13:00
Peter Fabian 688b47aa7c Added tests for advanced filters of orders report. 2018-11-27 17:04:16 +01:00
Peter Fabian 26debd77c3 WIP on advanced filters.
Plus fixing bugs:
- fixed tests
- fixed schema definition to reflect response data
- split WHERE SQL clause into time constraints and rest
2018-11-16 17:51:33 +01:00
Kelly Dwan 2a9cb6509b Build: Move components to packages dir (https://github.com/woocommerce/woocommerce-admin/pull/804)
* Move components to packages folder

* Update documentation generator to handle packages/components and client/components

* Update component locations

* Update CSS build process

* Remove react-dates css, this is already included by gutenberg

* Fix CSS style - single quotes

* Fix incorrect imports

* Update package-lock with new dependencies

* Update component locations for devdocs

* Fix location of tests
2018-11-15 13:16:23 -05:00
Allen Snook e150ce4034 Merge pull request woocommerce/woocommerce-admin#851 from woocommerce/add/admin-notices-rest-api-unit-tests-2
Add admin notices REST API unit tests
2018-11-15 09:24:17 -08:00
Peter Fabian 0374119245 Added zero padding to hours in unit tests. (https://github.com/woocommerce/woocommerce-admin/pull/858) 2018-11-15 08:19:13 -05:00
Allen Snook aeb7d15c9a Deeply test the structure of a single note for expected values 2018-11-14 11:17:01 -08:00
Allen Snook 40376c23e1 Add unit tests for admin notes REST API 2018-11-14 11:06:53 -08:00
Jonathan Belcher 0193e73a87 Merge Commit 2018-11-12 14:50:13 -05:00
Kelly Dwan 8af82f3dee Build: Move `lib/csv` to packages (https://github.com/woocommerce/woocommerce-admin/pull/756)
* Move CSV to packages

* Update CSV imports

* Add some basic usage documentation

* Add csv lib to the enqueued assets

* Change name to `csv-export`

* Update webpack build process to allow for package names with dashes

* Fix capitalization

* Update readme with docs extracted from jsdoc

* Fix merge conflict commit 😣

* Check that generateCSVFileName is called with correct params
2018-11-06 16:53:22 -05:00
Kelly Dwan d27cb26ef7 Build: Move `lib/nav-utils` and `lib/history` to `@woocommerce/navigation` (https://github.com/woocommerce/woocommerce-admin/pull/763)
* Move nav-utils and history to new package

* Update config to build and use new navigation package

* Update all imports to use new navigation package

* Remove unnecessary README

* Update nav-utils path
2018-11-05 16:02:04 -05:00
Peter Fabian a1f2c867f4 Corrected failing tests. 2018-11-02 12:24:21 +01:00
Peter Fabian 6f9dd9c61b Moved wc-admin installation to phpunit bootstrap. 2018-11-02 11:31:41 +01:00
Joshua T Flowers 0f45a08f20 Update order summary in Orders report (https://github.com/woocommerce/woocommerce-admin/pull/613)
* Move TableSummary below pagination

* Add summary to order table

* Add new and returning customers

* Add product to totals in API

* Use get_var instead of get_results for unique products

* Change table summary styling

Remove slashes and increase padding between items based on discussion with @LevinMedia

Change margin to padding to overlap table shadow when pagination is not present.

* Fix wp_posts prefix and move to separate fxn

* Change new/returning customer column types to intval

* Add new/returning customer data to tests and fix formatting
2018-10-31 14:09:38 -05:00
Kelly Dwan f62537fc17 Try: Add Lerna to split out utility packages (https://github.com/woocommerce/woocommerce-admin/pull/678)
* Add lerna & GB package-building script

* Move currency library to lerna module

* Update lerna config

* Add publish commands

* Add currency as an faux-external module

* Add separate command to build just core files

* Update dependency path

* Update build script to build all packages into `dist`

* Add packages to the jest test setup

* Move date library to packages

* Update imports to use @woocommerce/date

* Output wcSettings definition before any scripts are output

Fixes issues where wc-dates lib relies on settings object

* Add the build step into travis

* Update jest config to dynamically get package paths

* Update package postcss config to match wc-admin’s main config

* Add combined watch scripts for package+app, add a `clean` command to clean up old build files

* Ignore PHPCS error (leave todo message to fix)

* Concat files with a space, fix issue where all files join in one continuous string and fail the check
2018-10-30 14:57:48 -04:00
Paul Sealock 7e5c124ce1 Filters: Add params to request query 2018-10-29 13:07:13 +13:00
Jonathan Belcher 8e46a78a2f Fix linting errors in tests/test-sample.php 2018-10-23 09:57:45 -04:00
Jonathan Belcher ecb3013fd3 Uses PHPBCF to autofix warnings and errors (https://github.com/woocommerce/woocommerce-admin/pull/611) 2018-10-22 12:20:14 -04:00
Peter Fabian 28c09248df Added remaining test files. 2018-09-24 19:46:37 +02:00