Merge branch 'trunk' of github.com:woocommerce/woocommerce into fix/e2e-calc-shipping-tests
This commit is contained in:
commit
f30a661921
|
@ -40,6 +40,7 @@ jobs:
|
|||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
run: |
|
||||
npx wc-e2e test:e2e ./tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||
npx wc-e2e test:e2e
|
||||
|
|
|
@ -41,6 +41,7 @@ jobs:
|
|||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
TEST_RELEASE: 1
|
||||
UPDATE_WC: 1
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
run: |
|
||||
npx wc-e2e test:e2e ./tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||
npx wc-e2e test:e2e
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* Dev - Apply `woocommerce_logout_default_redirect_url` filter to logout for custom endpoint. #29967
|
||||
* Dev - Added new `woocommerce_email_sent` hook. #30123
|
||||
|
||||
**WooCommerce Admin - 2.5.0**
|
||||
**WooCommerce Admin - 2.5.0 & 2.5.1**
|
||||
|
||||
- Add - Add a delete option to completed tasks #7300
|
||||
- Add - Add unit tests around extended payment gateway controller #7133
|
||||
|
@ -79,6 +79,7 @@
|
|||
- Fix - Fix analytics overview re-arrangement on initial load. #7475
|
||||
- Fix - Fixes action button mis-alignment within card footer. #7412
|
||||
- Fix - Fix up onboarding profiler not working when opted out of tracking
|
||||
- Fix - Fix blank screen by setting a default value #7506
|
||||
- Tweak - Remove performance indicators when Analytics Flag disabled #7234
|
||||
- Tweak - Change event name when installing Google Listings and Ads. #7276
|
||||
- Tweak - Removed unused feature flags #7233 and #7273
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"pelago/emogrifier": "3.1.0",
|
||||
"psr/container": "1.0.0",
|
||||
"woocommerce/action-scheduler": "3.2.1",
|
||||
"woocommerce/woocommerce-admin": "2.5.0",
|
||||
"woocommerce/woocommerce-admin": "2.5.1",
|
||||
"woocommerce/woocommerce-blocks": "5.5.1"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "190546c0839729dcc8e8c9eb8268455e",
|
||||
"content-hash": "590e758559a0186574872d553d58c329",
|
||||
"packages": [
|
||||
{
|
||||
"name": "automattic/jetpack-autoloader",
|
||||
|
@ -532,16 +532,16 @@
|
|||
},
|
||||
{
|
||||
"name": "woocommerce/woocommerce-admin",
|
||||
"version": "2.5.0",
|
||||
"version": "2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/woocommerce/woocommerce-admin.git",
|
||||
"reference": "99a0bd3a48bf33a054efd3b0df29bf42766761f8"
|
||||
"reference": "093d698d770f49d41df8abe89a716dc897bb9e96"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/99a0bd3a48bf33a054efd3b0df29bf42766761f8",
|
||||
"reference": "99a0bd3a48bf33a054efd3b0df29bf42766761f8",
|
||||
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/093d698d770f49d41df8abe89a716dc897bb9e96",
|
||||
"reference": "093d698d770f49d41df8abe89a716dc897bb9e96",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -596,9 +596,9 @@
|
|||
"homepage": "https://github.com/woocommerce/woocommerce-admin",
|
||||
"support": {
|
||||
"issues": "https://github.com/woocommerce/woocommerce-admin/issues",
|
||||
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v2.5.0"
|
||||
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v2.5.1"
|
||||
},
|
||||
"time": "2021-08-09T21:00:32+00:00"
|
||||
"time": "2021-08-16T14:31:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "woocommerce/woocommerce-blocks",
|
||||
|
|
|
@ -226,7 +226,7 @@ final class WC_Cart_Totals {
|
|||
$item->taxable = 'taxable' === $cart_item['data']->get_tax_status();
|
||||
$item->price_includes_tax = wc_prices_include_tax();
|
||||
$item->quantity = $cart_item['quantity'];
|
||||
$item->price = wc_add_number_precision_deep( $cart_item['data']->get_price() * $cart_item['quantity'] );
|
||||
$item->price = wc_add_number_precision_deep( (float) $cart_item['data']->get_price() * (float) $cart_item['quantity'] );
|
||||
$item->product = $cart_item['data'];
|
||||
$item->tax_rates = $this->get_item_tax_rates( $item );
|
||||
$this->items[ $cart_item_key ] = $item;
|
||||
|
|
|
@ -84,7 +84,7 @@ class WC_Discounts {
|
|||
$item->object = $cart_item;
|
||||
$item->product = $cart_item['data'];
|
||||
$item->quantity = $cart_item['quantity'];
|
||||
$item->price = wc_add_number_precision_deep( $item->product->get_price() * $item->quantity );
|
||||
$item->price = wc_add_number_precision_deep( (float) $item->product->get_price() * (float) $item->quantity );
|
||||
$this->items[ $key ] = $item;
|
||||
}
|
||||
|
||||
|
|
|
@ -3532,9 +3532,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true
|
||||
},
|
||||
"performance-now": {
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
const config = require('config');
|
||||
const { HTTPClientFactory } = require('@woocommerce/api');
|
||||
const { addConsoleSuppression, updateReadyPageStatus } = require( '@woocommerce/e2e-environment' );
|
||||
const { DEFAULT_TIMEOUT_OVERRIDE } = process.env;
|
||||
|
||||
// @todo: remove this once https://github.com/woocommerce/woocommerce-admin/issues/6992 has been addressed
|
||||
addConsoleSuppression( 'woocommerce_shared_settings' );
|
||||
|
@ -38,6 +39,12 @@ async function trashExistingPosts() {
|
|||
// other posts/comments/etc. aren't dirtying tests and tests don't depend on
|
||||
// each other's side-effects.
|
||||
beforeAll(async () => {
|
||||
|
||||
if ( DEFAULT_TIMEOUT_OVERRIDE ) {
|
||||
page.setDefaultNavigationTimeout( DEFAULT_TIMEOUT_OVERRIDE );
|
||||
page.setDefaultTimeout( DEFAULT_TIMEOUT_OVERRIDE );
|
||||
}
|
||||
|
||||
// Update the ready page to prevent concurrent test runs
|
||||
await updateReadyPageStatus('draft');
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
# Unreleased
|
||||
|
||||
- `updateReadyPageStatus` utility to update the status of the ready page
|
||||
- Added plugin upload functionality util that provides a method to pull a plugin zip from a remote location
|
||||
- `updateReadyPageStatus` utility to update the status of the ready page.
|
||||
- Added plugin upload functionality util that provides a method to pull a plugin zip from a remote location:
|
||||
- `getRemotePluginZip( fileUrl )` to get the remote zip. Returns the filepath of the zip location.
|
||||
- Added plugin zip utility functions:
|
||||
- `checkNestedZip( zipFilePath, savePath )` checks a plugin zip file for any nested zip files. If one is found, it is extracted. Returns the path where the zip file is located.
|
||||
- `downloadZip( fileUrl, downloadPath )` downloads a plugin zip file from a remote location to the provided path.
|
||||
- Added `getLatestReleaseZipUrl( owner, repository, getPrerelease, perPage )` util function to get the latest release zip from a GitHub repository
|
||||
- Added `getLatestReleaseZipUrl( owner, repository, getPrerelease, perPage )` util function to get the latest release zip from a GitHub repository.
|
||||
- Added `DEFAULT_TIMEOUT_OVERRIDE` that allows passing in a time in milliseconds to override the default Jest and Puppeteer timeouts.
|
||||
|
||||
# 0.2.2
|
||||
|
||||
|
|
|
@ -87,6 +87,21 @@ await takeScreenshotFor( 'name of current step' );
|
|||
|
||||
Screenshots will be saved to `tests/e2e/screenshots`. This folder is cleared at the beginning of each test run.
|
||||
|
||||
### Override default test timeout
|
||||
|
||||
To override the default timeout for the tests, you can use the `DEFAULT_TIMEOUT_OVERRIDE` flag and pass in a maximum timeout in milliseconds. For example, you can pass it in when running the tests from the command line:
|
||||
|
||||
```bash
|
||||
DEFAULT_TIMEOUT_OVERRIDE=35000 npx wc-e2e test:e2e
|
||||
```
|
||||
|
||||
This value will override the default Jest timeout as well as pass the timeout to the following Puppeteer methods:
|
||||
|
||||
* page.setDefaultTimeout();
|
||||
* page.setDefaultNavigationTimeout();
|
||||
|
||||
For a list of the methods that the above timeout affects, please see the Puppeteer documentation for [`page.setDefaultTimeout()`](https://pptr.dev/#?product=Puppeteer&version=v10.2.0&show=api-pagesetdefaulttimeouttimeout) and [`page.setDefaultNavigationTimeout`](https://pptr.dev/#?product=Puppeteer&version=v10.2.0&show=api-pagesetdefaultnavigationtimeouttimeout) for more information.
|
||||
|
||||
### Jest Puppeteer Config
|
||||
|
||||
The test sequencer uses the following default Puppeteer configuration:
|
||||
|
|
|
@ -5,7 +5,7 @@ const program = require( 'commander' );
|
|||
const path = require( 'path' );
|
||||
const fs = require( 'fs' );
|
||||
const { getAppRoot } = require( '../utils' );
|
||||
const { WC_E2E_SCREENSHOTS, JEST_PUPPETEER_CONFIG } = process.env;
|
||||
const { WC_E2E_SCREENSHOTS, JEST_PUPPETEER_CONFIG, DEFAULT_TIMEOUT_OVERRIDE } = process.env;
|
||||
|
||||
program
|
||||
.usage( '<file ...> [options]' )
|
||||
|
@ -43,6 +43,10 @@ let testEnvVars = {
|
|||
jest_test_timeout: program.dev ? 120000 : 30000,
|
||||
};
|
||||
|
||||
if ( DEFAULT_TIMEOUT_OVERRIDE ) {
|
||||
testEnvVars.jest_test_timeout = DEFAULT_TIMEOUT_OVERRIDE;
|
||||
}
|
||||
|
||||
if ( ! JEST_PUPPETEER_CONFIG ) {
|
||||
// Use local Puppeteer config if there is one.
|
||||
// Load test configuration file into an object.
|
||||
|
|
|
@ -41,4 +41,9 @@ utils.describeIf( UPDATE_WC )( 'WooCommerce plugin can be uploaded and activated
|
|||
await merchant.uploadAndActivatePlugin( pluginPath, pluginName );
|
||||
});
|
||||
|
||||
it( 'can run the database update', async () => {
|
||||
// Check for, and run, the database upgrade if needed
|
||||
await merchant.runDatabaseUpdate();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
- Added `describeIf()` to conditionally run a test suite
|
||||
- Added `itIf()` to conditionally run a test case.
|
||||
- Added merchant workflows around plugins: `uploadAndActivatePlugin()`, `activatePlugin()`, `deactivatePlugin()`, `deletePlugin()`
|
||||
- Added merchant workflows checking for a database update and performing the update if needed: `runDatabaseUpdate()`
|
||||
- Added `deleteAllOrders()` that goes through and deletes all orders
|
||||
- Added `deleteAllShippingClasses()` which permanently deletes all shipping classes using the API
|
||||
- Added `statuses` optional parameter to `deleteAllRepositoryObjects()` to delete on specific statuses
|
||||
|
|
|
@ -109,6 +109,7 @@ This package provides support for enabling retries in tests:
|
|||
| `updateWordPress` | | Install pending WordPress updates on Dashboard -> Updates|
|
||||
| `updatePlugins` | | Install all pending plugin updates on Dashboard -> Updates|
|
||||
| `updateThemes` | | Install all pending theme updates on Dashboard -> Updates|
|
||||
| `runDatabaseUpdate` || Runs the database update if needed |
|
||||
|
||||
### Shopper `shopper`
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "@woocommerce/e2e-utils",
|
||||
"version": "0.1.5",
|
||||
"description": "End-To-End (E2E) test utils for WooCommerce",
|
||||
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/tests/e2e-utils/README.md",
|
||||
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/tests/e2e/utils/README.md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/woocommerce/woocommerce.git"
|
||||
|
|
|
@ -373,6 +373,34 @@ const merchant = {
|
|||
|
||||
// Wait for Ajax calls to finish
|
||||
await page.waitForResponse( response => response.status() === 200 );
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs the database update if needed. For example, after uploading the WooCommerce plugin or updating WooCommerce.
|
||||
*/
|
||||
runDatabaseUpdate: async () => {
|
||||
if ( await page.$( '.updated.woocommerce-message.wc-connect' ) !== null ) {
|
||||
await expect( page ).toMatchElement( 'a.wc-update-now', { text: 'Update WooCommerce Database' } );
|
||||
await expect( page ).toClick( 'a.wc-update-now' );
|
||||
await page.waitForNavigation( { waitUntil: 'networkidle0' } );
|
||||
await merchant.checkDatabaseUpdateComplete();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the database update is complete, if not, refresh the page until it is.
|
||||
*/
|
||||
checkDatabaseUpdateComplete: async () => {
|
||||
await page.reload( { waitUntil: [ 'networkidle0', 'domcontentloaded'] } );
|
||||
|
||||
const thanksButtonSelector = 'a.components-button.is-primary';
|
||||
|
||||
if ( await page.$( thanksButtonSelector ) !== null ) {
|
||||
await expect( page ).toMatchElement( thanksButtonSelector, { text: 'Thanks!' } );
|
||||
await expect( page ).toClick( thanksButtonSelector );
|
||||
} else {
|
||||
await merchant.checkDatabaseUpdateComplete();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue