Added flows for updating WP, themes, and plugins
This commit is contained in:
parent
f3c9be0492
commit
372064c49f
|
@ -1,5 +1,11 @@
|
|||
# Unreleased
|
||||
|
||||
- Added new constant for WordPress update page `WP_ADMIN_WP_UPDATES`
|
||||
- Added new merchant flow for `openWordPressUpdatesPage()`
|
||||
- Added new merchant flows:
|
||||
- `openWordPressUpdatesPage()`
|
||||
- `installAllUpdates()`
|
||||
|
||||
# 0.1.5
|
||||
|
||||
## Added
|
||||
|
|
|
@ -44,6 +44,7 @@ This package provides support for enabling retries in tests:
|
|||
|
||||
- `WP_ADMIN_LOGIN` - WordPress login
|
||||
- `WP_ADMIN_DASHBOARD` - WordPress dashboard
|
||||
- `WP_ADMIN_WP_UPDATES` - WordPress updates
|
||||
- `WP_ADMIN_PLUGINS` - Plugin list
|
||||
- `WP_ADMIN_PERMALINK_SETTINGS` - Permalink settings
|
||||
- `WP_ADMIN_ALL_USERS_VIEW` - WordPress user list
|
||||
|
@ -102,6 +103,8 @@ This package provides support for enabling retries in tests:
|
|||
| `openAllUsersView` | | Open the All Users page |
|
||||
| `openImportProducts` | | Open the Import Products page |
|
||||
| `openExtensions` | | Go to WooCommerce -> Extensions |
|
||||
| `openWordPressUpdatesPage` | | Go to Dashboard -> Updates |
|
||||
| `installAllUpdates` | `updateWordPress`, `updatePlugins`, `updateThemes` | Install all pending updates on Dashboard -> Updates|
|
||||
|
||||
### Shopper `shopper`
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ const baseUrl = config.get( 'url' );
|
|||
*/
|
||||
export const WP_ADMIN_LOGIN = baseUrl + 'wp-login.php';
|
||||
export const WP_ADMIN_DASHBOARD = baseUrl + 'wp-admin/';
|
||||
export const WP_ADMIN_WP_UPDATES = WP_ADMIN_DASHBOARD + 'update-core.php';
|
||||
export const WP_ADMIN_PLUGINS = WP_ADMIN_DASHBOARD + 'plugins.php';
|
||||
export const WP_ADMIN_PERMALINK_SETTINGS = WP_ADMIN_DASHBOARD + 'options-permalink.php';
|
||||
export const WP_ADMIN_ALL_USERS_VIEW = WP_ADMIN_DASHBOARD + 'users.php';
|
||||
|
|
|
@ -6,7 +6,7 @@ const config = require( 'config' );
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
const { clearAndFillInput } = require( '../page-utils' );
|
||||
const { clearAndFillInput, setCheckbox } = require( '../page-utils' );
|
||||
const {
|
||||
WP_ADMIN_ALL_ORDERS_VIEW,
|
||||
WP_ADMIN_ALL_PRODUCTS_VIEW,
|
||||
|
@ -25,6 +25,7 @@ const {
|
|||
WP_ADMIN_ANALYTICS_PAGES,
|
||||
WP_ADMIN_ALL_USERS_VIEW,
|
||||
WP_ADMIN_IMPORT_PRODUCTS,
|
||||
WP_ADMIN_WP_UPDATES,
|
||||
IS_RETEST_MODE,
|
||||
} = require( './constants' );
|
||||
|
||||
|
@ -210,11 +211,53 @@ const merchant = {
|
|||
} );
|
||||
},
|
||||
|
||||
openImportProducts: async () => {
|
||||
openImportProducts: async () => {
|
||||
await page.goto( WP_ADMIN_IMPORT_PRODUCTS , {
|
||||
waitUntil: 'networkidle0',
|
||||
} );
|
||||
},
|
||||
|
||||
openWordPressUpdatesPage: async () => {
|
||||
await page.goto( WP_ADMIN_WP_UPDATES, {
|
||||
waitUntil: 'networkidle0',
|
||||
} );
|
||||
},
|
||||
|
||||
installAllUpdates: async ( updateWordPress = true, updatePlugins = true, updateThemes = true ) => {
|
||||
if ( updateWordPress ) {
|
||||
await merchant.openWordPressUpdatesPage();
|
||||
if ( null !== await page.$( 'form[action="update-core.php?action=do-core-upgrade"][name="upgrade"]' ) ) {
|
||||
await Promise.all([
|
||||
expect( page ).toClick( 'input.button-primary' ),
|
||||
|
||||
// The WordPress update can take some time, so setting a longer timeout here
|
||||
page.waitForNavigation( { waitUntil: 'networkidle0', timeout: 100000 } ),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if ( updatePlugins ) {
|
||||
await merchant.openWordPressUpdatesPage();
|
||||
if ( null !== await page.$( 'form[action="update-core.php?action=do-plugin-upgrade"][name="upgrade-plugins"]' ) ) {
|
||||
await setCheckbox( '#plugins-select-all' );
|
||||
await Promise.all([
|
||||
expect( page ).toClick( '#upgrade-plugins' ),
|
||||
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if ( updateThemes ) {
|
||||
await merchant.openWordPressUpdatesPage();
|
||||
if (null !== await page.$( 'form[action="update-core.php?action=do-theme-upgrade"][name="upgrade-themes"]' )) {
|
||||
await setCheckbox( '#themes-select-all' );
|
||||
await Promise.all([
|
||||
expect( page ).toClick( '#upgrade-themes' ),
|
||||
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
|
||||
]);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = merchant;
|
||||
|
|
Loading…
Reference in New Issue