From c8fbdf7833a1d8f83d6a2a4b3907f6da6b730e46 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 22 Jan 2025 10:01:13 -0500 Subject: [PATCH 1/7] Update playwright to the latest version. --- package-lock.json | 49 +++++++++++++++++++++++++---------------------- package.json | 2 +- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2a7191f36dda..f52d5267bb949 100644 --- a/package-lock.json +++ b/package-lock.json @@ -103,7 +103,7 @@ }, "devDependencies": { "@lodder/grunt-postcss": "^3.1.1", - "@playwright/test": "1.45.0", + "@playwright/test": "1.49.1", "@pmmmwh/react-refresh-webpack-plugin": "0.5.15", "@wordpress/babel-preset-default": "8.0.1", "@wordpress/dependency-extraction-webpack-plugin": "6.0.2", @@ -3648,12 +3648,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.45.0.tgz", - "integrity": "sha512-TVYsfMlGAaxeUllNkywbwek67Ncf8FRGn8ZlRdO291OL3NjG9oMbfVhyP82HQF0CZLMrYsvesqoUekxdWuF9Qw==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.1.tgz", + "integrity": "sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright": "1.45.0" + "playwright": "1.49.1" }, "bin": { "playwright": "cli.js" @@ -26917,12 +26918,13 @@ } }, "node_modules/playwright": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.45.0.tgz", - "integrity": "sha512-4z3ac3plDfYzGB6r0Q3LF8POPR20Z8D0aXcxbJvmfMgSSq1hkcgvFRXJk9rUq5H/MJ0Ktal869hhOdI/zUTeLA==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz", + "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.45.0" + "playwright-core": "1.49.1" }, "bin": { "playwright": "cli.js" @@ -26935,10 +26937,11 @@ } }, "node_modules/playwright-core": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.45.0.tgz", - "integrity": "sha512-lZmHlFQ0VYSpAs43dRq1/nJ9G/6SiTI7VPqidld9TDefL9tX87bTKExWZZUF5PeRyqtXqd8fQi2qmfIedkwsNQ==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz", + "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", "dev": true, + "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, @@ -36872,12 +36875,12 @@ "dev": true }, "@playwright/test": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.45.0.tgz", - "integrity": "sha512-TVYsfMlGAaxeUllNkywbwek67Ncf8FRGn8ZlRdO291OL3NjG9oMbfVhyP82HQF0CZLMrYsvesqoUekxdWuF9Qw==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.1.tgz", + "integrity": "sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==", "dev": true, "requires": { - "playwright": "1.45.0" + "playwright": "1.49.1" } }, "@pmmmwh/react-refresh-webpack-plugin": { @@ -54380,19 +54383,19 @@ } }, "playwright": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.45.0.tgz", - "integrity": "sha512-4z3ac3plDfYzGB6r0Q3LF8POPR20Z8D0aXcxbJvmfMgSSq1hkcgvFRXJk9rUq5H/MJ0Ktal869hhOdI/zUTeLA==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz", + "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", "dev": true, "requires": { "fsevents": "2.3.2", - "playwright-core": "1.45.0" + "playwright-core": "1.49.1" } }, "playwright-core": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.45.0.tgz", - "integrity": "sha512-lZmHlFQ0VYSpAs43dRq1/nJ9G/6SiTI7VPqidld9TDefL9tX87bTKExWZZUF5PeRyqtXqd8fQi2qmfIedkwsNQ==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz", + "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", "dev": true }, "plur": { diff --git a/package.json b/package.json index df79566806f00..ad8f64c9187cf 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ ], "devDependencies": { "@lodder/grunt-postcss": "^3.1.1", - "@playwright/test": "1.45.0", + "@playwright/test": "1.49.1", "@pmmmwh/react-refresh-webpack-plugin": "0.5.15", "@wordpress/babel-preset-default": "8.0.1", "@wordpress/dependency-extraction-webpack-plugin": "6.0.2", From c0bf7b12028b38f92f192580c0f3d0af484c266b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 22 Jan 2025 10:03:54 -0500 Subject: [PATCH 2/7] Use `1.49.0`. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad8f64c9187cf..8ea54ca01bf45 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ ], "devDependencies": { "@lodder/grunt-postcss": "^3.1.1", - "@playwright/test": "1.49.1", + "@playwright/test": "1.49.0", "@pmmmwh/react-refresh-webpack-plugin": "0.5.15", "@wordpress/babel-preset-default": "8.0.1", "@wordpress/dependency-extraction-webpack-plugin": "6.0.2", From abb846d95c2dd022b8d947f33ce40fb44f92f2f5 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 22 Jan 2025 10:04:28 -0500 Subject: [PATCH 3/7] Use 1.49.1. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ea54ca01bf45..ad8f64c9187cf 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ ], "devDependencies": { "@lodder/grunt-postcss": "^3.1.1", - "@playwright/test": "1.49.0", + "@playwright/test": "1.49.1", "@pmmmwh/react-refresh-webpack-plugin": "0.5.15", "@wordpress/babel-preset-default": "8.0.1", "@wordpress/dependency-extraction-webpack-plugin": "6.0.2", From 229affcb6911cae5f315249e29186f437b9d25b0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 13:41:26 -0400 Subject: [PATCH 4/7] Bckport r60735 --- tests/phpunit/tests/image/editorImagick.php | 5 +++++ tests/phpunit/tests/image/resize.php | 22 +++++++++++++++++++++ tests/phpunit/tests/media.php | 3 +++ 3 files changed, 30 insertions(+) diff --git a/tests/phpunit/tests/image/editorImagick.php b/tests/phpunit/tests/image/editorImagick.php index 30747f69f1b62..956ea0772d7a8 100644 --- a/tests/phpunit/tests/image/editorImagick.php +++ b/tests/phpunit/tests/image/editorImagick.php @@ -656,6 +656,11 @@ public function test_remove_pdf_alpha_channel_should_remove_the_alpha_channel_in $this->markTestSkipped( 'Rendering PDFs is not supported on this system.' ); } + $version = Imagick::getVersion(); + if ( $version['versionNumber'] < 0x675 ) { + $this->markTestSkipped( 'The version of ImageMagick does not support removing alpha channels from PDFs.' ); + } + $test_file = DIR_TESTDATA . '/images/test-alpha.pdf'; $attachment_id = $this->factory->attachment->create_upload_object( $test_file ); $this->assertNotEmpty( $attachment_id, 'The attachment was not created before testing.' ); diff --git a/tests/phpunit/tests/image/resize.php b/tests/phpunit/tests/image/resize.php index e82dd3d2e6b2a..1f78d5a9fc9ca 100644 --- a/tests/phpunit/tests/image/resize.php +++ b/tests/phpunit/tests/image/resize.php @@ -23,6 +23,8 @@ public function wp_image_editors() { public function test_resize_jpg() { $image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 25, 25 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -78,6 +80,8 @@ public function test_resize_webp() { $image = $this->resize_helper( $file, 25, 25 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = wp_getimagesize( $image ); unlink( $image ); @@ -92,6 +96,10 @@ public function test_resize_webp() { * Test resizing AVIF image. * * @ticket 51228 + * + * Temporarily disabled until we can figure out why it fails on the Trixie based PHP container. + * See https://core.trac.wordpress.org/ticket/63932. + * @requires PHP < 8.3 */ public function test_resize_avif() { $file = DIR_TESTDATA . '/images/avif-lossy.avif'; @@ -104,6 +112,8 @@ public function test_resize_avif() { $image = $this->resize_helper( $file, 25, 25 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = wp_getimagesize( $image ); unlink( $image ); @@ -125,6 +135,8 @@ public function test_resize_larger() { public function test_resize_thumb_128x96() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 96 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -138,6 +150,8 @@ public function test_resize_thumb_128x96() { public function test_resize_thumb_128x0() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 0 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -151,6 +165,8 @@ public function test_resize_thumb_128x0() { public function test_resize_thumb_0x96() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 0, 96 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -164,6 +180,8 @@ public function test_resize_thumb_0x96() { public function test_resize_thumb_150x150_crop() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 150, true ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -190,6 +208,8 @@ public function test_resize_thumb_150x100_crop() { public function test_resize_thumb_50x150_crop() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 50, 150, true ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -214,6 +234,8 @@ public function test_resize_non_existent_image() { /** * Function to help out the tests + * + * @return string|WP_Error The path to the resized image file or a WP_Error on failure. */ protected function resize_helper( $file, $width, $height, $crop = false ) { $editor = wp_get_image_editor( $file ); diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index b58fc7353b5fa..75c39fcc14246 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -5310,6 +5310,9 @@ public function test_quality_with_image_conversion_file_sizes() { // Sub-sizes: for each size, the JPEGs should be smaller than the WebP. $sizes_to_compare = array_intersect_key( $jpeg_sizes['sizes'], $webp_sizes['sizes'] ); + + $this->assertNotWPError( $sizes_to_compare ); + foreach ( $sizes_to_compare as $size => $size_data ) { $this->assertLessThan( $webp_sizes['sizes'][ $size ]['filesize'], $jpeg_sizes['sizes'][ $size ]['filesize'] ); } From 4d8420dae3dd60d2687679c5115bbe742bb0cd65 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 13:42:27 -0400 Subject: [PATCH 5/7] Pin importer tests to specific version --- tools/local-env/scripts/install.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 7bc2915fd44b7..cc16075b02031 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -57,6 +57,11 @@ function wp_cli( cmd ) { function install_wp_importer() { const testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer'; + + // The final version of the WordPress Importer plugin with support for PHP < 7.2 is 0.9.0. + const phpVersion = parseFloat(process.env.LOCAL_PHP.split('-')[0]); + const branchFlag = phpVersion < 7.2 ? '--branch 0.9.0' : ''; + execSync( `docker compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } ); - execSync( `docker compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); + execSync( `docker compose exec -T php git clone ${branchFlag} https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); } From a2deb46042cb86065f1b0bf2f5b9b82ae7c26ac8 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 13:44:26 -0400 Subject: [PATCH 6/7] Pass `--defaults` to WP CLI --- tools/local-env/scripts/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index cc16075b02031..6f19b5db976b2 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -37,7 +37,7 @@ writeFileSync( 'wp-tests-config.php', testConfig ); // Once the site is available, install WordPress! wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } ) .then( () => { - wp_cli( 'db reset --yes' ); + wp_cli( 'db reset --yes --defaults' ); const installCommand = process.env.LOCAL_MULTISITE === 'true' ? 'multisite-install' : 'install'; wp_cli( `core ${ installCommand } --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` ); } ); From 1b91bbb5f128ad576284c7483ddb3d69566583f0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 14:48:46 -0400 Subject: [PATCH 7/7] The 6.6 branch does not support PHP < 7.2. --- tools/local-env/scripts/install.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 6f19b5db976b2..c03e930dbac83 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -57,11 +57,6 @@ function wp_cli( cmd ) { function install_wp_importer() { const testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer'; - - // The final version of the WordPress Importer plugin with support for PHP < 7.2 is 0.9.0. - const phpVersion = parseFloat(process.env.LOCAL_PHP.split('-')[0]); - const branchFlag = phpVersion < 7.2 ? '--branch 0.9.0' : ''; - execSync( `docker compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } ); - execSync( `docker compose exec -T php git clone ${branchFlag} https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); + execSync( `docker compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); }