2021-07-15 20:39:32 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-07-20 21:26:51 +00:00
|
|
|
const { merchant, utils } = require( '@woocommerce/e2e-utils' );
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-08-11 02:29:36 +00:00
|
|
|
const { getRemotePluginZip, getLatestReleaseZipUrl } = require( '@woocommerce/e2e-environment' );
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-07-20 21:26:51 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
const {
|
|
|
|
it,
|
|
|
|
beforeAll,
|
|
|
|
} = require( '@jest/globals' );
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-08-11 02:29:36 +00:00
|
|
|
const { UPDATE_WC, TEST_RELEASE } = process.env;
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-08-11 02:29:36 +00:00
|
|
|
let zipUrl;
|
2021-07-20 21:26:51 +00:00
|
|
|
const pluginName = 'WooCommerce';
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-07-20 21:26:51 +00:00
|
|
|
let pluginPath;
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-07-20 21:26:51 +00:00
|
|
|
utils.describeIf( UPDATE_WC )( 'WooCommerce plugin can be uploaded and activated', () => {
|
|
|
|
beforeAll( async () => {
|
2021-08-11 02:29:36 +00:00
|
|
|
|
|
|
|
if ( TEST_RELEASE ) {
|
2021-08-24 22:44:06 +00:00
|
|
|
zipUrl = await getLatestReleaseZipUrl( 'woocommerce', 'woocommerce' );
|
2021-08-11 02:29:36 +00:00
|
|
|
} else {
|
|
|
|
zipUrl = 'https://github.com/woocommerce/woocommerce/releases/download/nightly/woocommerce-trunk-nightly.zip';
|
|
|
|
}
|
|
|
|
|
|
|
|
pluginPath = await getRemotePluginZip( zipUrl );
|
2021-07-20 21:26:51 +00:00
|
|
|
await merchant.login();
|
|
|
|
});
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-07-20 21:26:51 +00:00
|
|
|
afterAll( async () => {
|
|
|
|
await merchant.logout();
|
|
|
|
});
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-07-20 21:26:51 +00:00
|
|
|
it( 'can upload and activate the WooCommerce plugin', async () => {
|
|
|
|
await merchant.uploadAndActivatePlugin( pluginPath, pluginName );
|
|
|
|
});
|
2021-07-15 20:39:32 +00:00
|
|
|
|
2021-08-02 17:11:49 +00:00
|
|
|
it( 'can run the database update', async () => {
|
|
|
|
// Check for, and run, the database upgrade if needed
|
|
|
|
await merchant.runDatabaseUpdate();
|
|
|
|
});
|
|
|
|
|
2021-07-20 21:26:51 +00:00
|
|
|
});
|