Merge pull request #30109 from woocommerce/add/install-all-pending-updates
Added flows for updating WP, themes, and plugins
This commit is contained in:
commit
edfd05ecc9
|
@ -3,6 +3,11 @@
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Factories for variable product, variation, and grouped product
|
- Factories for variable product, variation, and grouped product
|
||||||
|
- 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
|
# 0.1.5
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ This package provides support for enabling retries in tests:
|
||||||
|
|
||||||
- `WP_ADMIN_LOGIN` - WordPress login
|
- `WP_ADMIN_LOGIN` - WordPress login
|
||||||
- `WP_ADMIN_DASHBOARD` - WordPress dashboard
|
- `WP_ADMIN_DASHBOARD` - WordPress dashboard
|
||||||
|
- `WP_ADMIN_WP_UPDATES` - WordPress updates
|
||||||
- `WP_ADMIN_PLUGINS` - Plugin list
|
- `WP_ADMIN_PLUGINS` - Plugin list
|
||||||
- `WP_ADMIN_PERMALINK_SETTINGS` - Permalink settings
|
- `WP_ADMIN_PERMALINK_SETTINGS` - Permalink settings
|
||||||
- `WP_ADMIN_ALL_USERS_VIEW` - WordPress user list
|
- `WP_ADMIN_ALL_USERS_VIEW` - WordPress user list
|
||||||
|
@ -102,6 +103,11 @@ This package provides support for enabling retries in tests:
|
||||||
| `openAllUsersView` | | Open the All Users page |
|
| `openAllUsersView` | | Open the All Users page |
|
||||||
| `openImportProducts` | | Open the Import Products page |
|
| `openImportProducts` | | Open the Import Products page |
|
||||||
| `openExtensions` | | Go to WooCommerce -> Extensions |
|
| `openExtensions` | | Go to WooCommerce -> Extensions |
|
||||||
|
| `openWordPressUpdatesPage` | | Go to Dashboard -> Updates |
|
||||||
|
| `installAllUpdates` | | Install all pending updates on Dashboard -> Updates|
|
||||||
|
| `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|
|
||||||
|
|
||||||
### Shopper `shopper`
|
### Shopper `shopper`
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ const baseUrl = config.get( 'url' );
|
||||||
*/
|
*/
|
||||||
export const WP_ADMIN_LOGIN = baseUrl + 'wp-login.php';
|
export const WP_ADMIN_LOGIN = baseUrl + 'wp-login.php';
|
||||||
export const WP_ADMIN_DASHBOARD = baseUrl + 'wp-admin/';
|
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_PLUGINS = WP_ADMIN_DASHBOARD + 'plugins.php';
|
||||||
export const WP_ADMIN_PERMALINK_SETTINGS = WP_ADMIN_DASHBOARD + 'options-permalink.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';
|
export const WP_ADMIN_ALL_USERS_VIEW = WP_ADMIN_DASHBOARD + 'users.php';
|
||||||
|
|
|
@ -6,7 +6,7 @@ const config = require( 'config' );
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
const { clearAndFillInput } = require( '../page-utils' );
|
const { clearAndFillInput, setCheckbox } = require( '../page-utils' );
|
||||||
const {
|
const {
|
||||||
WP_ADMIN_ALL_ORDERS_VIEW,
|
WP_ADMIN_ALL_ORDERS_VIEW,
|
||||||
WP_ADMIN_ALL_PRODUCTS_VIEW,
|
WP_ADMIN_ALL_PRODUCTS_VIEW,
|
||||||
|
@ -25,6 +25,7 @@ const {
|
||||||
WP_ADMIN_ANALYTICS_PAGES,
|
WP_ADMIN_ANALYTICS_PAGES,
|
||||||
WP_ADMIN_ALL_USERS_VIEW,
|
WP_ADMIN_ALL_USERS_VIEW,
|
||||||
WP_ADMIN_IMPORT_PRODUCTS,
|
WP_ADMIN_IMPORT_PRODUCTS,
|
||||||
|
WP_ADMIN_WP_UPDATES,
|
||||||
IS_RETEST_MODE,
|
IS_RETEST_MODE,
|
||||||
} = require( './constants' );
|
} = require( './constants' );
|
||||||
|
|
||||||
|
@ -215,6 +216,67 @@ const merchant = {
|
||||||
waitUntil: 'networkidle0',
|
waitUntil: 'networkidle0',
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the WordPress updates page at Dashboard > Updates.
|
||||||
|
*/
|
||||||
|
openWordPressUpdatesPage: async () => {
|
||||||
|
await page.goto( WP_ADMIN_WP_UPDATES, {
|
||||||
|
waitUntil: 'networkidle0',
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installs all pending updates on the Dashboard > Updates page, including WordPress, plugins, and themes.
|
||||||
|
*/
|
||||||
|
installAllUpdates: async () => {
|
||||||
|
await merchant.updateWordPress();
|
||||||
|
await merchant.updatePlugins();
|
||||||
|
await merchant.updateThemes();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates WordPress if there are any updates available.
|
||||||
|
*/
|
||||||
|
updateWordPress: async () => {
|
||||||
|
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: 1000000 } ),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates all installed plugins if there are updates available.
|
||||||
|
*/
|
||||||
|
updatePlugins: async () => {
|
||||||
|
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' } ),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates all installed themes if there are updates available.
|
||||||
|
*/
|
||||||
|
updateThemes: async () => {
|
||||||
|
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;
|
module.exports = merchant;
|
||||||
|
|
Loading…
Reference in New Issue