Commit Graph

3537 Commits

Author SHA1 Message Date
Vedanshu Jain 13f429e80d
Merge pull request #28102 from woocommerce/fix/28100
Exclude user table columns as well while setting metadata props
2020-11-13 13:50:02 +05:30
Christopher Allford 03f65478f2
Merge pull request #28249 from woocommerce/add/composer-2
Update Composer to v2 (includes woocommerce-blocks 3.8.0 and woocommerce-admin 1.7.0)
2020-11-12 21:16:51 -08:00
Christopher Allford 3275c5abd1 Fixed broken code coverage 2020-11-12 14:46:39 -08:00
Christopher Allford a95b384f08 Corrected code coverage path 2020-11-12 14:30:55 -08:00
Christopher Allford 30d2e278b9 Replaced the deprecated `WC_Admin_Note` class 2020-11-12 13:26:30 -08:00
Christopher Allford 7a26fc30dd Fixed failing E2E test 2020-11-12 12:52:53 -08:00
vedanshujain 13f2dd6be9 Add unit tests towards issue #28100 2020-11-13 01:02:16 +05:30
vedanshujain a2231c4387 Add unit test 2020-11-12 22:58:05 +05:30
vedanshujain 04fe12b5fb Add proper params because otherwise this query will not set caches. 2020-11-12 15:10:16 +05:30
Christopher Allford 05ebdf9677 Adjusted Travis' PHPUnit to use the vendor binary instead of a global install 2020-11-11 23:42:14 -08:00
vedanshujain fdceac9866 Delete refund cache for parent order when its deleted. 2020-11-12 10:01:15 +05:30
roykho 4ec270b93d Add unit tests for the fix 2020-11-11 15:28:06 -06:00
Roy Ho e0204e04e4
Merge pull request #28241 from woocommerce/fix/27566
Add shipping, tax and fee lines to refund response for better information in refund REST API.
2020-11-11 08:11:56 -08:00
Tam Mullen 04c9e2f12f
Merge pull request #28191 from woocommerce/packages/core-tests/functional-permlainks-test
add permalinks working test
2020-11-11 14:58:01 +00:00
Tam Mullen 8f46eec95a
Merge pull request #28198 from woocommerce/add/package-changelogs
add/update e2e package change logs
2020-11-11 14:12:52 +00:00
vedanshujain 62ae94d93e Add shipping, tax and fee lines to refund response for better information. 2020-11-11 18:47:48 +05:30
Christopher Allford 72e93f11b2
Update CHANGELOG.md
Updated the `@woocommerce/api` changelog
2020-11-10 16:32:11 -08:00
Christopher Allford 93d6b261c6
Merge pull request #28129 from woocommerce/add/lerna-hoist
add lerna hoist, use consistent package versions
2020-11-10 16:13:58 -08:00
Ron Rennick ac89e09c9e remove duplicate package dependency entries 2020-11-10 16:29:22 -04:00
Christopher Allford 11c7e3bff6 Fixed issues that caused the factory creation to fail for SimpleProduct types 2020-11-09 12:02:01 -08:00
Ron Rennick 7282e0bca6 merge master 2020-11-09 14:30:01 -04:00
Ron Rennick 76d8b16659 remove old setup wizard test 2020-11-09 13:31:19 -04:00
Christopher Allford d205d6551e Added all of the update parameters for simple products 2020-11-06 14:01:03 -08:00
Christopher Allford a646c712d8 Generalized the various restXXX functions
Since it looks like almost all of these are going to be virtually identical, it makes sense to have common functions that we can use instead of having to write all of the boilerplate unnecessarily.
2020-11-06 13:24:02 -08:00
Christopher Allford 29c9976354 Added "list", "read", "update", and "delete" actions for simple products 2020-11-06 11:11:58 -08:00
Christopher Allford 45b57d46b9 Added transformers for all of the product sub-data 2020-11-06 10:44:57 -08:00
Christopher Allford b4a2316386 Added array support to property type and model transformer transformations 2020-11-06 10:01:12 -08:00
Christopher Allford 5e35d68789 Added a new transformation for nesting transformers 2020-11-05 22:49:37 -08:00
Christopher Allford fb5f393acb Made abstract product sale dates easier to work with 2020-11-05 22:20:42 -08:00
Christopher Allford 681e568fbe Expanded on a shared transformer to encapsulate abstract product transformations 2020-11-05 21:43:45 -08:00
Christopher Allford 7fcbc69235 Added a transformer to convert between data types 2020-11-05 19:25:45 -08:00
Christopher Allford 7287eb024c Reversed the execution of transformers for "toModel" so that things like key changes will happen first 2020-11-05 16:29:04 -08:00
Christopher Allford d060108afe Added a custom transformation for models to implement specific logic. 2020-11-05 14:14:47 -08:00
Christopher Allford 4f08e102c4 Simplified the transformer usage in repositories 2020-11-05 13:57:56 -08:00
Ron Rennick 9feecc1376 add/update e2e package changelogs 2020-11-05 16:57:04 -04:00
Christopher Allford 46df060c0e Revised the ModelTransformer so that it can support more complicated transformations. 2020-11-05 12:37:40 -08:00
Nestor Soriano 8bb0f196e6 Change the strategy for moving packages
Since the Mozart package requires PHP 7.2, and we need to support 7.0
and 7.1, the moving step has been removed from the composer install
stage. Instead, now it has to be triggered manually via
`composer run move-vendor-namespaces`, and the moved package must be
added to source control. See the updated src/Internal/Vendor/REAMDE.md
for details.
2020-11-05 17:19:14 +01:00
Christopher Allford 67f57abe26 Added type-safe transformation functions for converting between API representations and model representation 2020-11-04 16:33:34 -08:00
Christopher Allford f438ddc80a Added virtually all of the data returned by the REST API to the SimpleProduct model
There's still a few things missing but I think this is a much better start than where we were before.
2020-11-04 14:55:58 -08:00
Ron Rennick d0fd8acd44 add permalinks working test 2020-11-04 14:56:48 -04:00
Christopher Allford 72d09026a6 Renamed the prettyPermalinks method to better clarify its intent 2020-11-04 10:28:10 -08:00
Nestor Soriano d620f1d232 Fix #25900 - image size customisation controls not shown
- Added the `ThemeSupport class`, with methods to add and get
  theme support options.
  - It also has a new `add_default_options` method that adds the
    options under a `_defaults` key.
- The `WC_Twenty_*` classes now use `ThemeSupport` instead of
  the `add_theme_support` function to define image and thumbnail sizes.
  - The values are defined as default options.
- The `WC_Shop_Customizer` class now uses `ThemeSupport` instead of
  `wc_get_theme_support` to check if image and thumbnail sizes UI
  should be rendered.
  - The check is made excluding default values.

With these changes the UI to change the image and thumbnail sizes
is hidden only if the options are added as non-defaults elsewhere.

Additional changes:

- The code of the `wc_get_theme_support` function is replaced with
  a simple call to `get_option` in `ThemeSupport`.
- Added the utility class `ArrayUtil`.
2020-11-04 13:01:53 +01:00
Christopher Allford b9ba2e880d Added support for installations not using pretty permalinks 2020-11-03 17:04:41 -08:00
Christopher Allford 39367de732 Fixed a bug with OAuth signature generation when using query parameters 2020-11-03 17:02:12 -08:00
Roy Ho 2d6d53ed6f
Merge pull request #28127 from woocommerce/fix/duplicate-puppeteer-dependency
remove puppeteer dependency from main package
2020-10-30 10:34:11 -07:00
Nestor Soriano 96fce186e7 Use Mozart instead of a script to renamespace packages.
A custom fork of the coenjacobs/mozart package is now used to change
the namespace of the appropriate packages (only league/container
for now) instead of the previously used prefix-vendor-namespaces script.

The packages are now moved to the src/Internal/Vendor namespace instead
of being modified in-place in the vendor directory. The namespaces
are thus now prefixed with Automattic\WooCommerce\Internal\Vendor
(previously it was just Automattic\WooCommerce\Vendor).
2020-10-30 12:28:26 +01:00
Rodrigo Primo 683c8cbcd7
Merge pull request #28116 from woocommerce/fix/flaky-coupon-test
fix flaky e2e coupon test
2020-10-29 18:04:59 -03:00
Ron Rennick bc2845fe3a merge master 2020-10-29 14:27:55 -03:00
Tam Mullen 20d973975e
Merge pull request #27916 from woocommerce/add/core-tests-readme
add readme to core tests package
2020-10-29 17:13:40 +00:00
Ron Rennick d30648f55f use waitAndClick, waitForSelector where applicable 2020-10-29 12:24:50 -03:00
Ron Rennick 55313e7006 Merge branch 'master' into fix/25643 2020-10-29 10:29:16 -03:00
Ron Rennick 8830de1fa4 use delete focus selector available on order edit 2020-10-29 09:17:35 -03:00
Ron Rennick 0424bfe847 fix typo in setup instructions URL 2020-10-29 08:44:10 -03:00
Ron Rennick 21ebe3af05 remove puppeteer dependency from e2e-environment 2020-10-29 08:41:24 -03:00
Ron Rennick ef2e226feb use focus instead of scrollTo 2020-10-28 19:15:17 -03:00
Ron Rennick 9851c26d31 Merge branch 'master' into fix/flaky-coupon-test 2020-10-28 18:48:13 -03:00
Ron Rennick 7cb68e055c add lerna hoist, use consistent package versions 2020-10-28 14:21:02 -03:00
Ron Rennick 038058af1e update product new test with correct parameters 2020-10-28 13:44:33 -03:00
Tam Mullen a0233fad93
Merge pull request #27978 from woocommerce/docs/e2e-environment-0.1.6
update e2e-environment readme
2020-10-28 12:51:13 +00:00
Tam Mullen 8e5bd336de
Merge pull request #27994 from woocommerce/fix/27979
expand e2e-utils readme, simplify exports
2020-10-28 12:50:57 +00:00
Néstor Soriano 604958c4a8
Merge pull request #28103 from woocommerce/fix/issue-27756
Fix/issue 27756
2020-10-28 10:06:55 +01:00
Ron Rennick 1794026773 fix flaky e2e coupon test 2020-10-27 16:44:42 -03:00
roykho 996d206ce5
Add unit test for #27756 2020-10-26 12:32:15 -07:00
Shiki 30854efc1b Replace assertStringContainsString with strpos
This is to make the PHP 7.0 CI pass.
2020-10-26 13:28:04 -03:00
Shiki ba3e107cb8 Orders V2 API: Add test for parent_name 2020-10-26 13:28:04 -03:00
Shiki 94ecfcab34 Orders API: Add parent_name to schema 2020-10-26 13:28:04 -03:00
Shiki c6f82b96a1 Orders API: Add unit test for parent_name line_item property 2020-10-26 13:28:04 -03:00
Shiki a05316878e Orders API Tests: Fix failing tests because of the new property 2020-10-26 13:28:04 -03:00
Shiki 3a1b125e3a Fix coding style 2020-10-26 13:28:04 -03:00
Ron Rennick 9d47a1c072 simplify e2e-environment exports 2020-10-21 16:17:10 -03:00
Ron Rennick e91a09f302 remove remaining webalias fragments 2020-10-21 15:47:09 -03:00
Ron Rennick 5e2e01e7b8 add Nightly message to log, bump Travis 2020-10-21 13:25:23 -03:00
Ron Rennick 7ebfdbeb0e add support for custom container initialization script 2020-10-21 10:53:48 -03:00
Ron Rennick 7a5cad3f99 variation test works to last uncommented step 2020-10-20 19:43:07 -03:00
Ron Rennick bf410cc44e use checkbox object for checking/unchecking 2020-10-20 17:21:34 -03:00
Ron Rennick 894dceee95 Fixes needed for variable product E2E test
- Jest/Puppeteer sometimes will not find an element on page load when that element is outside the initial viewport
- There were duplicate .variation_tab classes which confused Jest/Puppeteer
- Add function for opening and verifying new product page
- Update test sequence for changes in flow in markup and Jest/Puppeteer
2020-10-20 11:25:36 -03:00
Claudio Sanches f7e9c1bfb7
Merge pull request #27995 from rodrigoprimo/fix/phpcs-travis
Fix the Travis build job that runs PHPCS
2020-10-20 10:14:39 -03:00
Claudio Sanches 139df7bdaa
Merge pull request #27986 from woocommerce/php8/fixes-in-dependency-injection-container
[PHP 8] Fixes in the dependency injection engine for PHP 8 compatibility
2020-10-19 20:22:35 -03:00
Ron Rennick 503e898307 use direct exports 2020-10-19 11:32:28 -03:00
Rodrigo Primo 17471f8f66 Stop installing PHPCS globally in the Travis build job
PHPCS is already installed as a project dependency (we run `composer
install` for each build job) so there is no need to install it as a
global package in `tests/bin/phpcs.sh`.
2020-10-16 16:37:05 -03:00
Rodrigo Primo eaef2409bd Use phpcs installed locally instead of globally
This is an attempt to fix the PHPCS Travis build job that started
failing with the following error:

```
Running Code Sniffer.
tests/bin/phpcs.sh: line 14: phpcs: command not found
The command "bash tests/bin/phpcs.sh" exited with 127.
```

(https://travis-ci.org/github/woocommerce/woocommerce/jobs/736440739#L508)
2020-10-16 16:36:57 -03:00
Ron Rennick 3b1481bb01 expand e2e-utils readme, simplify exports 2020-10-16 16:25:23 -03:00
Julia Amosova ff67a7c1ce Add note about test locations in WC Core and other projects. 2020-10-16 11:27:00 -04:00
Julia Amosova bd5b65426f Update README with more details on how to write e2e tests. 2020-10-16 11:20:33 -04:00
Julia Amosova 8c094daceb Add guide for writing e2e tests in README 2020-10-16 11:20:24 -04:00
Nestor Soriano 042e2cd0bb Fixes in the dependency injection engine for PHP 8 compatibility
- One dummy class used for tests had a 'final private' method, this
  is not allowed in PHP 8 and so the method is now just 'private'.

- The AbstractServiceProvider class was using
  ReflectionParameter::getClass. This is deprecated in PHP8 and thus
  that usage has been replaced with an utility method that uses
  the recommended replacement.
2020-10-16 11:31:26 +02:00
Rodrigo Primo 7599517e91
Merge pull request #27965 from woocommerce/fix/27874
switch to api package, bump utils package version
2020-10-15 15:05:43 -03:00
Ron Rennick dd6d460fec update e2e-environment readme 2020-10-15 14:53:21 -03:00
Ron Rennick c3f934ad21 add e2e-environment package changelog 2020-10-15 14:14:22 -03:00
Ron Rennick 5815e5cf48
Merge pull request #27914 from woocommerce/fix/e2e-container-check
Only attempt to run E2E tests if testing host is ready
2020-10-15 13:44:55 -03:00
Ron Rennick f0e6e1761c
Merge pull request #27913 from woocommerce/fix/27820
add test:e2e-debug command
2020-10-15 13:44:32 -03:00
Ron Rennick 0a7c0dc7fc
Merge pull request #27790 from woocommerce/fix/27787
Expose automattic/puppeteer-utils in e2e-environment
2020-10-15 09:52:52 -03:00
Néstor Soriano e4a109f0d1
Merge pull request #27763 from woocommerce/fix/27445
Remove protection as we already diff and update only if needed.
2020-10-15 10:01:34 +02:00
Mahmoud Saeed ad0eff11de Add unit test for WC_Tax::get_tax_rate_classes() 2020-10-15 07:34:20 +02:00
Ron Rennick f945a0e16c switch to api package, bump utils package version 2020-10-14 15:13:08 -03:00
Ron Rennick 514e6cc308 document disabling puppeteer download 2020-10-14 13:59:37 -03:00
Vedanshu Jain ae610d3f5f
Merge pull request #27492 from woocommerce/fix/api/229
Add User-friendly Attribute Names and Values to Order Line Items Metadata
2020-10-14 22:02:19 +05:30
vedanshujain a332b399d3 Use variable instead of magic constants. 2020-10-14 18:50:44 +05:30
vedanshujain c01f32a390 Use default value if formatted value is not available 2020-10-14 14:51:19 +05:30
vedanshujain 8e12de5d3c Merge branch 'fix/api/229-unit-test' of https://github.com/shiki/woocommerce into fix/api/229 2020-10-14 13:53:03 +05:30
Julia Amosova 03078c5a9d Implement `waitAndClick` in the setup e2e test. 2020-10-13 16:25:28 -04:00
Ron Rennick 13bcd43bfe expose automattic/puppeteer-utils in e2e-environment 2020-10-13 16:16:32 -04:00
Ron Rennick 24713a45c3 restore shipping setup test 2020-10-13 16:15:07 -03:00
Shiki 1be78d1ebf Use different terms to avoid clash with the similar V2 test
I suppose I could have deleted the attribute and term first but I think
this is better and shorter. Maybe.
2020-10-13 22:32:32 +05:30
Shiki a9bf6b71ac OrdersV2: Add test for line items meta_data
This currently fails because it's not implemented yet.
2020-10-13 22:32:32 +05:30
Shiki 871a9e0b8f Add line items meta_data schema test for Orders V2 and V3
This currently fails because the expected meta_data properties are only
available in V3.
2020-10-13 22:32:32 +05:30
Shiki c5fd3ed21c WC_Tests_API_Orders: Add test data for site-level attributes 2020-10-13 22:32:31 +05:30
Shiki 62f1705690 WC_Tests_API_Orders: Rearrange order variable for clarity 2020-10-13 22:32:31 +05:30
Shiki c16ec9bf54 WC_Tests_API_Orders: Rename first_meta_data to size_* 2020-10-13 22:32:31 +05:30
Shiki a0d9b49e43 Add unit test for an Order's line item meta data. 2020-10-13 22:32:31 +05:30
Rodrigo Primo 5f5e739d7a
Update e2e test documentation to fix invalid example
This commit just updates the e2e test documentation to use a test file that exists in the section on how to run individual tests
2020-10-10 10:33:41 -03:00
Ron Rennick 903b86677c add readme to core tests package 2020-10-09 10:31:45 -03:00
Ron Rennick 62acca06e1 don't run tests if testing host not ready 2020-10-09 05:14:57 -03:00
Ron Rennick 7f57906959 add test:e2e-debug command 2020-10-09 05:00:03 -03:00
Néstor Soriano c15488d840
Merge pull request #27830 from woocommerce/php8/fix-round-function-with-non-numeric-argument 2020-10-09 08:01:44 +02:00
Christopher Allford f9ef91adc1
Merge pull request #27836 from woocommerce/packages/api/add/repository-listing
@woocommerce/api: Added list() repository operation and classes for managing store settings
2020-10-08 13:20:12 -07:00
Christopher Allford 1d0cbc8187 Merge branch 'master' into packages/api/add/repository-listing 2020-10-08 11:48:22 -07:00
Ron Rennick 31001036c9
Merge branch 'master' into fix/25962 2020-10-08 15:30:25 -03:00
Néstor Soriano e4b78cedbf
Merge pull request #27748 from woocommerce/remove-leftovers-from-improved-filtering-by-attribute-for-variations
Remove leftovers from the reverted improved filtering mechanism for variations
2020-10-08 15:45:09 +02:00
Néstor Soriano ab529835fa
Merge pull request #27840 from woocommerce/php8/fix-required-parameters-after-optional
[PHP 8] Convert optional-before-required parameters into required parameters
2020-10-08 14:22:52 +02:00
Nestor Soriano ac0641d02a Fix a couple of incompatibilities with NumberUtils::round
- Passing a string that represents a number but has spaces (e.g. ' 1 ')
  now works as expected (the number is properly interpreted)
- Passing the boolean true now returns 1, not 0
- Passing an object throws an error, instead of returning 0
2020-10-08 13:13:53 +02:00
Nestor Soriano b71f876cba Reintroduce the dependency injection related code.
After the League's Container package has been reintroduced, all the
code that implements the dependency injection mechanism in woocommerce
can be brought back as well.
2020-10-08 09:28:05 +02:00
Néstor Soriano 3e6861189e
Merge pull request #27848 from woocommerce/php8/remove-useless-test-assertion
[PHP 8] Remove a useless test assertion that fails in PHP 8
2020-10-08 09:06:39 +02:00
Ron Rennick 3a980a1241 merge current master 2020-10-07 03:17:38 -03:00
Ron Rennick 84fdfb6769 merge master 2020-10-07 03:05:04 -03:00
Julia Amosova aac4db94b2
Merge pull request #27679 from woocommerce/packages/e2e/config-functions
add eslint & babel config functions to e2e-environment
2020-10-06 14:15:56 -04:00
Ron Rennick df60bfb054
Merge pull request #27276 from woocommerce/fix/docker-ssh
Fix e2e docker:ssh command to work in any repo
2020-10-05 09:51:56 -03:00
Ron Rennick 610e787a86 package lock maintenance 2020-10-05 09:31:48 -03:00
Ron Rennick 5139c73029 allow running named test files that don't match test spec pattern 2020-10-05 09:16:27 -03:00
Christopher Allford 3558a9a025 Fixed a bug caused by differences in the URL when creating signatures on the client and server 2020-10-02 16:34:07 -07:00
Christopher Allford 6b5ff6d494 Fixed a bug that would cause Axios errors to be consumed by interceptors 2020-10-02 15:37:09 -07:00
Christopher Allford b74adf215a Adjusted the error mechanism to better follow the standard practice of rejecting HTTP errors 2020-10-02 14:10:24 -07:00
Nestor Soriano ed33a607a7 Remove a useless test assertion that fails in PHP 8
The assertion is useless (the constant is already tested a few Lines
above), and it was failing in PHP 8 because 'auto' < 2 is evaluated
as false, while it's evaluated to true in PHP 7.
2020-10-02 15:27:26 +02:00
Nestor Soriano 7485b9165f Convert optional-before-required arguments to required.
In PHP 8 required parameters after optional parameters in
function/method signatures trigger a deprecation notice. These type
of parameters are pointless since a value needs to always be
provided for them anyway, so they are actually de-facto required.

This commit converts all these not-so-optional parameters into
truly required parameters by removing their default values.
2020-10-02 09:45:09 +02:00
Christopher Allford 54b876fc75 Adjusted the typing of the ModelRepository and related interfaces to better distinguish between parent & child models 2020-10-01 18:06:34 -07:00
Christopher Allford 8f5ff436a2 Added support for flat parents to simplify calls with them 2020-10-01 17:48:37 -07:00
Christopher Allford a01da2da93 Updated the lock files 2020-10-01 16:04:03 -07:00
Christopher Allford e6efbdde34 Merge branch 'master' into packages/api/add/repository-listing 2020-10-01 15:58:48 -07:00
Christopher Allford 8ee89eb85d Documentation fixes 2020-10-01 15:53:30 -07:00
Christopher Allford cfa20570c1 Added appropriate HTTP errors to REST repository methods 2020-10-01 15:37:58 -07:00
Christopher Allford f8574bed56 Added a utility service for updating settings 2020-10-01 15:23:46 -07:00
Christopher Allford f0ad6e4fc2 Added aliases to make repository types easier to read 2020-10-01 15:00:27 -07:00
Christopher Allford 787040db4c Adjusted the ModelRepository to make repository methods more type-safe 2020-10-01 14:31:55 -07:00
Christopher Allford f2dda16c40 Updated lock files 2020-10-01 14:28:14 -07:00
Ron Rennick c17b6b5ad0 Update expected industry count 2020-10-01 14:46:04 -03:00
Ron Rennick 4af90518da lock file maintenance 2020-10-01 14:21:40 -03:00
Ron Rennick 8910357437 add missing test stubs 2020-10-01 10:25:22 -03:00
Nestor Soriano 52eed70f04 Add a 'NumberUtil' class with a 'round' method.
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.

This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
Nestor Soriano b1e81d02da Fix code style/sniffer errors in a few files. 2020-10-01 11:08:51 +02:00
Christopher Allford f6cbab8d07 Added missing static helpers for fetching repositories 2020-09-30 13:16:46 -07:00
Christopher Allford fccf1fb66e Added settings and group repositories with some basic functionality 2020-09-30 13:11:31 -07:00
Ron Rennick be15429c30 restore ability to run individual tests 2020-09-30 17:05:02 -03:00
Ron Rennick 72219b2323 move merchant tests to package 2020-09-30 14:41:31 -03:00
Christopher Allford 4c2637c479 Added a `list` operation to the repository 2020-09-30 07:59:10 -07:00
Christopher Allford f571324a09 Added better type-safety when distinguishing between resources that are children and those that are not 2020-09-29 18:40:50 -07:00
Ron Rennick 76f591251a move front end tests to package 2020-09-29 17:00:34 -03:00
Ron Rennick 27e79f465f split activation, onboarding, setup tests into separate files 2020-09-29 16:16:43 -03:00
Christopher Allford 8c5548d06e Added @template JSDoc tag to API package for better IDE support 2020-09-29 12:00:09 -07:00
Ron Rennick 1abbe3f273 initial core test package files, move setup tests to package 2020-09-29 15:22:20 -03:00
Ron Rennick fd60f7052a Merge branch 'master' into fix/e2e-url-no-port 2020-09-28 16:15:22 -03:00
Christopher Allford ef93f22321 Moved the product model for consistency with other model types 2020-09-25 14:08:19 -07:00
Christopher Allford 789773c65c Fixed E2E test 2020-09-25 14:05:11 -07:00
Christopher Allford 44c7428358 Updated package lock files and fixed test error 2020-09-25 13:49:54 -07:00
Christopher Allford 760b0e4cdb Merge branch 'master' into packages/factories-to-api-refactor 2020-09-25 13:19:36 -07:00
Christopher Allford c09d91f6ce Finished adding appropriate documentation to the API package 2020-09-25 11:11:17 -07:00
Ron Rennick 6b7d67e587 update onboarding flow for 4.6 2020-09-25 12:06:45 -03:00
vedanshujain d51dd26816 Add unit tests. 2020-09-25 19:41:20 +05:30
Christopher Allford ca0ea88e52 Updated the JSDoc and type-safety of repositories to better document the implemented operations 2020-09-24 14:22:38 -07:00
Ron Rennick 2ab59149ad revert testing change to default.json 2020-09-24 12:27:35 -03:00
Julia Amosova dcd0c46ab5
Merge pull request #27714 from woocommerce/fix/headless-flag-e2e-dev-mode
Add missing headless flag for running e2e tests in dev mode + README updates
2020-09-23 17:05:45 -04:00
Ron Rennick bde41799af merge master 2020-09-23 17:20:43 -03:00
Ron Rennick a80dc37684 merge master 2020-09-23 16:26:17 -03:00
Ron Rennick 3fbdf46192 always remove the trailing slash from the base URL 2020-09-23 16:22:15 -03:00
Nestor Soriano a94ea7f51f Remove logic for storage of attribute terms for variations
A mechanism for improved filtering by attribute for variations was
introduced some time ago. This mechanism implied maintaining term
relationships for variations, where the terms were the attributes
that defined the variation.

The mechanism was reverted because it was complex and presented many
issues, but the code that created those term relationships was kept.
This pull request removes that code and the associated unit tests.
2020-09-22 16:31:06 +02:00
Christopher Allford a7175c5ad4 Adjusted create method signature to better replicate TypeScript behavior 2020-09-21 13:44:45 -07:00
Christopher Allford 1674c05b66 Fixed the package.json files array to exclude development content 2020-09-21 13:33:57 -07:00
Christopher Allford 5297b27c79 Moved the factories from the @woocommerce/api package into the @woocommerce/e2e-utils package 2020-09-21 13:14:26 -07:00
Christopher Allford b962c10cee Updated the readme for the API package 2020-09-21 12:32:44 -07:00
Christopher Allford fba5a46243 Integrated the API package into the utils package again to generate simple products 2020-09-21 11:22:43 -07:00
Christopher Allford 8e7ef263a2 Adjusted the package exports to be easier to consume 2020-09-21 11:21:35 -07:00
Julia Amosova 12d546b280 Add `PUPPETEER_SLOWMO` to global process.env to enable it. 2020-09-20 15:34:47 -04:00
Julia Amosova c78051c7a5 Place back `scrollIntoView` to OBW e2e test. 2020-09-18 19:15:53 -04:00
Julia Amosova ff8e5bbc8b Remove `scrollIntoView` from OBW e2e test as it is not needed. 2020-09-18 18:33:21 -04:00
Christopher Allford 27d8892b28 Merge branch 'master' into packages/factories-to-api-refactor 2020-09-18 14:45:39 -07:00
Christopher Allford bf70a3ea74 Updated lock files 2020-09-18 14:43:00 -07:00
Christopher Allford d22ed6547e Merge branch 'master' into package/e2e-environment/better-container-detection 2020-09-18 14:32:11 -07:00
Christopher Allford 866ab47dda Adjusted the exports for clarity of use 2020-09-18 14:26:00 -07:00
Julia Amosova 6a93c8dd68 Added note to README on how to use `PUPPETEER_SLOWMO` variable. 2020-09-18 16:53:48 -04:00
Christopher Allford b3b92e2d4d Separated the construction of factories & repositories from the models for simplicity 2020-09-18 13:53:10 -07:00
Julia Amosova 30c904db68 Added `headless` & `slowMo` flags back to Puppeteer config. 2020-09-18 16:39:45 -04:00
Julia Amosova 38f14747fa Update commands that need to be run to build e2e test env. 2020-09-18 16:05:36 -04:00
Julia Amosova 68c06683e7 Add note regarding re-initializing test container when `docker:down/up`. 2020-09-18 15:26:50 -04:00
Julia Amosova 24b987a409 Add link to `Test Variables` section when mentioning changing the port. 2020-09-18 15:22:25 -04:00
Julia Amosova 6a562f8dfa Correct type: from `MariaDV` to `MariaDB` throughout e2e README. 2020-09-18 15:17:59 -04:00
Julia Amosova 085d7d884f Add `Install NVM` section to README's Table of Contents. 2020-09-18 14:52:46 -04:00
Julia Amosova 2455a82f36 Add to README how to run tests using custom WP, PHP and MariaDV versions. 2020-09-18 14:48:26 -04:00
Julia Amosova d66e7ef3b3 Update README with more accurate details on how to run e2e tests. 2020-09-18 14:30:54 -04:00
Julia Amosova 98edbef9a9 Add missing headless flag for running e2e tests in dev mode. 2020-09-18 13:43:44 -04:00
Ron Rennick 9915a5b142 merge master 2020-09-18 12:53:28 -03:00
Rodrigo Primo 197e8d274c
Merge pull request #27616 from woocommerce/fix/26960
Paypal gateway: protect code against a fatal error if WooCommerce is unable to communicate with PayPal
2020-09-18 09:34:57 -03:00
vedanshujain 140dafb704 Add unit tests for when PayPal API will return error 2020-09-18 17:12:33 +05:30
Claudio Sanches 29b8b0d60d
Merge pull request #27701 from woocommerce/fix/rest-api-package-tag
Fixed usage of package tag in REST API and templates
2020-09-17 18:45:14 -03:00
Christopher Allford a9ee9806a4 Implemented the factory & repository for simple products 2020-09-17 13:31:39 -07:00
Claudio Sanches 7fae819928 Fixed package tag 2020-09-17 14:34:36 -03:00
Christopher Allford 6c230ca7b3 Centralized the CRUD actions into a single kind of repository that can be easily used in every adapter case 2020-09-17 09:43:43 -07:00
Claudio Sanches 3377c60c5e
Merge pull request #27433 from woocommerce/fix/remove-relative-include-paths
Change relative include paths to absolute include paths
2020-09-17 13:15:40 -03:00
Claudio Sanches 70c7adfeb7 Fixed usage of package tag in REST API and templates 2020-09-17 11:56:08 -03:00
Claudio Sanches ed1a59b39b
Merge pull request #27416 from woocommerce/fix/27415
Fixed country list sorting
2020-09-17 10:35:43 -03:00
Christopher Allford 3a7c96b7cd Revised the base tsconfig to match Gutenberg more closely 2020-09-16 15:14:53 -07:00
Christopher Allford 011974ec09 Merge branch 'master' into packages/factories-to-api-refactor 2020-09-16 11:51:49 -07:00
Christopher Allford f5e130c190
Merge pull request #27667 from woocommerce/fix/standardize-nvm-usage
Standardize usage of NVM
2020-09-16 11:40:48 -07:00
Christopher Allford 38afb8c2ff Merge branch 'master' into packages/factories-to-api-refactor 2020-09-15 14:49:22 -07:00
Ron Rennick 87ea5dbffc add eslint, babel config functions 2020-09-15 14:08:19 -03:00
Ron Rennick 7c509d8ddb use tabs for indentation 2020-09-15 10:10:59 -03:00
Ron Rennick 0bf505ab12
Merge pull request #27645 from woocommerce/update/e2e-utils-for-package
prep e2e-utils package for publish
2020-09-14 14:40:19 -03:00
Christopher Allford a77a1cc77c Refreshed all lock files and removed "woocommerce" dependency from "e2e-environment" 2020-09-14 10:00:32 -07:00
Ron Rennick be8ba23801 merge master 2020-09-11 15:32:10 -03:00
Ron Rennick cd80e67717 merge master 2020-09-11 14:35:27 -03:00
Christopher Allford 2e7f1056e0 Replaced the environment dependency version resolution to use the Docker HTTP API
Since it's possible that the latest git tag isn't a Docker page we should get the latest version directly from Docker instead. This commit adds support for the `/v2/repositories/library/<image>/tags` endpoint and figures out the latest version from the response.
2020-09-10 14:26:44 -07:00
Christopher Allford 07bbf56ace Removed unnecessary `woocommerce` dependency from E2E package 2020-09-10 13:05:31 -07:00
Ron Rennick 238fe43a61 prep e2e-utils package for publish 2020-09-10 16:10:48 -03:00
Claudio Sanches b5d8d94bc8 Use reference in wc_asort_by_locale 2020-09-10 16:02:39 -03:00
Ron Rennick 0d3889a360
Merge pull request #27113 from woocommerce/add/e2e-feedback-blockers
Incorporate blocking issues feedback on initial e2e environment package
2020-09-10 15:56:09 -03:00
Ron Rennick 1c07d5ec5a restore looking up tags from git, add npm install to travis e2e script 2020-09-10 14:54:35 -03:00
jonathansadowski 2bcdbacc98
Merge pull request #27625 from woocommerce/revert-improved-filtering-for-variations
Revert improved filtering for variations
2020-09-10 12:42:15 -05:00
Ron Rennick bff1e799f4 use better test for creating ready page 2020-09-10 13:23:18 -03:00
Christopher Allford 14c46fa4c2 Merge branch 'master' into add/e2e-feedback-blockers 2020-09-09 14:47:51 -07:00
Christopher Allford d0e6110e93 Fixed a failing E2E test 2020-09-09 14:47:44 -07:00
Christopher Allford aabc8ccd6b Updated all of the package-lock files using Node v10 2020-09-09 14:47:35 -07:00
Ron Rennick 25cbfd2452 run grunt directly in travis e2e 2020-09-09 17:00:06 -03:00
Christopher Allford ae697f9fe2 Prevented zero from being considered empty when validating posted variation attributes 2020-09-09 11:29:31 -07:00
Christopher Allford 63e4dcf4a2 Created a transformer class to use in model repositories
Since models need to support both read & write transformations we can make dealing with this a bit easier in its own class now.
2020-09-09 10:00:30 -07:00
Nestor Soriano 70a1cb2f1f Revert improved filtering for variations.
This commit reverts the functionality introduced in PR #26260
(later refined by #27175, #27190, #27508) in which filtering by
attribute using the layered nav widget was improved to handle the
cases of variations out of stock. The revert is a response to the
numerous problems reported by users in Woo 4.4 and 4.5

Not all the code has been reverted, only the code that resulted in
visible functionality changes. Thus, the code that generates
term relationships for variations is still in place to keep database
consistency and to keep the reverting changes to the minimum needed.
2020-09-09 17:36:26 +02:00
jonathansadowski d00083f1ec
Merge pull request #27628 from woocommerce/fix/27624
Check for state and postcode fields only if required
2020-09-09 09:41:57 -05:00
vedanshujain 6a2ea0e27a Add unit test for show_shipping for different countries. 2020-09-09 19:53:21 +05:30
Ron Rennick 21e099d48f merge master 2020-09-09 11:17:20 -03:00
Claudio Sanches e0f08cc65a Use global phpcs 2020-09-08 16:53:13 -03:00
Claudio Sanches f748a71a8e Install globally 2020-09-08 15:56:06 -03:00
Claudio Sanches aa57d2f676 Update sniffs installation 2020-09-08 15:11:42 -03:00
jonathansadowski 168698cd91
Merge pull request #27589 from woocommerce/enhance-query-for-filtering-attributes-with-any-value
Enhance the query for "Any" variations in filter by attribute widget
2020-09-08 11:58:54 -05:00
Christopher Allford 39c5bc6b74 Refactored the factory to use a repository instead of an adapter so that we can expose more API functionality 2020-09-07 16:00:27 -07:00
Christopher Allford a875ecb083 Refactored the HTTP layer to be more API-agnostic
Since we're going to be adding more services and CRUD actions it makes sense for our HTTP services to be less tied to the specific REST API implementation.
2020-09-04 11:27:34 -07:00
Julia Amosova e224cd4b1b Update how disablement of the extensions download is handled in OBW test 2020-09-04 11:47:02 -04:00
Nestor Soriano 43642f7835 Enhance the query for "Any" variations in filter by attribute widget.
The new query fixes a bug where variations were being counted twice:
if a product was included in both the queries then it would be counted
differently and added; e.g. when a product had two variations,
one with "Any" attribute and other with a attribute that has a value.

The new query also optimizes performance, so that filter conditions
can be improved and better indexes can be used.
2020-09-04 11:29:50 +02:00
Julia Amosova 4ca4f37969 Update recommended business features checkbox selector in OBW test 2020-09-03 16:23:19 -04:00
Christopher Allford c75f0f8886 Renamed the `@woocommerce/factories` package to `@woocommerce/api`
With the plan now to add more CRUD actions the scope of the package has transformed into a more general API package than one just for factories.
2020-09-03 12:28:17 -07:00
Julia Amosova 552545c0ac Update number of industries in the loop from 10 to 9 2020-09-03 13:17:47 -04:00
jonathansadowski ecb25d7dc8
Merge pull request #27572 from woocommerce/update/bump-wc-admin-to-1.5.0-rc.4
Bump WooCommerce Admin to 1.5.0-rc.4; WooCommerce to 4.5.0-rc.3
2020-09-02 19:21:52 -05:00
Christopher Allford c898e1de03 Fixed failing E2E test 2020-09-02 16:14:25 -07:00
Christopher Allford f5771ebd0a Fixed failing E2E test 2020-09-02 16:13:20 -07:00
Christopher Allford b9d314e1ae Fixed another E2E test 2020-09-02 15:47:15 -07:00
Christopher Allford dde64b964f Updated lock files & fixed failing E2E test 2020-09-02 14:50:08 -07:00
Christopher Allford d3162b2f1d Updated package-lock.json files 2020-09-02 14:39:49 -07:00
Christopher Allford aee44c2935 Merge remote-tracking branch 'origin/master' into add/e2e-feedback-blockers 2020-09-02 12:47:40 -07:00
Christopher Allford 16cf8c81be Revised the default environment variables to pull the version from the latest docker image 2020-09-02 12:47:27 -07:00
jonathansadowski 53c22ba4e4
Merge pull request #27508 from woocommerce/fix/27419
Fix filter by attribute widget now working for "Any..." attributes
2020-09-02 13:32:54 -05:00
Shiki d6600d8338 Version3/orders.php: Re-add assertion for `meta_data` 2020-09-01 14:29:38 -06:00
Shiki 5651befdd9 Version3/orders.php: Remove assertion for `meta_data`
The new meta_data output will include keys like `display_key` and
`display_value`. The assertion will be re-added in a later commit.
2020-09-01 14:22:38 -06:00
Shiki 64bd1e0fd5 Fix formatting errors in orders.php 2020-09-01 14:21:14 -06:00
Nestor Soriano 07b62dabbd Improve the query to retrieve "Any..."-attributed variations in filtering widget
The new query doesn't need empty attribute entries in the meta table,
therefore the code that generates them and the migration to backfill
the missing existing ones have been removed.
2020-09-01 16:47:41 +02:00
Nestor Soriano 3a583feab1 Change filter by attributes widget to count products, not variations.
Right now the filter by attributes widget counts available variations
(for variation products). This is confusing since the counter shows
numbers that are higher than the actual count of products displayed.

This commit changes the query used by the widget so that instead
of counting variations it returns the parent product ids, and then
counts the distinct values. This also covers the case of products
where some of the variations have concrete values and some have
"Any..." values.
2020-08-31 12:22:33 +02:00
Ron Rennick 0b85ee58f8 update package-lock.json 2020-08-28 11:06:25 -03:00
Ron Rennick 17ee223e71 update package-lock.json 2020-08-28 11:03:28 -03:00
Ron Rennick 8fe3bcb90e rebase to current master 2020-08-28 10:59:43 -03:00
Claudio Sanches 085b4b53fa
Merge pull request #27487 from woocommerce/update/choice-of-words
Improve choice of words
2020-08-27 19:30:54 -03:00
Nestor Soriano 1113201f8b Update meta 'attribute_' values when variation attributes are added or removed.
When a new variation attribute is added, the corresponding 'attribute_'
meta entries are added for all variations with an empty value;
and when an existing variation attribute is removed, the existing
'attribute_' meta entries are deleted for all variations.

This is necessary for the filter by attribute widget to work properly
when variations exist with a value of "Any..." for attributes.
2020-08-27 16:10:41 +02:00
Nestor Soriano a75da34a45 Fix filter by attribute widget now working for "Any..." attributes
When a variation product has an attribute with a value of "Any...",
and there's a filter by attribute widget for that attribute, then
that product won't be included in the counts displayed in the widget
(and if the count ends up being zero, the attribute won't be shown
in the widget).

This happens before since Woo 4.4, this widget works by looking at
entries in the term relationships table for varitions too
(used to do so for simple products and for "main" variable products
only), see PR #26260; but there are no such entries for
"Any..." attributes.

This commit fixes that by extending the SQL query used by the widget
to look for variations that have empty attribute values in the meta
table too.
2020-08-27 10:59:15 +02:00
Claudio Sanches c4ccc38780 Fixed use __DIR__ for relative paths 2020-08-26 18:46:44 -03:00
Shiki ecb2936f9e Use different terms to avoid clash with the similar V2 test
I suppose I could have deleted the attribute and term first but I think
this is better and shorter. Maybe.
2020-08-26 23:51:36 +05:30
Shiki face3fe27e OrdersV2: Add test for line items meta_data
This currently fails because it's not implemented yet.
2020-08-26 23:51:36 +05:30
Shiki ad00eb3a98 Add line items meta_data schema test for Orders V2 and V3
This currently fails because the expected meta_data properties are only
available in V3.
2020-08-26 23:51:36 +05:30
Shiki 2a01aa968f WC_Tests_API_Orders: Add test data for site-level attributes 2020-08-26 23:51:36 +05:30
Shiki dc2a4d1ccc WC_Tests_API_Orders: Rearrange order variable for clarity 2020-08-26 23:51:36 +05:30
Shiki 00a5c3101e WC_Tests_API_Orders: Rename first_meta_data to size_* 2020-08-26 23:51:36 +05:30
Shiki d681a8c7a4 Add unit test for an Order's line item meta data. 2020-08-26 23:51:36 +05:30
Claudio Sanches 5240682f38 Improve choice of words 2020-08-25 18:03:03 -03:00
Claudio Sanches a133e56ebd Fixed unit tests 2020-08-25 16:13:49 -03:00
Ron Rennick 81dae70033 phpcs fixes 2020-08-25 15:41:31 -03:00
Ron Rennick de79f1a3cd update unit tests for included Paypal gate name change 2020-08-25 15:36:50 -03:00
Ron Rennick 074b2b86c6 update package-lock.json 2020-08-21 13:39:33 -03:00
Ron Rennick 7a14368982 add small tweaks/checks for edge cases 2020-08-21 13:25:30 -03:00
Tam Mullen b41bd5139d Updating e2e test for OBW changes 2020-08-21 16:03:02 +01:00
Ron Rennick 51afe3207a
Merge pull request #27023 from HikeMike/add/hidden-form-field
"Hidden" field type added to woocommerce_form_field() #26468
2020-08-20 11:48:26 -03:00
Claudio Sanches 47aaac8600 Introduced wc_asort_by_locale() function 2020-08-19 20:22:18 -03:00
Claudio Sanches b5221ab479 Added unit tests for changes in wc_ascii_uasort_comparison 2020-08-19 19:00:18 -03:00
Claudio Sanches 98d5f52de2 Merge branch 'master' into add/woorelease-support 2020-08-19 12:10:15 -03:00
Ron Rennick dfdf4e9d18 update e2e config parsing to support no port 2020-08-19 09:57:14 -03:00
Christopher Allford 358db5dc3e Removed the internals of the Container pending package conflict resolution
Since reverting the PR at this point would be a mess I've gone ahead and removed the internals of the container. We should aim to keep the class since it's now part of our public API but it won't work as expected anymore. This is fine for now since we don't actually have anything in it!
2020-08-18 20:39:48 -07:00
Claudio Sanches 9773675b8d Merge branch 'master' into add/woorelease-support 2020-08-18 17:59:47 -03:00
Claudio Sanches e102ec3d83 Merge branch 'master' into fix/25133 2020-08-17 14:59:49 -03:00
Néstor Soriano f1ed7005f9
Merge pull request #26232 from woocommerce/update/e2e-test-utils
Update/e2e test utils
2020-08-17 15:26:13 +02:00
Claudio Sanches bb0c4406de
Merge pull request #27314 from woocommerce/add/unit-tests-27108
Added unit tests for #27244
2020-08-14 15:32:02 -03:00
Ron Rennick 45391c4b18 update unit test for account page being automatically created 2020-08-14 10:36:16 -03:00
Ron Rennick f0ad8a01be merge current master 2020-08-13 14:33:07 -03:00
Vedanshu Jain a887cd7369
Merge pull request #27318 from woocommerce/fix/27282
Change data-type from mixed to composite and date-time to string on the fly for REST API
2020-08-13 21:25:11 +05:30
vedanshujain 7fa6510c1a Add a explicit test for null as well 2020-08-13 16:52:16 +05:30
vedanshujain dd9b9cfae2 Add test for update in date-time field 2020-08-13 16:32:00 +05:30
vedanshujain 4294e06f7a Add test for variation v2 controller for complex meta object 2020-08-13 15:46:31 +05:30
vedanshujain 9f680aa120 Add test for null meta value as well 2020-08-13 14:17:28 +05:30
vedanshujain 826fdde721 Add unit tests for checking that updating complex meta is possible 2020-08-13 13:27:00 +05:30
Néstor Soriano 4c636b1d5c
Merge pull request #27303 from woocommerce/fix/travis-coding-standards-test
Fix coding standards test on Travis
2020-08-13 09:19:13 +02:00
Claudio Sanches 1839feae91 Added unit tests for #27244 2020-08-12 18:50:25 -03:00
Christopher Allford 7340c9af44
Merge pull request #27171 from woocommerce/fix/25543
Added the parent's SKU to product searches for variations
2020-08-12 12:58:00 -07:00
Claudio Sanches 1699b34295 Use npm run build:core 2020-08-12 16:53:06 -03:00
Christopher Allford 7071c6dc0c
Merge pull request #27228 from woocommerce/feature/container-injection-change
Dependency Injection should use method injection instead of constructor injection
2020-08-12 12:41:48 -07:00
Claudio Sanches 521ad8c3ff Update all dependencies of woocommerce-sniffs 2020-08-11 20:42:42 -03:00
Claudio Sanches 7fdf209713 Check if PHPCS is installed before trying to install a new copy 2020-08-11 20:08:28 -03:00
Claudio Sanches 29bc98816e
Merge pull request #27143 from woocommerce/fix/26876
Fix "Hide shipping costs until an address is entered"
2020-08-11 20:06:17 -03:00
Ron Rennick 4ba2e0267f remove unused local test-e2e.json 2020-08-11 09:53:34 -03:00
Tam Mullen 9ad9ff2df8 Fixing import path 2020-08-11 12:26:53 +01:00
Tam Mullen c8365213c3 Fixing import path. 2020-08-11 00:34:57 +01:00
Tam Mullen ed525087ac Addressing comments. 2020-08-10 21:27:20 +01:00
Tam Mullen b2262f1cf7 Updating exports for completeOnboardingWizard function. 2020-08-10 21:26:11 +01:00
Tam Mullen 2bc918d353 Updating e2e-utils formatting. 2020-08-10 21:26:10 +01:00
Tam Mullen cdaefa332e Updating e2e-utils formatting. 2020-08-10 21:26:10 +01:00
Tam Mullen 4544190462 Updating e2e-utils dependencies. 2020-08-10 21:26:10 +01:00
Tam Mullen ead4b93a7d Adding e2e-utils README 2020-08-10 21:26:10 +01:00
Tam Mullen da1916c663 Updating product test dependencies 2020-08-10 21:26:10 +01:00
Tam Mullen 43c55e2c6a Converting e2e-utils to package. 2020-08-10 21:26:10 +01:00
Ron Rennick 0b0595ab4c
Merge pull request #27048 from vallter2/postcode-bih
Add postcode validation for Bosnia and Herzegovina
2020-08-10 16:24:06 -03:00
Ron Rennick c14ce54752 fix e2e docker:ssh command to work in any repo 2020-08-10 14:54:10 -03:00
Christopher Allford 116e11565a
Merge pull request #27262 from woocommerce/fix/unit-tests-coding-standards
Fixed packages required to run code sniffer on unit tests
2020-08-10 06:57:05 -07:00
Christopher Allford 12397aec0e Added `_with` suffix to `StringUtil` methods for clarity 2020-08-07 16:45:35 -07:00
Christopher Allford 13a3b80cb6 Removed classes accidentally added back by merge from master 2020-08-07 16:45:09 -07:00
Christopher Allford eb65252ba8 Merge branch 'master' into feature/container-injection-change 2020-08-07 14:35:44 -07:00
Christopher Allford 081f0d9133 Settled on an injection method of `init`
1. Since our code style dictates that these be `final` methods, we shouldn't be concerned about overlap.
2. There is precedent for `init` methods as requirements before using class instances.
2020-08-07 14:28:29 -07:00
Claudio Sanches 02cf0dfaed
Merge pull request #27239 from woocommerce/fix/package-tag
Fix usage of "package" tag in file headers
2020-08-07 13:37:24 -03:00
Claudio Sanches 17f9883f00 Changed | to \ 2020-08-07 13:36:41 -03:00
Claudio Sanches 48732ee0dd Fixed package tag 2020-08-07 13:35:15 -03:00
Claudio Sanches 3fd42a0fd5 Fixed packages required to run code sniffer on unit tests 2020-08-07 13:28:41 -03:00
Ron Rennick 6aa52c8499 remove duplicate readme text 2020-08-07 13:04:36 -03:00
Ron Rennick db76c8ac2d merge package config with factories changes 2020-08-07 10:53:51 -03:00
Néstor Soriano 76cf1e4e93
Merge pull request #27140 from woocommerce/fix/23790
Always sanitize coupon code to prevent inconsistent between admins and shop owners
2020-08-07 12:42:02 +02:00
Néstor Soriano a13a0d2187
Merge pull request #27179 from woocommerce/fix/26741
Release coupon holds when status it updated to cancelled regardless of recorded coupons
2020-08-07 11:27:45 +02:00
Christopher Allford 154c812fc0 Renamed the `StringUtility` to `StringUtil` to make it easier to work with 2020-08-06 12:35:51 -07:00
Claudio Sanches 9eae43c0d4
Merge pull request #27240 from woocommerce/dependabot/npm_and_yarn/tests/e2e/factories/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19 in /tests/e2e/factories
2020-08-06 15:50:26 -03:00
vedanshujain 2f76e52fa7 Skip test for < 5.3 as feature is not supported. 2020-08-06 14:34:02 +05:30
vedanshujain 55a9687e6d Make api included structure more linear. 2020-08-06 14:34:02 +05:30
vedanshujain cfe357cfb2 Fix UT to add predefined values to run tests in isolation. 2020-08-06 14:34:02 +05:30
vedanshujain 222852dea6 Merge branch 'master' of https://github.com/woocommerce/woocommerce 2020-08-06 14:06:29 +05:30
Christopher Allford 39376abfd2 Added a requirement that `container_init` methods be marked `final` when registering using reflection 2020-08-05 22:34:00 -07:00
Christopher Allford ff6e30f1c1 Renamed `set_internal_dependencies` to `container_init` 2020-08-05 22:20:13 -07:00
Christopher Allford cbbfed4989 Replaced the rest of the constructor injection references 2020-08-05 21:28:06 -07:00
dependabot[bot] 089df498d3
Bump lodash from 4.17.15 to 4.17.19 in /tests/e2e/factories
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-05 23:04:18 +00:00
Christopher Allford 8e8698a3f6 Fixed test that used PHPUnit function from newer version 2020-08-05 15:43:08 -07:00
Christopher Allford 678705cdd4 Merge branch 'master' into package/e2e-factories/product 2020-08-05 14:00:05 -07:00
Ron Rennick 0ca4ce27c5 update e2e readmes 2020-08-05 16:58:38 -03:00
Ron Rennick 7f04d800e9 keep browser reset at end of setup 2020-08-05 15:01:43 -03:00
Claudio Sanches 3632714885 Removed package tag from src 2020-08-05 14:23:50 -03:00
Claudio Sanches a50552af75 Use only WooCommerce as package name 2020-08-05 14:11:20 -03:00
Claudio Sanches d48f1d4e2e Fixed package tag usage 2020-08-05 13:36:24 -03:00
Ron Rennick 7799c1bcf0 merge master 2020-08-05 10:33:16 -03:00
Tam Mullen 5a410c02a6 Fix e2e OBW test to not untick physical products in product type list 2020-08-05 12:49:42 +01:00
Christopher Allford d178c7ff01 Replaced constructor injection with method injection
Since we need to maintain backwards compatibility for class constructors we should settle on using method injection instead of constructor injection. I've replaced the `Definition` class we're using with one that doesn't support constructor arguments and added a check for auto_arg addition. Note that we don't check for method existence in the extended container. This is because reflection is unnecessarily expensive and we should avoid it if at all possible.
2020-08-04 20:37:28 -07:00
Ron Rennick 52d67cead1 move trash posts/products from sequencer to local config 2020-08-04 19:55:13 -03:00
Ron Rennick 14c9154fcb use consistent MySQL configuration values 2020-08-04 16:17:00 -03:00
vedanshujain 1ada7d8b26 Merge branch 'master' of https://github.com/woocommerce/woocommerce 2020-08-04 18:22:41 +05:30
Nestor Soriano 200599f8e0 Add unit tests for the type of the value returned by 'get_available_variations' 2020-08-03 16:30:54 +02:00
Nestor Soriano 71fccd6a07 Fix: pagination controls not displaying in products list.
This bug was introduced in #26260. The sequence is:

1. WC_Query::adjust_posts_count runs, to handle found_posts filter,
   this indirectly executes wc_setup_loop.
2. At this point $GLOBALS['wp_query']->max_num_pages hasn't been set
   yet, and has a value of 0. Thus the loop variable total_pages
   is set to 0.
3. Later wc_setup_loop runs again and this time
   $GLOBALS['wp_query']->max_num_pages is already set, but since
   the loop variable total_pages already exists, it keeps its
   value of 0.
4. The pagination controls never show if total_pages is less than 2.

The fix consists of hooking into the_posts to set the value of
total_pages again, at that point $GLOBALS['wp_query']->max_num_pages
is already set.
2020-07-31 16:40:25 +02:00
Claudio Sanches 825d57dd41 Merge branch 'master' into fix/23790 2020-07-30 17:33:50 -03:00
Claudio Sanches 48974f29f1 Fixed unit tests for WC_Notes_Run_Db_Update 2020-07-30 17:00:11 -03:00
Claudio Sanches 1cd84d6446 Merge branch 'master' into fix/23790 2020-07-30 16:46:01 -03:00
Claudio Sanches 608fc8620d
Merge pull request #27172 from woocommerce/fix/27168
Let user stay in the same page after clicking to update WooCommerce
2020-07-30 15:48:27 -03:00
Jonathan Sadowski 163e10253a Release coupon holds when status it updated to cancelled regardless of recorded coupons 2020-07-30 10:35:23 -05:00
Néstor Soriano e44154bf6e
Update tests/legacy/unit-tests/util/class-wc-tests-wc-query.php
Fix small coding standards issue.

Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-07-30 16:17:05 +02:00
vedanshujain 3a63d75e0f Merge branch 'master' of https://github.com/woocommerce/woocommerce 2020-07-30 17:55:11 +05:30
Nestor Soriano 86c88f1750 Fix: incorrect adjustment of post count in WC_Query.
PR #26260 introduced a handler for 'found_posts' filter in WC_Query
class in order to adjust the count depending on the visibility
of variation products. However the handler incorrectly assumed
that the filter was triggered only when listing products, when
actually it's also triggered for any post type e.g. pages.
In these cases the post count was set to zero, which caused bugs.

Now the handler starts with the originally supplied posts count,
and only decrements it when a post is a product AND is not visible.
2020-07-30 09:32:28 +02:00
Claudio Sanches 3c1132e274 Added unit tests for wc_get_current_admin_url() 2020-07-29 21:02:52 -03:00
Christopher Allford 78bff3b2da Added the parent's SKU to product searches for variations
Since the parent's SKU is used when the variation does not have one, we should fall back when searching for consistency.
2020-07-29 16:53:36 -07:00
Ron Rennick ba942aa32f expose getAppRoot, getTestConfig in package 2020-07-29 20:03:29 -03:00
Ron Rennick 09a594443d restore non-dev puppeteer config, move test config to sequencer 2020-07-29 18:57:59 -03:00
Ron Rennick d4620b5351 merge master 2020-07-29 15:25:11 -03:00
Ron Rennick 1e365733b4 add local puppeteer config support 2020-07-29 15:13:22 -03:00
Néstor Soriano 0f134ca6a2
Merge pull request #27054 from woocommerce/fix/27036
add/update correct deprecated notices on existing deprecations
2020-07-29 15:20:24 +02:00
Ron Rennick d9e9faaa44 use @automattic/puppeteer-utils 2020-07-28 16:29:19 -03:00
Claudio Sanches 119b5d6568
Merge branch 'master' into fix/23790 2020-07-28 13:07:17 -03:00
Ron Rennick e78beaf569 move jest/puppeteer related packages to environment package 2020-07-28 12:00:46 -03:00
Nestor Soriano 681401850a Adjustments in the items count calculation on the nav filtering widget.
The calculations are now consistent with the change made to the
visibility of the variable products when using one or multiple filters.
2020-07-28 09:01:55 +02:00
Nestor Soriano 29843b9396 Change in the logic of is_visible_core for variable products
Now, if there are filters present the logic is as follows:

- For multiple filtering values of the same attribute:
  the product is visible if there's at least one variation
  that has one of the filtering values associated to the attribute,
  or if there's at least one variation having the attribute
  with a value of "Any".

- For filtering by more than one attribute:
  the product is visible if there's at least one variation that
  is visible for ALL the attributes according to the above rule.

Note that this is irrespective of the type of logic configured for
the filter (OR or AND).
2020-07-28 09:01:52 +02:00
Nestor Soriano 3fefe84a51 Fix: WC_Query()::adjust_posts_count failing when posts list is null. 2020-07-28 08:55:55 +02:00
Nestor Soriano 9142e27a19 Adjustments in WC_Query::adjust_posts_count
Two adjustments were needed:

- Adjust the count even when there's no nav filtering in the query.
  This is necessary to present the proper products count.
  even when the woocommerce_product_is_visible filter is used.
- Account for the case where $GLOBALS['wp_query']->posts
  returns objects instead of ids (for example when viewing
  a product page).
2020-07-28 08:55:55 +02:00
Nestor Soriano 9de1306c21 Fix counters in nav filtering widgets for variable products.
After the change that registers variation attributes as terms
(in addition to reigstering them as post meta) it is now time
to modify the get_filtered_term_product_counts methods in
WC_Widget_Layered_Nav so that it works consistently for both
variable and non-variable products. The logic for the counters
is now as follows:

with OR operator:
- Simple products: count the attributes of all visible products
  (unchanged behavior).
- Variable products: count attributes corresponding to
  visible variations.

with AND operator:
- Simple products: count the attributes of visible products but only
  for products that have all the selected (unchanged behavior).
- Variable products: find all the products for which all the variations
  corresponding to the selected attributes exist and are visible,
  then count the attributes corresponding to the visible variations
  of those products.

A product is "visible" if it's published, not excluded for catalog,
and has stock. Additionally, a variable product will not be considered
visible if the parent product is not.
2020-07-28 08:55:55 +02:00
Nestor Soriano 9c6c0d73d8 Record attribute terms for product variations in wp_term_relationships.
Product attributes are currently recorded as terms in
wp_term_relationships (product attributes are actually taxonomies).
In the case of variable products this is true for the main product,
but not for the variations. The attributes used to define variations
are stored as post meta, but nothing is recorded in the term
relationships table.

This is a problem when using the layered nav filtering plugin,
since the attribute counters displayed are calculated based solely
on the contents of the term relationships table. Adding meta queries
would be really messy (especially when the widget is configured
with AND operator) and would probably also hurt performance.

This commit adds a change to store the attributes for variations
as term relationships, additionally to storing them as post meta.
Terms are stored on variation creation, and updated/deleted together
with the variation as appropriate. "Any" variations (stored in meta
as empty values) are not stored as terms.

Additionally, a database upgrade is included in order to backfill
terms for already existing products.
2020-07-28 08:55:55 +02:00
Nestor Soriano e1265bfa25 Refactor WC_Helper_Product by extracting duplicated code to methods.
The new methods are create_product_variation_object and
create_product_attribute_object, they are public.
2020-07-28 08:55:55 +02:00
Nestor Soriano 50e8f27bc7 Fix visibility of variable products with layered nav filtering.
The layered nav filtering doesn't work well with variable products
when some variations have stock and other don't. When a term is
selected in the widget, a variable product having no stock for
the variation corresponding to that term but having stock for
other variations will be displayed, but it shouldn't.

This commit fixes that by introducing two changes:

- A new override of "is_visible" for WC_Product_Variable that
  looks at the supplied filters, compares them against the corresponding
  available variations and calculates the visibility based on
  the query type (OR or AND).

- A hook on the "found_posts" filter in WC_Query, that adjusts
  the posts count based on the found products visibility
  when there are filters available; this is needed to sync the
  "displaying X posts" messages and the paging when variable
  products are hidden due to stock status.

Additionally, the visibility calculated in "found_posts" is cached
as loop variables so that it isn't calculated again when actually
displaying the products.
2020-07-28 08:55:52 +02:00
Nestor Soriano c27283dffe Fix code sniffer errors in some files.
Fixed files:

includes/abstracts/abstract-wc-product.php
includes/class-wc-query.php
includes/wc-template-functions.php
includes/widgets/class-wc-widget-layered-nav.php
templates/loop/result-count.php
tests/unit-tests/util/class-wc-tests-wc-query.php
2020-07-28 08:47:29 +02:00
Christopher Allford 578b205b4e
Merge pull request #27123 from woocommerce/feature/jetpack-autoloader-upgrade
Upgraded Jetpack Autoloader to 2.0
2020-07-27 23:35:53 -07:00
Claudio Sanches de383971eb Reset all after test 2020-07-27 22:07:46 -03:00
Claudio Sanches 2043954ceb
Fixed class name 2020-07-27 21:53:28 -03:00
Claudio Sanches 0f091406df Test WC_Cart::show_shipping() 2020-07-27 21:52:33 -03:00
Christopher Allford 1868cd8aaa Adjusting the shipping task order in the E2E test for setup tasks 2020-07-27 15:18:27 -07:00
Christopher Allford edf1932ee9 Adjusted the OBW test for changes in WC-Admin 1.4.0 2020-07-27 14:38:43 -07:00
Claudio Sanches 4048d19a39 Added unit tests for coupon code sanitization 2020-07-27 17:44:04 -03:00
Christopher Allford ddc1f87f8d
Update README.md
Changed `npm install` suggestion to better suggest saving the dependencies as devDependencies
2020-07-27 13:30:39 -07:00
Matt Harrison e696ac7824
Queue all webhooks on shutdown.
It is possible for a later duplicate webhook to be fired too early if
the same webhook triggers in one request more than once with the updated
changes from the second one missing if it happens too quickly.
This queues all webhook to be register on shutdown instead of just
syncronous ones to make sure all data from the request is updated first
before the webhook gets queued.
2020-07-27 12:11:40 -04:00
Nestor Soriano cc118c0c10 Fixed the number of product types in the onboarding E2E test 2020-07-27 16:49:32 +02:00
Christopher Allford 4123d048e0 Fixed the number of industries in the onboarding E2E test 2020-07-27 07:08:54 -07:00
Claudio Sanches 7bd34e3545
Merge branch 'master' into fix/25843 2020-07-24 17:04:28 -03:00
Ron Rennick aca91f587d update version script to work in both desktop and Travis, add fallback versions 2020-07-24 17:02:33 -03:00
Claudio Sanches 419e5c239a
Fixed docblocks 2020-07-24 17:01:42 -03:00
Ron Rennick 96d73d2300
Merge pull request #27090 from woocommerce/update/wp-jest-preset-version
Update E2E env jest preset default version.
2020-07-24 14:39:55 -03:00
Ron Rennick 06e3ae9939 fix software version checks in Travis 2020-07-24 10:57:16 -03:00
vedanshujain f90699ddb9 Add more assertions in tests for order totals. 2020-07-24 19:12:25 +05:30
vedanshujain 0e7b064c02 Add more assertions in tests for round at subtotal. 2020-07-24 19:12:25 +05:30
vedanshujain 3aed8f1c85 Remove incorrect comments. 2020-07-24 19:09:59 +05:30
vedanshujain 7735eed314 Add unit tests and helpers for #26654 2020-07-24 19:09:59 +05:30
Néstor Soriano 8c2412ea7d
Merge pull request #26731 from woocommerce/feature/introduce-dependency-injection
Introduce a dependency injection framework
2020-07-24 15:12:16 +02:00
Ron Rennick eaafc88d33 add port configuration support 2020-07-24 10:12:07 -03:00
Nestor Soriano c2e28b2b05 Replace array_merge_recursive in MockableLegacyProxy with custom code
test_static_mocks_can_be_used_via_injected_legacy_proxy_and_woocommerce_object
was failing in PHP 7.0, this replacement fixes it.
Suspected cause: https://bugs.php.net/bug.php?id=76505
2020-07-24 14:51:37 +02:00
Peter Fabian 03230ecf01
Merge pull request #26642 from woocommerce/fix/26607
Limit stock changes for order items to status methods for consistency.
2020-07-24 13:23:53 +02:00
Nestor Soriano e55ef052a2 Add documentation about the container and good coding practices.
- src/README.md largely expanded
- tests/README.md expanded
- includes/README.md added
- src/Internal/REAMDE.md added

src/README.md and includes/README.md have TODO placeholders to add
guidelines regarding to actions and filters.
2020-07-24 09:25:12 +02:00
Christopher Allford 811ac747e6 Added callable reflection to `add_with_auto_arguments`
This allows the dependencies of the callable function to be automatically resolved out of the container too!
2020-07-24 09:25:12 +02:00
Nestor Soriano 408295720c Fix LegacyProxy::get_instance_of for classesd having an `instance` method.
Pass the arguments as `...$args` instead of `$args`.
Also fix related unit test, and remove unnecessary `is_function`.
2020-07-24 09:25:12 +02:00
Nestor Soriano bd1e6a5db0 Add the ContainerException class, use it for dependency injection related errors. 2020-07-24 09:25:12 +02:00
Nestor Soriano 65b5cbe692 Improve AbstractServiceProvider::add_with_auto_arguments
If a class name is passed as a concrete, check that the class
constructor is public if it exists. If another type of concrete is
passed, check that it's valid (a callback or an object).

Also update the autoloader to check if the class file exists,
otherwise class_exists fails if a namespaced class doesn't exist.
2020-07-24 09:25:11 +02:00
Nestor Soriano 6fd84a0401 Add shortcut methods for the LegacyProxy in the WooCommerce class.
The following methods are added and can be invoked using `WC()`,
they just redirect to the same methods in LegacyProxy:

call_function
call_static
get_instance_of
2020-07-24 09:25:11 +02:00
Nestor Soriano abf53086ca Remove @throws annotation from some unit tests. 2020-07-24 09:25:11 +02:00
Christopher Allford 53e1f23af5 Moved autoloading of `Automattic\WooCommerce\Testing\Tools` namespace into test bootstrap
Since we need to load all of these files before WooCommerce has initialized we can't rely on Composer to handle the autoloading. We should take this namespace out of Composer altogether and just have our test autoloader take care of it.
2020-07-24 09:25:09 +02:00
Nestor Soriano 29cf161415 Small changes after review feedback:
- Method and class renames.
- Removed unnecessary autoloader registration.
- Add a unit test for classes with non-object type hints
  in constructor arguments.
2020-07-24 09:24:06 +02:00
Nestor Soriano 1684ce08b3 Removed annotations as we're not going to use them. 2020-07-24 09:24:06 +02:00
Nestor Soriano 4ec143532c Adjustments in the LegacyProxy class.
- `get_instance_of` accepts now arguments to be passed to the
  class constructor if necessary.
- `get_special_instance_of` method removed, instead, now if a method
  named `get_instance_of_<lowercased class name>` exists in the class,
  it is used to get the instance of the class.
- A couple more unit tests added.
2020-07-24 09:24:06 +02:00
Nestor Soriano 282d1dab86 DependencyManagement code folder moved inside an Internal folder. 2020-07-24 09:24:06 +02:00
Nestor Soriano c1ed403dd0 Add `@public` to `FunctionsMockerHack`.
Also to a couple of methods related to the code hacker.
2020-07-24 09:24:06 +02:00
Nestor Soriano 044a79d941 Added unit tests for `LegacyProxy` and `MockableLegacyProxy`.
Also:

- Added sutoloader for the `tests/tools` directory.
2020-07-24 09:24:04 +02:00
Nestor Soriano c9154d071c Add tests for `AbstractServiceProvider` and `ExtendedContainer`.
Also:

- Make the methods in `AbstractServiceProvider` protected.
- Add an autoloader for files in the `tests/php/src` directory.
- Fix a bug in the provisional (?) autoloader.
2020-07-24 09:23:05 +02:00
Nestor Soriano d55f7d10f8 Some small imrpovements in the dependency injection framework:
- camelCase methods changed to snake_case for consistency with WP.
- Added a check in `ExtendedContainer::get` that throws an informative
  exception if a non-namespaced class name is passed.
- `container->reset_resolved()` is called during unit testing bootstrap.
- Added some utility methods in `WC_Unit_Test_Case`.
2020-07-24 09:23:05 +02:00
Nestor Soriano ca9ed93b9a Added dependency injection infrastructure for unit tests:
- Added a new class `ExtendedContainer` that extends League's container.
  - `add` modified to reject classes not in the root Woo namespace.
  - Has two new methods, `replace` and `reset_resolved`.
  - It's used as the underlying container instead of League's one
    in `Container`, but the new methods are not exposed.
- At unit test bootstrap time the globally registered container is
  replaced with the extended one that `Container` stores
  (grabbed from private property using reflection).
- A new `MockableLegacyProxy` is added. It inherits from `LegacyProxy`
  and allows to mock functions, static methods and legacy classes.
  - The registeed `LegacyProxy` is replaced with the mockable version
    during unit test bootstrap.
- A PHPUnit hook is added to reset the mockable proxy to its initial
  state (so that nothing is mocked) before each test.
- `WC_Unit_Test_Case` gets helper methods to mock functions, static
  methods and classes without having to retrieve the proxy class.
2020-07-24 09:23:05 +02:00
Claudio Sanches 64f4fb85e2 Move variation validation logic to add to cart 2020-07-23 19:10:42 -03:00
Ron Rennick 4cffb9b95c eliminate project root docker-compose.yaml 2020-07-23 15:38:40 -03:00
Ron Rennick 28b537662a add PHP, MariaDB, WP env var version support 2020-07-23 14:30:24 -03:00
Tam Mullen 86da271e6e
Merge pull request #27063 from woocommerce/fix/e2e-obw-4.3
Fix OBW e2e test in WC 4.3: Scroll Home Screen tasks list into view for the `Set up shipping` click to work
2020-07-23 15:48:18 +01:00
vedanshujain 5a784bc1e4 Keep only unit test files for merge into core. 2020-07-23 00:07:29 +05:30
vedanshujain e42b97e7ea Add 'tests/legacy/unit-tests/api/' from commit '5335083922d350e73eaf0e8370d8335e1b076b55'
git-subtree-dir: tests/legacy/unit-tests/api
git-subtree-mainline: 2d39467fb4
git-subtree-split: 5335083922
2020-07-22 23:56:29 +05:30
Jeff Stieler 76e42fec98 Update E2E env jest preset default version.
6.x.x will update the weak ref detection dependencies.
2020-07-21 13:51:16 -04:00
Christopher Allford 840554d788
Merge pull request #27017 from woocommerce/fix/25480
Fixed the `shipping_zone_method` CLI command's instance_id parameter
2020-07-20 11:00:08 -07:00
Christopher Allford 636327c110
Merge pull request #27043 from woocommerce/fix/unit-test-suite
Test Suite & Namespace PHPCS Changes
2020-07-20 08:40:00 -07:00
Mike Dent 541f68363e Test code updated, with thanks to @ObliviousHarmony 2020-07-20 15:45:13 +01:00
Ron Rennick d3ab19b7cf eliminate internal use of deprecated functions
- remove deprecation of offsetGet as it is used throught abstract order
- eliminate use of offsetGet in unit tests, structured data, order functions
-
2020-07-17 17:14:26 -03:00
Julia Amosova 10bfb679eb Scroll home screen tasks list into view for the click to work 2020-07-17 12:44:46 -04:00
Claudio Sanches 86311a9903
Merge pull request #27046 from woocommerce/fix/26860
[Importer/Exporter] Fixed the value display of "Published" for children of draft variable products
2020-07-16 13:15:31 -03:00
Ron Rennick dbf3e99292
Merge pull request #26964 from woocommerce/fix/24604
add rating count to order by rating clause
2020-07-16 10:51:20 -03:00
Damir Ha 161eb4a320 Add test postcode validation for Bosnia and Herzegovina 2020-07-16 13:57:44 +02:00
Néstor Soriano 24bd19c517
Merge pull request #27038 from woocommerce/add/26192
Add existing meta keys to woocommerce_duplicate_product_exclude_meta filter
2020-07-16 11:02:09 +02:00
Claudio Sanches 156b061602 Added unit tests for importer and exporter 2020-07-15 21:49:26 -03:00
Christopher Allford b71ddd35f1 Added sniffs to enforce PSR-4 in the `src` and `tests/php/src` directories 2020-07-15 16:09:00 -07:00
Christopher Allford f72b8db576 Added some exceptions to the PHPCS standards for unit tests
The file comments and @throws tags are unnecessary in unit tests.
2020-07-15 14:29:13 -07:00
Christopher Allford 55385f6cec Moved the orphaned unit test into the correct directory 2020-07-15 14:21:34 -07:00
Christopher Allford 13536bef5b Corrected the WCInstallTest filename
It is in the `includes` test section and should have the same filename as the corresponding class.
2020-07-15 14:20:26 -07:00
Christopher Allford fdee8dceaf Moved test to correct directory 2020-07-15 07:08:09 -07:00
vedanshujain aabf4bfe37 Add unit tests. 2020-07-15 15:27:34 +05:30
Christopher Allford c9f754f5a3 Added the existing meta keys to the `woocommerce_duplicate_product_exclude_meta` filter 2020-07-14 13:57:21 -07:00
vedanshujain af401a7d80 Add unit test 2020-07-14 23:32:12 +05:30
Nestor Soriano fc0be07e0f Add unit test for WC_Admin_Post_Types::bulk_and_quick_edit_save_post.
The test added checks that the new regular or sale price is
appropriately set when bulk saving.
2020-07-14 11:42:21 +02:00
Nestor Soriano 320fa38c51 Improve WC_Helper_Product::create_simple_product.
Add a new optional $props parameter containing the properties
to be set in the newly created product.
2020-07-14 11:42:21 +02:00
Nestor Soriano 4531af3382 Small fix in WC_Tests_Admin_Post_Types::bulk_and_quick_edit_stock_status_for_variable_product.
At some point the 'change_stock' key is assumed to be present
in the request data, but it might not. Fixed to test for existence
before using the value.
2020-07-14 11:42:21 +02:00
Nestor Soriano e05aa8a03a Add unit test for WC_Admin_Post_Types::bulk_and_quick_edit_save_post.
The test added checks that stock status of variations when saving
a variable product is changed or not appropriately depending on
the request data supplied.
2020-07-14 11:42:21 +02:00
Nestor Soriano a3ee904081 Add login_as_role and login_as_administrator to WC_Unit_Test_Case.
Those methods are a convenient replacement for
"this->factory->user->create". Tests that were using that to
simulate user login have been modified to use the new methods.
2020-07-14 11:42:21 +02:00
Nestor Soriano 9c2a43bfd5 Fix code sniffer errors in a few unit test files. 2020-07-14 11:42:21 +02:00
Christopher Allford 6cd4079c8a Added a test to verify the rating ordering for products 2020-07-13 13:35:00 -07:00
Christopher Allford 16c5ac401a Adjusted the publish configuration to respect the @woocommerce scope 2020-07-13 10:05:17 -07:00
Mike Dent 53d9085c16 Fixed indent and incomplete test code. 2020-07-12 19:26:57 +01:00
Mike Dent cf9db99a9f "Hidden" field type added to woocommerce_form_field() #26468 2020-07-12 16:38:36 +01:00
Christopher Allford 933cdd7a7b Removed the default `id` field added to all CLI commands
Some of our endpoints don't have an "<id>" parameter but we're expecting one in the CLI. Since the `id` is already part of the supported IDs we don't actually need this since it will pull it from the route.
2020-07-10 14:16:30 -07:00
Christopher Allford e4d90f10c3 Corrected the tabs in the README.me 2020-07-02 15:28:19 -07:00
Christopher Allford 51467f4683 Added a registry for adapters and factories to be held in globally 2020-07-02 14:43:14 -07:00
Christopher Allford b5e1e1cc8a Added a readme documenting the usage of the model factory package 2020-07-02 14:39:18 -07:00
Christopher Allford 822179e4ac Renamed the e2e-factories package to better reflect its usage-agnostic design 2020-07-02 14:16:01 -07:00
Christopher Allford 5652025d28 Removed unused adapter types 2020-07-02 13:56:48 -07:00
Christopher Allford d8beef56b5 Added support for faker to populate models with dummy data 2020-07-02 13:33:30 -07:00
Christopher Allford 4373c7be1b Moved the factory package init into a common utility 2020-07-02 13:13:23 -07:00
Christopher Allford 9b18a95f93 Adjusted the build:packages command to allow each package to build itself 2020-07-02 11:59:41 -07:00
Christopher Allford f1a616e026 Made the model properties compliant with code style 2020-07-02 10:56:21 -07:00
Christopher Allford 3e69dd3a64 Replaced the `createSimpleProduct` helper with a usage of the factory 2020-07-02 10:50:56 -07:00
Christopher Allford f11a47693b Refactored interceptors to support different authentication styles 2020-07-02 10:03:35 -07:00
Christopher Allford 85833f137c Fixed a bug that would cause APIService failures to throw unhandled exceptions when creating 2020-07-01 22:08:18 -07:00
Christopher Allford c3de8f0d12 Adjusted the structure of the factory package for easier consumption 2020-07-01 22:07:27 -07:00
Claudio Sanches d3d8e74b58 Fixed unit tests for #26462 2020-07-01 18:13:29 -03:00
Christopher Allford 0785e6caa7 Merge branch 'master' into package/e2e-factories/product 2020-07-01 14:11:25 -07:00
Christopher Allford 68daac3a94 Added a utility for initializing all of the APIAdapters with a service 2020-07-01 13:58:12 -07:00
Christopher Allford b4c1f3ca8f Fixed the POST, PUT, and PATCH Axios service actions 2020-07-01 12:31:20 -07:00
Christopher Allford bc3e1b4555 Replaced the exported variables with functions to populate the registry 2020-07-01 12:08:08 -07:00
Christopher Allford e6e764320b Added a registry to hold all of the factories and adapters 2020-07-01 11:07:57 -07:00
Claudio Sanches 54f91a5a59
Merge pull request #26566 from woocommerce/update/26510-generate-order-key
Allow custom values in wc_generate_order_key()
2020-07-01 12:41:24 -03:00
vedanshujain 6a8f9a4abe Disabled flaky test 2020-07-01 19:09:50 +05:30
vedanshujain 836d764c67 Add tests 2020-07-01 19:09:07 +05:30
Christopher Allford 627bd5a99a Simplified the package directory structure 2020-06-30 21:37:17 -07:00
Christopher Allford c23f52aedf Created a base ModelFactory for all factories to extend 2020-06-30 19:00:42 -07:00
Christopher Allford 3e2e03d48a Fixed the URL being passed to the OAuth package 2020-06-30 16:01:47 -07:00
Christopher Allford 603a5e7812 Changed the structure of error responses
In practice having the response class contained within the error feels a little backwards. We can instead have a structured APIError model that is contained in the APIResponse and have a consistent response format to consume.
2020-06-30 16:01:12 -07:00
Christopher Allford 7500cc004d Added a skeleton product factory for testing 2020-06-30 13:05:25 -07:00
Christopher Allford 4aa9360ba7 Added an adapter to support creating models via the API 2020-06-30 12:50:15 -07:00
Claudio Sanches c3608f3b57
Merge pull request #26878 from woocommerce/fix/26787
Moved synchronous webhook execution into a shutdown function
2020-06-30 16:34:12 -03:00
Nestor Soriano 391474c5ef Fix code sniffer errors in class-wc-tests-product.php 2020-06-29 15:20:49 +02:00
Nestor Soriano 9aa3c54bd9 Fix variable product stock status not being properly set on save
When a product is saved its validate_props method is invoked,
and this recalculates the stock_status property based on whether
the product manages stock or not, the stock quantity, and the
value of the woocommerce_notify_no_stock_amount option.

In the case of variable products, and when stock is managed, the stock
was set to "instock" when the current stock was enough, but only
if the "stock_quantity" property was in the list of changed properties
for the object (the method in the base product class doen't check
for changed properties). This is a problem because the
wc_update_product_stock function updates stock_quantity but via direct
database modification, and thus stock_quantity isn't considered
modified. Therefore stock modifications via wc_update_product_stock
don't update stock_status on the product (e.g. when going from 0 to 1
after a refund the stock status will remain as "outofstock").

The fix consists of removing the check for changed properties since
it's not done anyway in the other cases (when stock is below the
woocommerce_notify_no_stock_amount threshold) nor in the base class.

Also, validate_props is refactored for readabiliyy, and an useless
set_stock_status() call placed right before save()
in wc_update_product_stock is removed.
2020-06-29 14:32:17 +02:00
Néstor Soriano 7b3e902952
Merge pull request #26629 from woocommerce/fix/25552
Schedule a deferred product sync for products with parent on delete.
2020-06-29 14:15:10 +02:00
Christopher Allford 7331036d17 Moved synchronous webhook execution into a shutdown function
One of the problems with synchronous webhooks is that they are executed as soon as the related action is. Since we may call an action multiple times in the process of updating something, this causes only the first action to trigger the hook. This differs from asynchronous execution because in that case, the web hook will be executed after the entire request has completed.
2020-06-25 16:54:17 -07:00
Christopher Allford ddbbbbc078 Adjusted the TypeScript configuration to use the --build flag 2020-06-24 16:08:28 -07:00
Christopher Allford 6ad8b57f2e Added formatting requirements to the code style 2020-06-24 14:47:46 -07:00
Christopher Allford 4e02ce7afd Moved the Axios response/error transformations into an interceptor 2020-06-24 11:35:04 -07:00
Christopher Allford 9908a84d0e Added a service for interacting with the WordPress API
We've hid the use of Axios behind a service so that we're able to easily mock it out in factories as well as handle the creation and configuration of the client. This will make it easier on consumers in that they won't have to worry about things like authentication when using the API.
2020-06-23 13:15:26 -07:00
Ron Rennick e1c16ba7ef remove setup unit tests 2020-06-23 16:19:54 -03:00
Christopher Allford 031bb6593f Fixed the usage of baseURL with the APIAuthInterceptor 2020-06-23 11:53:00 -07:00
Christopher Allford 323d06744c Adjusted the APIAuthInterceptor to be more explicitly Axios-specific 2020-06-22 12:10:45 -07:00
Ron Rennick 59f2bdbe46 add template cache unit test 2020-06-22 16:05:29 -03:00
Ron Rennick ee151bbd95 Merge branch 'master' into add/npm-publish 2020-06-22 13:46:54 -03:00
Christopher Allford dd74c3db45 Removed build artifact 2020-06-20 18:46:59 -07:00
Christopher Allford 2a3b1b3780 Adjusted the package to better support NPM distribution 2020-06-20 18:25:19 -07:00
Christopher Allford 9f1decd4c6 Added an interceptor to handle WooCommerce API authentication 2020-06-19 12:08:48 -07:00
Christopher Allford 5e15271f95 Excluded test files from the TypeScript build 2020-06-18 09:43:11 -07:00
Christopher Allford 1418b68910 Initial configuration for e2e-factories package 2020-06-17 15:51:28 -07:00
Julia Amosova 281057eee8 Adjust various conditions of the OBW e2e test to make it pass 2020-06-17 17:20:12 -04:00
Ron Rennick 239476ddc5 create ready page after initialization script 2020-06-16 12:29:43 -03:00
Peter Fabian 418d95298a Merge branch 'master' into update/wc-admin-1.3.0-beta-1
# Conflicts:
#	composer.lock
2020-06-16 14:58:43 +02:00
Peter Fabian bb2cf2e8dc Removed deprecated method call. 2020-06-16 13:18:05 +02:00
Peter Fabian c35c4f1f08
Merge pull request #26395 from woocommerce/revert-26226-revert-25708-update/reserve-stock-for-checkout
Introduce a `reserved stock` class and database table to prevent race conditions during checkout
2020-06-16 11:38:10 +02:00
Vedanshu Jain 60ffc7ab99
Merge pull request #26583 from woocommerce/fix/26582
Fix regression caused by merging #25092 conflicting with #24828
2020-06-12 15:13:21 +05:30
Peter Fabian 296112cbea
Merge pull request #26237 from woocommerce/fix/24000
Fix adding product variant to cart using `add-to-cart` parameter (#24000)
2020-06-11 13:13:12 +02:00
Peter Fabian 439562e854
Merge pull request #23971 from woocommerce/refactor/23783
Better template caching for container environments
2020-06-11 10:13:46 +02:00
Vedanshu Jain b45373fe0c Revert "Revert "Introduce a `reserved stock` class and database table to prevent race conditions during checkout"" 2020-06-05 15:18:01 +05:30
Vedanshu Jain 6564847802
Merge pull request #26454 from woocommerce/enhancement/verify-db
Add `verify_base_db` method to check if all base tables are present.
2020-06-05 15:15:39 +05:30
Ron Rennick 0265e027ef
Merge pull request #26637 from woocommerce/fix/wc_timezone_string
use wp_timezone_string when available
2020-06-03 15:41:47 -03:00
Claudio Sanches 4922c34180
Merge pull request #26136 from woocommerce/feature/code-hacker-for-unit-tests
Code hacker for unit tests
2020-06-03 08:41:28 -03:00
Nestor Soriano 32dac2486f Update autoload-dev in composer.json to add tests/tools directory
The mapping of the "Automattic\WooCommerce\Testing\Tools\" namespace
to the "tests/tools" directory is moved from manual registration
inside the tests bootstrap constructor to a declaration inside the
autload-dev section in composer.json.
2020-06-03 09:28:54 +02:00
Nestor Soriano bfda3f9938 Code hacker resdesign for single-load of code files.
The code hacker as originally designed, as a mechanism that allowed
to enable hacks at the individual test level, is flawed because it
assumes that code files are loaded before each test, but actually
the PHP engine loads code files only once.

Therefore this commit redesigns it so that the two existing main hacks,
the functions mocker and the static methods hacker, are applied
to all the relevant functions and classes at bootstrap time, and
mocks for each individual function/method can be registered at the
beginning of each test. See README for the full details.
2020-06-02 19:06:53 +02:00
Claudio Sanches 6afbed0c14 Fixed coding standards 2020-06-01 23:55:17 -03:00
Ron Rennick 1215844b05 update timezone unit tests to support WP 5.3/5.4 2020-05-29 08:29:35 -03:00
Ron Rennick 7fbe912e19 use wp_timezone_string when available 2020-05-29 07:54:43 -03:00
Nestor Soriano b43679c181 Schedule a deferred product sync for products with parent on delete.
Right now, when a product having a parent (e.g. a variation having a
parent variable product) is saved, wc_deferred_product_sync is
executed so that product sync is performed at the end of the request.
This commit implements the same when the product is deleted.
2020-05-28 14:07:51 +02:00
Peter Fabian 2394da73b4 Merge branch 'master' into refactor/23783 2020-05-28 11:19:03 +02:00
Peter Fabian 30fe1cde72 Moved unit tests to the new location. 2020-05-28 11:18:47 +02:00
vedanshujain bbb7600f87 Add unit test for calculation based on rounding pref 2020-05-27 23:55:46 +05:30
vedanshujain d904db815d Disable flaky test which was causing many calculation tests to fail. 2020-05-27 23:53:20 +05:30
vedanshujain af942a131a Add test to ensure that verify_base_table also creates table if needed. 2020-05-26 23:46:58 +05:30
vedanshujain 57d336433a Fix regression caused by merging #25092 conflicting with #24828 2020-05-22 22:08:42 +05:30
vedanshujain 418741a0b2 Add unit test for verify_base_tables function 2020-05-22 18:32:04 +05:30
Christopher Allford 2953df2c5d
Merge pull request #26529 from woocommerce/fix/e2e-403-errors
use nonced logout link for store owner logout
2020-05-21 10:44:10 -07:00
Ron Rennick 47aab8c56b
Merge pull request #26522 from woocommerce/tweak/e2e-tests-suite
Tweaks to e2e tests suite README
2020-05-21 13:15:04 -03:00
Claudio Sanches 5d034b83a9 Allow custom values in wc_generate_order_key() 2020-05-20 17:41:22 -03:00
Nestor Soriano 2a68bb018d Move testing tools to the tests/Tools directory
The testing tools (only the code hacker at this time) have been moved
from 'src' to 'tests/Tools', since many opcode cache plugins
load the whole src folder in production.

Also, an extra autoloader is set in the tests bootstrap so that
the 'tests/Tools' directory corresponds, using PSR4, to the
'Automattic\WooCommerce\Testing\Tools' namespace.
2020-05-20 09:57:39 +02:00
Nestor Soriano 8a7d955253 Improvements on the code hacker.
- Add methods to temporarily disable and reenable the code hacker.

The code hacker is causing issues in some tests that perform
write operations to the local filesystem. Since this happens only
in a few cases, the easiest fix is to temporarily disable the
code hacker when that happens. This commit adds two new methods
for that in `WC_Unit_Test_Case`: `disable_code_hacker` and
`reenable_code_hacker`.

These methods use a disabling requests count so that the hacker
isn't enabled before it should. E.g. you call `disable`, then
a helper method that does `disable` and `enable`, then `enable` -
then only the last `enable` will have effect.

- `CodeHacker::add_hack` has now a boolean `persistent` parameter.
Persistent hacks won't be cleared by `clear_hacks`.

- `CodeHackerTestHook::executeAfterTest` will now disable the hacker
only if no persistent hacks are registered.

- The existing `file_copy` method is made static for consistency.

- `CodeHacker::restore` method renamed to `disable` for clarity.
2020-05-20 09:56:26 +02:00
Nestor Soriano 6f2e0bf694 Improve error messaging in WC_Tests_MaxMind_Database::test_download_database_works 2020-05-20 09:56:25 +02:00
Nestor Soriano 884fd08462 Add a workaround for code hacking static methods on already loaded files.
The unit testing bootstrap loads and initializes WooCommerce, this
loads a bunch of code files that can't then be hacked in the test hooks.

A workaround is provided in this commit for the case of hacking
static methods. A new StaticWrapper class is created that allows
defining mock methods after the code file has been loaded.
This is applied to all classes from a fixed list in the bootstrap,
before WooCommerce is initialized. The list should be kept up to date
with the list of classes that require such workaround.
2020-05-20 09:56:25 +02:00
Nestor Soriano 57845ef8b8 All code hacking files moved to src\Testing folder. 2020-05-20 09:56:25 +02:00
Nestor Soriano 1a68abbc28 Miscellaneous code hacking fixes:
- Fix how CodeHackerTestHook::executeBeforeTest parses the test name,
  to account for warnings and tests with data sets.

- CodeHackerTestHook now includes a executeAfterTest hook that
  disables the code hacker (needed to prevent it from inadvertently
  altering further tests). Also, clear_hacks is executed in
  executeBeforeTest for the same reason.

- CodeHacker gets restore, clear_hacks and is_enabled methods
  to support the changes in CodeHackerTestHook.

- FunctionsMockerHack fixed so that it doesn't modify strings
  that are class method definitions.

- Added the WC_Unit_Test_Case::file_copy method, it must be used
  instead of the PHP built-in "copy" in tests, otherwise tests
  that run with the code hacker active will fail.
  This is something to investigate.
2020-05-20 09:56:25 +02:00
Nestor Soriano 9a5b3b353d Add the @hack code annotation for tests.
Now @hack class and method annotations can be used to register
code hacks as an alternative to using before_ methods.
The syntax is /* @hack HackClassName param1 param2 */
where parameters will be passed to the class constructor.
If the class name ends with "Hack", then that suffix can be
omitted (e.g. "Foo" can be specified instead of "FooHack").
2020-05-20 09:56:25 +02:00
Nestor Soriano db58b51de3 Barebones implementation of a code hacker for unit tests.
The "code hacker" is a class that hooks on filesystem events
(using stream_wrapper_unregister) in order to allow for dynamically
modifying the content of PHP code files while they are loaded.
The code hacker class allows registering hacks, which are
functions that take source code as input and return the modified code.
A hack can be a standalone function or a class with a "hack" method.

A few hacks are provided off the shelf. One allows mocking standalone
PHP functions (WP, WOO or not), another one allows mocking static
methods, and there's the one that removes the "final" qualifier
from a class definition. This helps unit testing stuff that would
otherwise be quite hard to test.
2020-05-20 09:56:25 +02:00
Vedanshu Jain 7fb1079137
Merge pull request #26399 from woocommerce/fix/uploads_htaccess
Disable directory listing for redirect download method
2020-05-19 15:56:37 +05:30
Ron Rennick 617a523057 fix merge conflicts 2020-05-18 12:34:03 -03:00
Claudio Sanches eea062f9fa
Merge pull request #26519 from woocommerce/fix/csv-import-special-columns
Fixed the case conversion for meta key column mapping in product CSV imports
2020-05-18 11:33:50 -03:00
Ron Rennick 07c6075dde use nonced logout link for store owner logout 2020-05-15 16:58:50 -03:00
Boro Sitnikovski f34e73d402 Add a comment on @babel/preset-env 2020-05-15 11:28:21 +02:00
Boro Sitnikovski ad3b9fc861 Fix version mismatch error 2020-05-15 11:21:59 +02:00
Boro Sitnikovski b01f3aae93 Add some additional information and be specific about babel file 2020-05-15 11:21:34 +02:00
Peter Fabian 2f141eca77 PHPCS 2020-05-15 09:40:23 +02:00
Christopher Allford 7bf9c31f64 Adjusted the column name normalization to avoid squashing meta key case sensitivity
Since we were converting the field to lowercase we ended up inserting meta in all lowercase, regardless of what it was in the CSV file. We should only be using the normalized field name when looking at the default columns, and should instead rely on a case-insensitive regex for the special columns.

One thing to note is that we're still defaulting the $headers array to the normalized field, as we don't want to change what is being passed to the filter for unmapped columns.
2020-05-14 21:20:55 -07:00
Christopher Allford 63ba6f7ee0 Moved the PSR-4 namespaced test directory to the correct folder
I know this probably doesn't belong in this PR, but it has been thoroughly discussed and I don't think anyone will mind :)
2020-05-14 21:20:47 -07:00
Peter Fabian 777c140611 Skip tests when WC Admin is not active.
Since those Notes were created because of WC Admin and the display is handled by WC Admin, it does not make sense to test them without WC Admin.
In addition, the data store that handles these Notices is not loaded without WC Admin.
2020-05-14 14:35:09 +02:00
Peter Fabian 2c1625d3f9 Added a couple of tests for WC_Notes_Run_Db_Update, a poorly testable class. 2020-05-14 13:31:43 +02:00
Ron Rennick 3053942cf1 chore(release): publish
- @woocommerce/e2e-environment@0.1.5
2020-05-13 15:18:00 -03:00
Ron Rennick a433304757 additional changes
- Update @wordpress/e2e-test-utils to 4.6.0
- ignore all node_modules folders in the install
- remove missed package script
- bump component version
2020-05-13 15:14:18 -03:00
Claudio Sanches 1d99c343e7 Added unit tests 2020-05-12 15:36:25 -03:00
Christopher Allford ef8e7114b7 Merge branch 'privacy-exporter-group-description' of git://github.com/garretthyder/woocommerce into garretthyder-privacy-exporter-group-description 2020-05-12 09:40:17 -07:00
Ron Rennick df6e9e7894 bump e2e-environment to 0.1.4 2020-05-12 13:35:42 -03:00
Job 8fb72c8a1d Decapitalise "Better" in "Build a Better WooCommerce"
All titles and questions in the new onboarding wizards only capitalise names and the first letter of the sentence. This seemed a tiny bit off. (Literally tiny.)

