Merge branch 'update/marketplace-1' into update/marketplace-mobile-fixes

This commit is contained in:
And Finally 2021-08-13 12:56:42 +01:00
commit bb48368cdb
5 changed files with 37 additions and 2 deletions

View File

@ -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();
});
});

View File

@ -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

View File

@ -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`
@ -133,7 +134,7 @@ This package provides support for enabling retries in tests:
| `removeFromCart` | `productTitle` | Remove a product from the cart on the cart page |
| `setCartQuantity` | `productTitle, quantityValue` | Change the quantity of a product on the cart page |
| `searchForProduct` | | Searching for a product name and landing on its detail page |
| `emptyCart` | | Removes any products and coupons that are in the cart |
| `emptyCart` | | Removes any products and coupons that are in the cart |
### REST API `withRestApi`

View File

@ -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/utils/README.md",
"repository": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce.git"

View File

@ -380,6 +380,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();
}
},
};