woocommerce/tests/e2e/specs/smoke-tests/update-woocommerce.js

50 lines
1.2 KiB
JavaScript
Raw Normal View History

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
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
const { UPDATE_WC, TEST_RELEASE } = process.env;
2021-07-15 20:39:32 +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 () => {
if ( TEST_RELEASE ) {
zipUrl = await getLatestReleaseZipUrl( 'woocommerce', 'woocommerce' );
} 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
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
});