Changed "Build a Better WooCommerce" to "Build a better WooCommerce"
2020-05-12 07:49:24 -07:00
Ron Rennick 02b649d17c use version of docker supported by trusty and newer 2020-05-11 22:58:45 -03:00
Ron Rennick ed135109e0 add e2e component build
- add build script
- update component for path changes
- bump component version
- move ready post creation to component
- update component readme
2020-05-11 15:54:12 -03:00
Vedanshu Jain 31b648d479
Merge pull request #26358 from woocommerce/fix/26348
Clear only plugin cache if WC header are not present to load with WC headers.
2020-05-11 18:14:39 +05:30
Ron Rennick e2af7e5d10
Merge pull request #26427 from woocommerce/docs/e2e-tests
update tests and e2e readme instructions, file locations
2020-05-11 09:16:38 -03:00
Ron Rennick dea4144be2 docker compose command line arg parsing for local and module 2020-05-08 16:26:30 -03:00
Vedanshu Jain 6d8ca7f4ef
Merge pull request #26056 from woocommerce/fix/fix_cart_unit_test
Fixes broken unit test
2020-05-08 23:52:01 +05:30
Claudio Sanches 73b71023ca Fixed cart get total unit test 2020-05-08 23:17:59 +05:30
yasiendwieb ad3a9e8bf3 fix issue in tax calculation at cart test case 2020-05-08 23:17:59 +05:30
Ron Rennick 72ff998033 remove npm e2e-CI script command 2020-05-08 14:29:02 -03:00
Ron Rennick 209b2edea9 chore(release): publish
- @woocommerce/e2e-environment@0.1.2
2020-05-08 14:09:39 -03:00
Ron Rennick e1c24c9f3e chore(release): publish
- @woocommerce/e2e-environment@0.1.1
2020-05-08 14:00:46 -03:00
Ron Rennick 4f908c452d update tests and e2e readme instructions, file locations 2020-05-08 11:24:43 -03:00
Ron Rennick 0f2fb4f8d5 fix merge conflicts 2020-05-06 14:05:00 -03:00
Ron Rennick 0e2e91371a update for review items 2020-05-06 13:29:13 -03:00
Joshua T Flowers 43ab840e1a
Add a put method to the WC_Helper_API (#26262)
* Merge wc api authorization headers with given headers

* Add put method to WC_Helper_API

* Add unit test coverage around WC_Helper_API request methods

* Add tests for WC_Helper_API url method
2020-05-06 19:25:23 +03:00
Jonathan Sadowski a0a8cf7ab3 Add test to ensure that a notice is displayed when an any attribute is omitted 2020-05-05 14:16:01 -05:00
Jonathan Sadowski 53c905f493 Reset request vars in any attribute test 2020-05-05 13:32:15 -05:00
Jonathan Sadowski c0a72c9185 Reset notices at the start of each test 2020-05-05 13:32:15 -05:00
Jonathan Sadowski 3f47608228 Test adding a variation with 'any' attributes 2020-05-05 13:32:15 -05:00
Jonathan Sadowski 790c8ae8ae Update the test to make sure there are no error notices 2020-05-05 13:32:15 -05:00
Jonathan Sadowski 3f70f70f3a Switch to assertCount for count assertions in test 2020-05-05 13:32:15 -05:00
Jonathan Sadowski 3d0bfd8ee2 Add test to check for notice when invalid attribute is provided for a variant 2020-05-05 13:32:14 -05:00
Jonathan Sadowski 31bdce3725 Fix typo in test_add_variation_with_url test (use British spelling of colour) 2020-05-05 13:32:14 -05:00
Jonathan Sadowski fc683bdb80 Update unit tests to account for issue 24000 2020-05-05 13:32:14 -05:00
vedanshujain 27ad4a552e Rename file and class to resemble PSR4 like convention for consistency. 2020-05-05 19:19:37 +05:30
Ron Rennick 97a6110ae4 combine puppeteer config files 2020-05-04 16:16:21 -03:00
vedanshujain f4e169f21e Moved test specific logic from bootstrap to test file 2020-05-02 00:31:54 +05:30
vedanshujain 13dfb8180f Add unit test and a sample Woo plugin file 2020-05-01 22:47:08 +05:30
Ron Rennick 71fb49dc06 restore latest default.json from master 2020-05-01 13:28:59 -03:00
Ron Rennick 78e777f25f restore travis e2e setup script 2020-05-01 10:18:21 -03:00
Ron Rennick 6726f6423d merge travis config files 2020-04-30 19:58:37 -03:00
Christopher Allford c0ecb79ba2
Merge pull request #26345 from woocommerce/refactor/phpunit-suite
Restructure PHPUnit Suite
2020-04-30 13:51:16 -07:00
Ron Rennick 7fbbbf6608 update travis config 2020-04-30 16:43:36 -03:00
Christopher Allford 98b6b973e8 Updated the tests readme to explain the purpose of our two test directories 2020-04-30 10:09:42 -07:00
Ron Rennick 0de3718770 change component name to e2e-environment 2020-04-30 14:01:42 -03:00
Ron Rennick b4fcfd93c2 rename test:e2e.json, remove redundant files 2020-04-29 11:22:11 -03:00
Christopher Allford 04ec11e90b Added a PSR-4 namespaced tests/php folder for tests written against new code in the src directory 2020-04-28 15:41:04 -07:00
Ron Rennick d41fbc7ff2 update folder structure, use WordPress 5.4 2020-04-28 19:09:39 -03:00
Ron Rennick da494be615 merge master 2020-04-28 16:13:30 -03:00
Vedanshu Jain 15f8eb04c4
Merge pull request #26230 from woocommerce/update/wc-admin-1.1.0
Update wc-admin version to 1.1.0
2020-04-28 19:05:50 +05:30
Julia Amosova b1bb4dfdb9 Add wait for the 'Proceed' button to become active in shipping task 2020-04-27 16:30:50 -04:00
Julia Amosova 46bc16de98 Update the number of fields expected within shipping task 2020-04-27 15:29:09 -04:00
Julia Amosova 3991647c94 Add shipping store location verification step in onboarding e2e test 2020-04-27 14:22:23 -04:00
Christopher Allford b5bd8225e8 Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
Vedanshu Jain ee119e0a7e
Revert "Introduce a `reserved stock` class and database table to prevent race conditions during checkout" 2020-04-21 15:37:21 +05:30
Christopher Allford caa1a6d475 Merge remote-tracking branch 'origin/master' into fix/update-minimum-version 2020-04-16 14:46:17 -07:00
Claudio Sanches e43dc9b8a2 Use assertContains 2020-04-16 18:06:18 -03:00
Claudio Sanches 02e3ec7e97 Use assertStringContainsString to compare images 2020-04-16 17:52:22 -03:00
Claudio Sanches a5bc29e26c Fixed unit test on WP 5.5 alpha 2020-04-16 00:25:32 -03:00
Jeff Stieler 17d3771273 Remove defunct E2E test runner script, add docker scripts to package file. 2020-04-15 11:17:48 -06:00
Jeff Stieler 622e47f29f E2E: add app-level node config dir to path. 2020-04-15 11:07:32 -06:00
Ron Rennick e8efb82b9e add install jest 2020-04-14 12:06:26 -06:00
Ron Rennick 9742085f01 move before script to bash 2020-04-14 12:06:26 -06:00
Ron Rennick 049d606b15 use consistent job name 2020-04-14 12:06:26 -06:00
Ron Rennick 812e500224 update test configuration to use e2e-env 2020-04-14 12:06:26 -06:00
Ron Rennick 393240a0f3 move e2e-env to tests/e2e-env 2020-04-14 12:06:25 -06:00
Ron Rennick 3d63ad48a3 Tweak configuration
- set executable on initialize.sh
- use pagename query string for ready page
- use environment vars for docker config
2020-04-14 12:06:25 -06:00
Ron Rennick c414eddf59 merge config from from https://github.com/woocommerce/woocommerce-admin/pull/3717 2020-04-14 12:06:25 -06:00
Julia Amosova 99b8c6facf Reorder benefits section testing in new OBW e2e test 2020-04-08 17:34:04 -04:00
Nestor Soriano 0eed82b3b7 Fix code standards violations introduced in #25092 2020-04-07 12:28:30 +02:00
Christopher Allford 09df1205de Updated the minimum PHP version to 7.0 2020-04-06 17:07:33 -07:00
Vedanshu Jain 3bf473517d
Merge pull request #25708 from woocommerce/update/reserve-stock-for-checkout
Introduce a `reserved stock` class and database table to prevent race conditions during checkout
2020-04-07 02:16:22 +05:30
Vedanshu Jain 057b352de7
Merge pull request #26016 from woocommerce/fix/26010
Setup Wizard: Default 100% of users to new OBW.
2020-04-07 02:10:09 +05:30
Vedanshu Jain 237463c39b
Merge pull request #25800 from woocommerce/fix/25748
Fixes tax rounding issues
2020-04-07 00:24:34 +05:30
vedanshujain ef17b148be Removed unused tax class prop 2020-04-06 12:49:46 +00:00
Vedanshu Jain e3eb30c509
Merge pull request #26066 from woocommerce/fix/26002
Fix/26002
2020-04-06 18:05:47 +05:30
Vedanshu Jain 52ded367f5
Merge pull request #26075 from woocommerce/fix/26015
Prune elements with display none to fix regression.
2020-04-06 18:03:45 +05:30
Néstor Soriano 13765d9e91
Merge pull request #25092 from leanzafrancesco/fix/25091
Fix/25091 - Wrong totals in orders with taxable and non-taxable products and percentage coupons
2020-04-06 12:31:07 +02:00
Christopher Allford a7c0dec33a Added a function to fetch all of the path define tokens that may be present in template paths 2020-04-05 13:21:50 -07:00
Christopher Allford 33e81654a9 Made the path tokenization deterministic
Since the tokens are replaced in a first-discovered first-replaced order, we may accidentally create tokenized paths like '{{ABSPATH}}/test' instead of the desired '{{WP_CONTENT_DIR}}test'. By ordering them according to specificity however, we ensure that we tokenize as much of the path as possible.
2020-04-05 12:41:39 -07:00
Christopher Allford 4aab99614a Added tests for path tokenization/untokenization 2020-04-05 12:15:39 -07:00
Christopher Allford 91c608f38e Merge branch 'master' into refactor/23783 2020-04-05 10:55:00 -07:00
Mike Jolley 9b5189dc7a Remove tests for order methods which were removed 2020-04-03 15:55:15 +01:00
vedanshujain facfb16131 Changed class name to match file name 2020-04-03 15:55:14 +01:00
Claudio Sanches 2ebd86f2dc Revert "Revert "Add support for '_held_for_checkout` records to prevent race conditions."" 2020-04-03 15:55:13 +01:00
vedanshujain af810af57a Add unit test for removing displa:none from emails 2020-04-03 13:49:28 +00:00
vedanshujain 0af20fe4ef Add unit test for guest checkout with per user coupon usage limit. 2020-04-02 15:04:57 +00:00
Steve Grunwell 17c56d6d12 Merge branch 'master' into fix/travis-against-minimium-requirements 2020-04-01 14:30:42 -04:00
Julia Amosova 35555138bd Remove unused functions imports from components 2020-03-31 11:20:12 -04:00
Julia Amosova 2090dad9fd Update shipping setup through Task List 2020-03-31 10:00:43 -04:00
Julia Amosova cef74d73fe Replace old shipping setup with new OBW shipping setup task 2020-03-31 00:32:42 -04:00
Julia Amosova 37b47b496b Improve shipping setup in OBW e2e test 2020-03-30 23:13:17 -04:00
Julia Amosova 4c1eece4f4 Add shipping setup to OBW e2e test 2020-03-30 21:57:37 -04:00
Julia Amosova a5bc44e92e Refactor 'Continue' button clicks & add Theme section test coverage 2020-03-30 20:12:39 -04:00
Christopher Allford 23e555823b
Merge pull request #25943 from woocommerce/fix/25810
Fixed remainder application for percent coupons
2020-03-30 14:13:03 -07:00
Jeff Stieler d9a1c50074 Fix <SelectControl> interaction in new OBW test.
Remove usage of `puppeteer-select`.
2020-03-30 11:31:56 -06:00
Julia Amosova bb20a436b8 Add new OBW e2e test (not complete - missing Theme section coverage) 2020-03-27 17:45:20 -04:00
Julia Amosova f8bb7681b6
Merge pull request #25839 from woocommerce/fix/remove-legacy-e2e-travis-setup
Remove legacy e2e test suite travis setup
2020-03-27 10:11:56 -04:00
Peter Fabian 0e0b1d646d
Merge pull request #25882 from woocommerce/fix/25845
Set usage count before usages query
2020-03-18 15:44:49 +01:00
Christopher Allford 917e5ff77d
Merge pull request #25923 from woocommerce/fix/test-install-db-socket
Correct usage of database sockets in test install script
2020-03-17 09:08:18 -07:00
Christopher Allford ed55034867 Added a check to prevent coupon cent remainders from decreasing the item cost below zero 2020-03-16 21:32:25 -07:00
Christopher Allford 98395741cf Changed the default test file locations to respect the system's tmp folder 2020-03-13 20:44:43 -07:00
Christopher Allford 5f829d4005 Corrected the handling of sockets in the unit test install script 2020-03-13 20:44:38 -07:00
Christopher Allford a576060403 Replaced the strict path used in the MaxMind database download test
It was set to /tmp directly instead of using the sys_get_temp_dir() method, leading to failures on systems with a different temp folder location,
2020-03-13 20:44:35 -07:00
Christopher Allford 8c0f4a1204 Made the is_package_shippable check more permissive
Initially it was made more precise to avoid calculating estimates for incomplete addresses. Due to some bad working in template files though, as well as historical precedent, we need to change it back.
2020-03-13 09:15:31 -07:00
Steve Grunwell d085044970 Remove an unnecessary onNotSuccessfulTest() override, as the tearDown() fixture will be called regardless of the successfulness of the test method 2020-03-12 16:00:01 +00:00
Steve Grunwell 0a5161ea3d *CODING STANDARDS ONLY* Add method visibility, clean up inline documentation. 2020-03-12 15:57:32 +00:00
Steve Grunwell 2383670020 Simplify the test for test_get_tables_enables_filter() now that we can leverage PHP >= 5.3 2020-03-12 15:54:25 +00:00
Steve Grunwell 7f74eace0b Rewrite WC_Tests_Install::test_get_tables()
Instead of comparing all tables that exist with all tables that are registered with `WC_Install::get_tables()` (which was only introduced a few versions ago in #19436), rewrite the test to verify that all of the tables *registered* actually exist within the database.

This will prevent tests from failing when, for example, they're run against databases that may or may not have additional plugins installed/activated. This also prevents tests from failing when running WooCommerce 4.x (e.g. with WooCommerce Admin) on WordPress < 5.3, since the tables are created but the callback to register the custom tables is never hooked.
2020-03-12 15:00:03 +00:00
Steve Grunwell 5855931542 Define the polyfill before attempting to call it 2020-03-11 16:53:25 +00:00
Steve Grunwell 86d44e74bb Make WC_Tests_CRUD_Data::onNotSuccessfulTest() compatible with its parent declaration 2020-03-11 16:35:36 +00:00
Steve Grunwell 0a3c5186fa The WP core test suite didn't introduce includes/listener-loader.php until WordPress 5.1, so we need to polyfill the behavior when testing against WordPress 5.0 2020-03-11 16:34:52 +00:00
vedanshujain a2418156d4 Add tests 2020-03-11 20:47:24 +05:30
Julia Amosova 0a90489322 Remove legacy e2e test suite travis setup 2020-03-06 14:12:24 -05:00
Jan-Paul Kleemans 108ad568d0
Update comment 2020-03-04 12:30:17 +01:00
vedanshujain 657e95b55e Added tests 2020-03-03 18:46:37 +05:30
vedanshujain 1314fdc0e7 Clear existing shippin rates before adding rate for test 2020-03-03 16:15:25 +05:30
vedanshujain 2c2d96ec95 Added tests for rounding issues 2020-03-02 15:30:10 +05:30
Vedanshu Jain 6f2b232fc7
Merge pull request #25734 from woocommerce/fix/25650
Fixed caching for order item on deletion
2020-02-27 13:48:44 +05:30
Ron Rennick 25ab5596a2 fix composer.lock conflict 2020-02-25 15:00:55 -04:00
Ron Rennick 77d6dc1342 update WCA class namespace in unit tests 2020-02-24 23:22:11 -04:00
Ron Rennick 2d70a48361 bump action scheduler version, add queue unit tests 2020-02-24 21:45:19 -04:00
Christopher Allford 6a292de9f9 Cleared the cache when order items are added, updated, or deleted 2020-02-23 12:41:33 -08:00
Julia Amosova 4a316b776f Fix markdown issue in the content and add more details to the docs 2020-02-19 11:31:27 -05:00
Julia Amosova 13761799cc Update documentation related to running e2e and unit tests 2020-02-18 17:09:03 -05:00
Brent Sessions 256d6f7808 Use new puppeteer-utils package. 2020-02-18 13:31:35 -05:00
Julia Amosova e9ee645049 Skip 2 failing variations e2e tests (until fixed) 2020-02-13 18:32:41 +00:00
Jeff Stieler 33e6aee1af
Export all component E2E test util functions. (#25636) 2020-02-11 08:29:48 -08:00
Peter Fabian e55461f6e4 Change the setting part before the verification. 2020-02-07 15:28:06 +01:00
Julia Amosova 94dcaed7ba Remove unnecessary store owner login before creating variable product 2020-02-07 14:12:15 +00:00
Julia Amosova e3afbfdd8c Update `Redirect only` file download method string 2020-02-07 14:09:56 +00:00
Julia Amosova c7e3171a31 Enable Storefront installation option in the old OBW 2020-02-07 12:59:40 +00:00
Julia Amosova 13e95db4ef Remove wc-admin installation option from the old OBW 2020-02-07 12:59:39 +00:00
vedanshujain ca5fd12103 Add setting to configure hash appends 2020-02-07 17:54:54 +05:30
vedanshujain 56176e0479 Append unique hash to filename for added security 2020-02-07 17:54:54 +05:30
Christopher Allford b5d5be7df1 Removed the admin screen checking in favor of good old fashioned request parameters for COD gateway setting loading 2020-02-06 12:29:01 -08:00
Rodrigo Primo 48480eb882 Fix unit tests when running using WP nightly
The WooCommerce unit tests started failing when running using WP nightly
with the following error:

```
Fatal error: require_once(): Failed opening required '/tmp/wordpress-tests-lib/src//wp-includes/class-phpmailer.php' (include_path='.:/home/travis/.phpenv/versions/7.4.2/share/pear') in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
```

https://travis-ci.org/woocommerce/woocommerce/jobs/646855363#L1955

This was happening because WP changed the syntax of the line where
ABSPATH is defined in the context of the unit tests
(https://core.trac.wordpress.org/changeset/47198/trunk/wp-tests-config-sample.php)
and we rely on this syntax to change ABSPATH when running
`tests/bin/install.sh`.

To fix this problem, this commit updates the sed command used to change
ABSPATH to work when both the old and new syntaxes are used. In the
future we might want to consider a more robust solution to the problem
of updating ABSPATH.
2020-02-06 12:43:47 -03:00
Peter Fabian 7233dc8a2e
Merge pull request #25011 from woocommerce/try/add-wc-admin
wc-admin: Include package
2020-02-06 12:09:25 +01:00
Peter Fabian ee865fe0b4
Merge pull request #25504 from woocommerce/update/order-detail-summary
Enhance order details and payment summary
2020-02-06 11:40:45 +01:00
Peter Fabian d3a33f8d05
Merge pull request #24943 from woocommerce/refactor/eu-vat-brexit
Brexit and VAT refactor
2020-02-05 19:41:40 +01:00
Christopher Allford 92708dde1f
Merge pull request #25512 from woocommerce/fix/25438.2
Fixed unnecessary loading when constructing COD payment gateway
2020-02-05 10:02:38 -08:00
Peter Fabian 5ba2cdafa5
Merge pull request #25183 from om4james/webhook-de-duplication
Fix for Duplicate Webhook deliveries
2020-02-05 18:38:15 +01:00
Claudio Sanches 5b9937ad48 Merge branch 'master' into try/add-wc-admin 2020-02-05 13:02:51 -03:00
Claudio Sanches 545a74fe64 Fixed coding standards 2020-02-05 11:55:19 -03:00
Christopher Allford 2f024ff024 Added tab check to COD gateway options loading 2020-02-05 06:49:33 -08:00
Claudio Sanches f5d2c98c3e Updated unit test 2020-02-05 11:16:29 -03:00
Claudio Sanches 74768d8abd Remove test 2020-02-05 11:13:16 -03:00
Rodrigo Primo f539d3e04b Merge branch 'master' into update/emogrifier 2020-02-05 10:01:38 -03:00
Rodrigo Primo ff05b06e6b Merge branch 'master' into update/emogrifier 2020-02-05 09:56:03 -03:00
Peter Fabian 87e42acd56
Merge branch 'master' into try/add-wc-admin 2020-02-05 13:02:20 +01:00
vedanshujain d19c470686 Add sanity test around order and customer permissions 2020-02-05 15:42:15 +05:30
Paul Sealock b7a9056a59 cleanup 2020-02-04 16:01:57 -08:00
Paul Sealock 2619f37b51 phpcs errors 2020-02-04 16:01:57 -08:00
Paul Sealock 4380087608 wc-admin: Include package 2020-02-04 16:01:57 -08:00
Christopher Allford b9ceabaa52 Utilized the constants package to fix the failing tests 2020-02-04 15:50:23 -08:00
Christopher Allford 1d15df860e Merge branch 'master' into fix/25438.2 2020-02-04 15:06:26 -08:00
Christopher Allford 57734ca8ce Merge branch 'master' into refactor/add-jetpack-constants 2020-02-04 14:36:35 -08:00
Garrett Hyder 6295534fbb Adds support for group_description for privacy exporters which was added in WP5.3 through WPCoreChangeset#45825 and WPCoreTracTicket#45491 2020-02-04 12:57:31 -08:00
Rodrigo Primo fb3b977a16 Add test to make sure that negative fees never make order total negative
For some reason unknown to me, the following commit added logic to make
sure that negative fees never make the order total negative: 804feb9333

Probably by accident, commit 4326e39250 changed this logic when `$fees_total += $item->get_total()` was replaced by `$fees_total += $fee_total`:

4326e39250 (diff-9b4164165828b26c4b7aec01c7b17884R1594)

This commit adds a failing test that ensures that the old behavior is
tested. This test needs to be fixed before we merge the changes proposed
in PR #25504.
2020-02-04 15:33:21 -03:00
Rodrigo Primo 08e0936aa6 Improve coverage of WC_Abstract_Order::calculate_totals() test
This commits improves the coverage of the
WC_Abstract_Order::calculate_totals() test by including a fee to the
order used to test the method.
2020-02-04 15:26:52 -03:00
Rodrigo Primo b87d0e26fe Add basic unit test for WC_Abstract_Order::get_total_fees() 2020-02-04 15:13:27 -03:00
Claudio Sanches 94d1b742ad
Merge pull request #25545 from woocommerce/prep/after-3.9
Bumped versions for the upcoming release.
2020-02-04 13:05:27 -03:00
Peter Fabian 4a506ebcf7
Merge pull request #25530 from woocommerce/fix/country-region-label
Fix/country region label
2020-02-04 13:54:22 +01:00
Peter Fabian f57fef5bdd Updated unit tests. 2020-02-04 13:45:28 +01:00
Christopher Allford c5e1fc6c45 Merge remote-tracking branch 'origin/master' into refactor/add-jetpack-constants 2020-02-03 11:50:16 -08:00
Peter Fabian e613056634 This perhaps better represents the spirit of the test. 2020-02-01 14:19:22 +01:00
Christopher Allford 1d1413b4ee Replaced direct access of many constants with the Constants library 2020-01-31 22:18:47 -08:00
Peter Fabian 132ced6039 Fixed test for 4.0. 2020-01-31 21:05:50 +01:00
Peter Fabian 6410ef9156 Updated since tags for the upcoming version. 2020-01-31 18:03:54 +01:00
Christopher Allford b6046930c6 Corrected a misspelled filter name 2020-01-30 18:12:00 -08:00
Christopher Allford 8a046ab0cd Cleaned up the template path replacement and fixed the wc_cache_set positioning 2020-01-30 16:24:07 -08:00
Peter Fabian a9a64fcee0
Merge pull request #25482 from woocommerce/fix/cart-e2e-test
Fix failing cart e2e test: fix setup wizard logic if new onboarding is presented
2020-01-30 12:51:56 +01:00
Julia Amosova 3dfc8f3dc5 Remove unnecessary 2nd setup wizard flow for the new onboarding 2020-01-30 11:29:28 +00:00
Julia Amosova 18d93e321a Update setup wizard test logic 2020-01-30 10:38:10 +00:00
Claudio Sanches 052fbfcb8c Test WC_Email::style_inline() 2020-01-29 17:07:18 -03:00
Christopher Allford 6ad091a9b7 Changed all of the constant accesses into corresponding Automattic\Jetpack\Constants usages 2020-01-28 21:21:29 -08:00
Christopher Allford bb09a8a4ea Prevented the COD payment gateway's "enable_for_methods" option loading outside of correct use-cases
Note: The tests fail in this commit because of the defines. Ran individually there are no problems, but I'm going to make another PR to merge in a package to make testing constants possible, and then come back to fix this after it gets merged.
2020-01-28 14:33:53 -08:00
Claudio Sanches b3ea0b17b4 Merge branch 'master' into refactor/eu-vat-brexit 2020-01-27 13:15:54 -03:00
Julia Amosova 0a5c866bc4 Remove taking screenshots sent to AWS on failed tests 2020-01-24 17:17:52 +00:00
Julia Amosova d4c8719d1f Remove the process of building legacy e2e test site 2020-01-24 17:05:18 +00:00
Julia Amosova eb92d35d96 Remove DB (used for the initial setup) that is no longer needed 2020-01-24 17:05:17 +00:00
Julia Amosova 2415cf1952 Fix setup wizard logic if new onboarding is presented 2020-01-24 14:37:27 +00:00
Julia Amosova 26ade8bb1f Add 1 second wait time between 2 UI blocks / AJAX calls 2020-01-22 16:52:35 +00:00
Rodrigo Primo 4e58f77575
Merge pull request #25322 from woocommerce/pr-25242
Prevent fatal error in set_current_gateway with no WC session
2020-01-17 09:54:03 -03:00
Rodrigo Primo 2668bf6025
Merge pull request #25314 from woocommerce/fix/24746
Removed the lowercase conversion of product search terms
2020-01-16 16:29:07 -03:00
Rodrigo Primo 8aad482bc1 Fix typo 2020-01-16 15:31:50 -03:00
Rodrigo Primo cb85c981ac Merge branch 'master' into pr-25242 2020-01-16 15:30:58 -03:00
Claudio Sanches bccb93fa3c
Merge pull request #25378 from woocommerce/fix/25361
Add license key support to MaxMind GeoLite2 database downloads
2020-01-15 20:51:14 -03:00
Rodrigo Primo 793dba81f1 Fix failing unit test
This commit fixes the unit test
WC_Tests_API_Functions::test_wc_rest_upload_image_from_url_should_return_error_when_invalid_image_is_passed() which was failing due to a change in a WordPress core message with the following error:

```
2) WC_Tests_API_Functions::test_wc_rest_upload_image_from_url_should_return_error_when_invalid_image_is_passed

Failed asserting that two strings are equal.

--- Expected

+++ Actual

@@ @@

-'Invalid image: File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.'

+'Invalid image: File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini file or by post_max_size being defined as smaller than upload_max_filesize in php.ini.'

/home/travis/build/woocommerce/woocommerce/tests/unit-tests/util/api-functions.php:89
```

(https://travis-ci.org/woocommerce/woocommerce/jobs/637353161#L402)

This test only fails when using WordPress nightly build (the yet to be
released WP 5.4).

To fix this problem, this commit adds an if statement to check for different error
messages depending on the WordPress version that is being used to run
the tests. In the future, we might want to refactor this test to remove
its dependency to a WordPress error message to make it more robust and
stable.
2020-01-15 11:17:49 -03:00
Claudio Sanches 992e13fb08 Updated implementation of geolite2 2020-01-14 16:24:07 -03:00
Christopher Allford 7a5083e47b Revert "Added a database option to allow for selecting different MaxMind databases"
This reverts commit d32c470cea.
2020-01-13 14:41:24 -08:00
Christopher Allford d32c470cea Added a database option to allow for selecting different MaxMind databases 2020-01-13 14:10:08 -08:00
Christopher Allford 6d3a3053c5 Moved the database file into the woocommerce_uploads folder 2020-01-13 08:53:43 -08:00
Christopher Allford 645affb7f3 Removed permanently failing unit test for deprecated GeoLite2 library integration 2020-01-13 08:17:11 -08:00
Christopher Allford 4f6aec61fd Added support for a randomized MaxMind database file prefix 2020-01-13 08:16:44 -08:00
vedanshujain f0f3b21a36 Added unit tests for setting current gateway 2020-01-13 14:18:59 +05:30
Claudio Sanches f253c87096 Fixed unit tests 2020-01-10 17:14:44 -03:00
Claudio Sanches 49aed6f6ca Remove alternatives for deprecated methods 2020-01-10 16:31:27 -03:00
Claudio Sanches 48547143f4 Fixed integration ID 2020-01-10 15:02:56 -03:00
Christopher Allford f5cbca5beb Added unit tests for the MaxMind integration class 2020-01-10 02:47:43 -08:00
Christopher Allford 19ded6609d Refactored the MaxMind database class to not use static methods in order to make testing the integration class easier 2020-01-10 02:09:51 -08:00
Christopher Allford bbbfc3bfab Moved the MaxMind geolocation lookup into the integration class 2020-01-09 23:46:25 -08:00
Christopher Allford f91ff82806 Moved the loading of the database class into the integration 2020-01-09 21:29:47 -08:00
Christopher Allford bf057927ae Moved the loading of integration classes into the WC_Autoloader 2020-01-09 15:46:01 -08:00
Christopher Allford 3e597e6f68 Replaced the Geolocation database fetching functionality with MaxMind integration 2020-01-09 00:31:51 -08:00
Christopher Allford f23c26a9f9 Fixed a permissions conflict caused by the dummy GeoLite2 archive's date
The test would fail if the web server had stored the data already!
2020-01-08 22:56:07 -08:00
Christopher Allford 95e59fc777 Made the database service class methods static for convenience \ 2020-01-08 21:59:04 -08:00
Christopher Allford 1eb49ef8b8 Added filterable support for fetching the database path
This replaces the corresponding geolocation class functionality. We are deprecating the woocommerce_geolocation_local_database_path filter in favor of the woocommerce_maxmind_geolocation_databse_path filter. Since we want the option to turn this into a feature plugin, it's wise to make sure nothing is too generic.
2020-01-08 21:48:05 -08:00
Christopher Allford 46d7f16b19 Added support for downloading and extracting the GeoLite2 database 2020-01-08 21:09:35 -08:00
Christopher Allford a477f9367d Added support for creating default integrations 2020-01-08 21:05:14 -08:00
Claudio Sanches 85a077b939 Coupon race condition prevention 2020-01-06 19:44:24 -03:00
Claudio Sanches 2ce4a60ff1
Remove old unit test 2020-01-06 19:37:47 -03:00
Vedanshu Jain d76c5b734c
Merge pull request #25300 from woocommerce/fix/25274-docker-mount-dir
E2E Tests: mount directory instead of copy.
2019-12-26 17:36:14 +05:30
vedanshujain 42dd1bf32b Add an address so that shipping can be calculated 2019-12-26 14:04:52 +05:30
vedanshujain 31726d1a37 Update version numbers 2019-12-26 13:55:43 +05:30
Christopher Allford ac22406763 Fixed the unit tests broken by the requirement that a valid address must be set to calculate shipping rates 2019-12-26 13:55:43 +05:30
Christopher Allford 027257f624 Changed the dummy postal code in the order helper to a valid one 2019-12-26 13:55:42 +05:30
Christopher Allford c54fa91145 Added unit tests for checking whether a package is shippable or not 2019-12-26 13:55:41 +05:30
Christopher Allford e800b40ad6 Made packages with incomplete destinations unshippable 2019-12-26 13:55:41 +05:30
Christopher Allford 874be93c14 Removed the lowercase conversion of product search terms
When searched in a case sensitive manner, the conversion to lowercase causes uppercase matches that would have been found to be lost. This change increases the tolerance of the OR search format while also removing this unintended side-effect.
2019-12-24 15:00:40 -08:00
Jeff Stieler 7c0511baaa Fix typo in docker service name. 2019-12-23 13:14:14 -05:00
Jeff Stieler 5c67310e48
Fix typo in test installation instructions. (#25298) 2019-12-23 11:32:54 -05:00
Rodrigo Primo 487f96d844 Fix WordPress.DateTime.CurrentTimeTimestamp vilations
This commit fixes all violations of the WordPress.DateTime.CurrentTimeTimestamp sniff automatically using phpcbf.
2019-12-20 14:23:05 -03:00
Rodrigo Primo 62d6b05b58 Fix Generic.Formatting.MultipleStatementAlignment violations
This commit fixes all violations of the Generic.Formatting.MultipleStatementAlignment sniff automatically using phpcbf.
2019-12-20 14:21:08 -03:00
Rodrigo Primo 94373f78ea Fix WordPress.Arrays.MultipleStatementAlignment errors automatically using phpcbf 2019-12-20 13:51:26 -03:00
Julia Amosova 8854d0d074 Update comments in `run-e2e-CI.sh` 2019-12-20 00:10:44 +00:00
Julia Amosova 9397565d22 Add max amount of time waiting for the Docker container to be built 2019-12-19 22:48:03 +00:00
vedanshujain ff2a8a58f2 Commented out flaky test 2019-12-17 19:13:19 +05:30
vedanshujain 9b7343d23b Applied coding standards 2019-12-17 19:13:19 +05:30
vedanshujain 53bfcea110 Use same filter for stocks and coupon for consistency. 2019-12-17 19:13:19 +05:30
vedanshujain 72545c44b7 Add support for `_held_for_checkout` records to improve performance.
This will also improve transactional stability and avoid race conditions by providing a way to lock usage counts.
2019-12-17 19:13:19 +05:30
Julia Amosova 1658dd3962 Make setup wizard test more stable 2019-12-15 22:55:39 +00:00
Julia Amosova f9a9fbc2c7 Pass jest exit code to npm 2019-12-15 22:34:35 +00:00
Julia Amosova 88fa2885fc Update jest version 2019-12-15 19:13:28 +00:00
Julia Amosova 4e134f8ec4 Testing Docker build on Travis 2019-12-15 17:54:33 +00:00
Julia Amosova c1b358929b Add page creation & check for Docker container status to run e2e tests 2019-12-15 16:44:40 +00:00
Julia Amosova 5645f5882a Add check for Docker container to be built on Travis when post is created 2019-12-15 16:04:06 +00:00
Julia Amosova 14afe36204 Add check for Docker container to be built on Travis 2019-12-15 15:32:26 +00:00
Julia Amosova 53dcdd77b3 Update Docker + Travis setup 2019-12-15 13:09:29 +00:00
Julia Amosova cff1272b7e Add check for new setup wizard flow & fix ship to different address click 2019-12-11 17:15:37 +00:00
Julia Amosova 90ddb08765 Merge branch 'new/puppeteer-screenshot-tester' into new/front-end-checkout-e2e-test 2019-12-11 14:54:39 +00:00
Julia Amosova 29671dd9ec Resolving conflict with master branch 2019-12-11 14:53:07 +00:00
Julia Amosova 900289c191 Update the way `ship to different address` checkbox is set 2019-12-11 12:27:41 +00:00
Julia Amosova 47ecd75479 Wait for Recommended section elements to be visible in the obw test 2019-12-11 12:18:31 +00:00
Julia Amosova c7d4989f01 Update clicks in obw and checkout tests & productIsInCheckout function 2019-12-11 12:02:44 +00:00
Claudio Sanches 2975b3a7b7 Rate limit feature 2019-12-11 01:38:19 -03:00