Skip to content

Commit fe402e0

Browse files
committed
Tests: Skip Gutenberg plugin activation test on older WP versions.
The purpose of `tests/e2e/specs/gutenberg-plugin.test.js` is to ensure that running the Gutenberg plugin (stable version) on a WordPress `trunk` install doesn't produce any fatals. The test was introduced in [54913], i.e. it has been around since WP 6.2. It makes sense to have it present on older branches, as the Gutenberg plugin not only supports `trunk`, but also the current stable version of WordPress (i.e. currently 6.5), and one version below (6.4). However, it is not expected to work on any earlier versions beyond that; in practice, it has produced errors on some of those. This changeset checks the REST API response from the plugin activation request. If it returns an error with error code `plugin_wp_incompatible`, it skips the test. Reviewed by jorbin. Merges [58046] to the 6.4 branch. Props jorbin, johnbillion, swissspidy. Fixes #60971. git-svn-id: https://develop.svn.wordpress.org/branches/6.4@58153 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 569a379 commit fe402e0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/e2e/specs/gutenberg-plugin.test.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,20 @@ test.describe( 'Gutenberg plugin', () => {
2929

3030
expect( plugin.status ).toBe( 'inactive' );
3131

32-
await requestUtils.activatePlugin( 'gutenberg' );
32+
try {
33+
await requestUtils.activatePlugin( 'gutenberg' );
34+
} catch ( error ) {
35+
if (
36+
typeof error === 'object' &&
37+
error !== null &&
38+
Object.prototype.hasOwnProperty.call( error, 'code' ) &&
39+
error.code === 'plugin_wp_incompatible'
40+
) {
41+
test.skip();
42+
} else {
43+
throw error;
44+
}
45+
}
3346

3447
plugin = await requestUtils.rest( {
3548
path: 'wp/v2/plugins/gutenberg/gutenberg',

0 commit comments

Comments
 (0)