WP test suite starts a transaction when the test starts and roll it back when the test finishes. So it is not necessary to undo database changes using tearDown().
This commit adds the composer package jdgrimes/wp-http-testcase directly to this repository instead of via composer. Doing this because I couldn't find a way to make this package work on Travis build jobs running older versions of PHP and I don't think it is worth investing much time on it.
This commit changes the WC_Tests_Product_CSV_Importer class to use artificial HTTP responses instead of performing real HTTP requests to a external server to get the images of the imported products. On my local machine, this change reduced the test execution time from 3257ms to 831ms.
As a consequence of this change, this commit also fixes WC_Tests_Product_CSV_Importer::test_import() in all Travis builds. This test has been failing for a few weeks on Travis but not on our local environments. After some debugging, I found out that the test was failing on Travis because of the following error when `wp_safe_remote_get()` was called to get images for the imported products:
```
Error getting remote image http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_1_front.jpg. Error: cURL error 35: gnutls_handshake() failed: Handshake failed.
```
Apparently, the PHP binary that is used by Travis is unable to handle the TLS handshake (see https://github.com/travis-ci/travis-ci/issues/6339) and the test probably started failing when demo.woothemes.com (which is used to download the images for the imported products) switched from HTTP to HTTPS.
This will skip the uploading of screenshots if the S3 key is not present. This will happen when there is a PR for a fork submitted.
* Skip upload from forks
* trying with failing test
* Fixing tests
* need a rebuild
This commit adds a check before the code that uploads screenshots of failed e2e tests to make it run only if running the Travis build job that executed the tests and if the screenshots/ directory is not empty. There is no need to always download Travis artifacts and try to upload to S3 if there is nothing to upload.
This adds screenshots for broken e2e tests. The screenshots will also be uploaded to an Amazon S3 instance from Travis CI so they can be viewed. If run locally, there will be a screenshots directory created where they can be viewed
If there is a failed e2e test you'll see a block under `travis.sh after` in the build log in Travis CI that will give the URLs for the images.
* Adding screenshot capabilities to all tests
* trying screenshots on S3
* try to get a failed test
* finding the right path
* fixing yml
* only taking failed screenshots
* fixing yml
* moving paths to env
* fixing target
* try without artifact target
* fixing test
* setting back temporary changes
* fixing spacing
* unneeded change
* trying different uploader
* Force a failed test
* fixing test again
* fixing unneeded change
* updating git ignore
[According to the WooCommerce wiki](https://github.com/woocommerce/woocommerce/wiki/Order-and-Order-Line-Item-Data) and `WC_REST_Orders_Controller`, WooCommerce stores country codes using the ISO 3166-1 alpha-2 (2 character) standard. However, the `WC_Tests_Order_Functions::test_wc_get_order_address_params()` test method was using 'USA' instead of 'US'.