diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
index 59c8dc0..b328f2b 100644
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -17,11 +17,11 @@ jobs:
include:
- { wp: 46, php: 56 }
- { wp: 46, php: 70 }
- - { wp: 57, php: 73 }
- { wp: 60, php: 74 }
- { wp: 63, php: 80 }
- { wp: 67, php: 82 }
- { wp: 69, php: 83 }
+ - { wp: 70, php: 84 }
steps:
- name: Checkout code
uses: actions/checkout@v4
diff --git a/bin/run-mocks b/bin/run-mocks
index 3aef15f..d9b61a3 100755
--- a/bin/run-mocks
+++ b/bin/run-mocks
@@ -5,12 +5,6 @@ port="$1"
docker compose -f config/mocks.docker-compose.yml up -d --wait
-mv src/vendor/tinify/Tinify/Client.php src/vendor/tinify/Tinify/Client.php.bak
-cp test/fixtures/Client.php src/vendor/tinify/Tinify/Client.php
-
-mv src/config/class-tiny-config.php src/config/class-tiny-config.php.bak
-cp test/fixtures/class-tiny-config.php src/config/class-tiny-config.php
-
echo "Replacing configuration files..."
mv src/vendor/tinify/Tinify/Client.php src/vendor/tinify/Tinify/Client.php.bak
cp test/fixtures/Client.php src/vendor/tinify/Tinify/Client.php
diff --git a/config/wp-version.conf b/config/wp-version.conf
index df12d54..ef58595 100644
--- a/config/wp-version.conf
+++ b/config/wp-version.conf
@@ -5,4 +5,5 @@
60_74=wordpress:6.0-php7.4-apache
63_80=wordpress:6.3-php8.0-apache
67_82=wordpress:6.7-php8.2-apache
-69_83=wordpress:6.9-php8.3-apache
\ No newline at end of file
+69_83=wordpress:6.9-php8.3-apache
+70_84=wordpress:beta-7.0-RC2-php8.4-apache
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
index 07d91c9..7c7c5fe 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@ Contributors: TinyPNG
Donate link: https://tinypng.com/
Tags: compress images, compression, image size, page speed, performance
Requires at least: 4.0
-Tested up to: 6.9
+Tested up to: 7.0
Stable tag: 3.6.13
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
diff --git a/test/fixtures/Client.php b/test/fixtures/Client.php
index 579f819..cca4e3e 100644
--- a/test/fixtures/Client.php
+++ b/test/fixtures/Client.php
@@ -19,7 +19,6 @@ private static function caBundle() {
function __construct( $key, $appIdentifier = null ) {
$userAgent = join( ' ', array_filter( array( self::userAgent(), $appIdentifier ) ) );
$this->options = array(
- CURLOPT_BINARYTRANSFER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_USERPWD => $key ? ('api:' . $key) : null,
diff --git a/test/integration/compression.spec.ts b/test/integration/compression.spec.ts
index 711ef28..98152b8 100644
--- a/test/integration/compression.spec.ts
+++ b/test/integration/compression.spec.ts
@@ -8,8 +8,8 @@ test.describe.configure({ mode: 'serial' });
let page: Page;
let WPVersion = 0;
-function viewImage(page: Page, file: string) {
- page.getByLabel(`“${file}” (Edit)`).click();
+function viewImage(page: Page, attachmentID: string) {
+ return page.goto(`/wp-admin/post.php?post=${attachmentID}&action=edit`);
}
test.describe('compression', () => {
@@ -112,9 +112,9 @@ test.describe('compression', () => {
await setCompressionTiming(page, 'auto');
await enableCompressionSizes(page, ['medium', 'large']);
- await uploadMedia(page, 'input-example.jpg');
+ const { attachmentID } = await uploadMedia(page, 'input-example.jpg');
- await viewImage(page, 'input-example');
+ await viewImage(page, attachmentID);
// thickbox is used to show modal window so wait until it is loaded
await page.waitForLoadState('networkidle');
@@ -145,7 +145,7 @@ test.describe('compression', () => {
await setCompressionTiming(page, 'manual');
await enableCompressionSizes(page, ['medium', 'large']);
await setAPIKey(page, 'JPG123');
-
+
await uploadMedia(page, 'input-example.jpg');
await page.goto('/wp-admin/upload.php');
@@ -176,11 +176,10 @@ test.describe('compression', () => {
await setAPIKey(page, 'JPG123');
await setCompressionTiming(page, 'auto');
await enableCompressionSizes(page, ['medium']);
- await uploadMedia(page, 'input-example.jpg');
+ const { attachmentID } = await uploadMedia(page, 'input-example.jpg');
await enableCompressionSizes(page, ['medium', 'thumbnail']);
- await page.goto('/wp-admin/upload.php');
- await viewImage(page, 'input-example');
+ await viewImage(page, attachmentID);
await expect(page.getByText('1 size compressed')).toBeVisible();
await expect(page.getByText('1 size to be compressed')).toBeVisible();
@@ -242,6 +241,7 @@ test.describe('compression', () => {
preserveCopyright: false,
preserveGPS: false,
});
+
await uploadMedia(page, 'input-example.jpg');
await page.goto('/wp-admin/upload.php');
@@ -266,10 +266,9 @@ test.describe('compression', () => {
preserveGPS: false,
});
- await uploadMedia(page, 'input-example.jpg');
+ const { attachmentID } = await uploadMedia(page, 'input-example.jpg');
- await page.goto('/wp-admin/upload.php');
- await viewImage(page, 'input-example');
+ await viewImage(page, attachmentID);
const dimensionText = await page.locator('.misc-pub-section.misc-pub-dimensions').textContent();
const shouldMatch = /.*300\s*(x|×|by)\s*200.*/;
@@ -311,10 +310,9 @@ test.describe('compression', () => {
preserveGPS: false,
});
- await uploadMedia(page, 'input-example.jpg');
+ const { attachmentID } = await uploadMedia(page, 'input-example.jpg');
- await page.goto('/wp-admin/upload.php');
- await viewImage(page, 'input-example');
+ await viewImage(page, attachmentID);
const dimensionText = await page.locator('.misc-pub-section.misc-pub-dimensions').textContent();
const shouldMatch = /.*300\s*(x|×|by)\s*200.*/;
@@ -358,10 +356,8 @@ test.describe('compression', () => {
preserveGPS: false,
});
- await uploadMedia(page, 'input-example.jpg');
-
- await page.goto('/wp-admin/upload.php');
- await viewImage(page, 'input-example');
+ const { attachmentID } = await uploadMedia(page, 'input-example.jpg');
+ await viewImage(page, attachmentID);
const dimensionText = await page.locator('.misc-pub-section.misc-pub-dimensions').textContent();
const shouldMatch = /.*1080\s*(x|×|by)\s*720.*/;
@@ -396,9 +392,8 @@ test.describe('compression', () => {
preserveCopyright: false,
preserveGPS: false,
});
- await uploadMedia(page, 'input-example.jpg');
- await page.goto('/wp-admin/upload.php');
- await viewImage(page, 'input-example');
+ const { attachmentID } = await uploadMedia(page, 'input-example.jpg');
+ await viewImage(page, attachmentID);
const dimensionText = await page.locator('.misc-pub-section.misc-pub-dimensions').textContent();
const shouldMatch = /.*1080\s*(x|×|by)\s*720.*/;
@@ -501,19 +496,19 @@ test.describe('compression', () => {
await setCompressionTiming(page, 'manual');
await enableCompressionSizes(page, ['0', 'medium']);
await uploadMedia(page, 'input-example.jpg');
-
+
await page.goto('/wp-admin/upload.php');
await page.getByRole('button', { name: 'Mark as Compressed' }).click();
await expect(page.getByText('2 sizes compressed')).toBeVisible();
await expect(page.getByText('2 sizes converted')).toBeVisible();
});
-
+
test('will mark multiple attachments as compressed', async () => {
await setAPIKey(page, 'JPG123');
await setCompressionTiming(page, 'manual');
await enableCompressionSizes(page, ['0', 'medium']);
-
+
await uploadMedia(page, 'input-example.jpg');
await uploadMedia(page, 'input-example.png');
diff --git a/test/integration/conversion.spec.ts b/test/integration/conversion.spec.ts
index 13670f4..97f9f67 100644
--- a/test/integration/conversion.spec.ts
+++ b/test/integration/conversion.spec.ts
@@ -54,12 +54,12 @@ test.describe('conversion', () => {
output: 'smallest',
delivery: 'picture',
});
- const media = await uploadMedia(page, 'input-example.jpg');
+ const { imageURL } = await uploadMedia(page, 'input-example.jpg');
const postID = await newPost(
page,
{
title: 'test',
- content: `
`,
+ content: `
`,
},
WPVersion
);
@@ -76,12 +76,12 @@ test.describe('conversion', () => {
output: 'smallest',
delivery: 'htaccess',
});
- const media = await uploadMedia(page, 'input-example.jpg');
+ const { imageURL } = await uploadMedia(page, 'input-example.jpg');
const postID = await newPost(
page,
{
title: 'test',
- content: `
`,
+ content: `
`,
},
WPVersion
);
@@ -92,7 +92,7 @@ test.describe('conversion', () => {
await imageResponsePromise;
- const response = await page.request.get(media, {
+ const response = await page.request.get(imageURL, {
headers: {
Accept: 'image/avif,image/webp,*/*', // browser automatically add this
},
diff --git a/test/integration/utils.ts b/test/integration/utils.ts
index 8ee8a1b..88260d7 100644
--- a/test/integration/utils.ts
+++ b/test/integration/utils.ts
@@ -3,13 +3,20 @@ import { Page } from '@playwright/test';
export const BASE_URL = `http://localhost:${process.env.WORDPRESS_PORT}`;
-export async function uploadMedia(page: Page, file: string): Promise {
+interface UploadMediaResponse {
+ imageURL: string;
+ attachmentID: string;
+}
+export async function uploadMedia(page: Page, file: string): Promise {
await page.goto('/wp-admin/media-new.php?browser-uploader');
const fileChooserPromise = page.waitForEvent('filechooser');
await page.getByLabel('Upload').click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(path.join(__dirname, `../fixtures/${file}`));
- await Promise.all([page.waitForURL('**/wp-admin/upload.php**', { waitUntil: 'load' }), page.locator('#html-upload').click()]);
+ await Promise.all([
+ page.waitForURL('**upload.php**', { waitUntil: 'load' }),
+ page.locator('#html-upload').click(),
+ ]);
await page.goto('/wp-admin/upload.php?mode=list');
@@ -20,9 +27,16 @@ export async function uploadMedia(page: Page, file: string): Promise {
const rowID = await row.getAttribute('id');
const attachmentID = rowID?.split('-')[1];
+ if (!attachmentID) {
+ throw Error('unable to find attachmentID');
+ }
await Promise.all([page.waitForURL(new RegExp(`/wp-admin/post\\.php\\?post=${attachmentID}&action=edit$`), { waitUntil: 'load' }), page.goto(`/wp-admin/post.php?post=${attachmentID}&action=edit`)]);
- return page.locator('input[name="attachment_url"]').inputValue();
+ const imageURL = await page.locator('input[name="attachment_url"]').inputValue();
+ return {
+ imageURL,
+ attachmentID
+ };
}
export async function clearMediaLibrary(page: Page) {