diff --git a/tests/e2e/export.test.ts b/tests/e2e/export.test.ts index 715ec18f1..916f668f9 100644 --- a/tests/e2e/export.test.ts +++ b/tests/e2e/export.test.ts @@ -64,8 +64,10 @@ test.describe('next/image is using Netlify Image CDN', () => { expect(nextImageResponse.status()).toBe(200) // ensure next/image is using Image CDN - // source image is jpg, but when requesting it through Image CDN avif will be returned - expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif') + // source image is jpg, but when requesting it through Image CDN avif or webp will be returned + expect(['image/avif', 'image/webp']).toContain( + await nextImageResponse.headerValue('content-type'), + ) await expectImageWasLoaded(page.locator('img')) }) diff --git a/tests/e2e/simple-app.test.ts b/tests/e2e/simple-app.test.ts index 15f1f585f..980ad84dd 100644 --- a/tests/e2e/simple-app.test.ts +++ b/tests/e2e/simple-app.test.ts @@ -119,8 +119,10 @@ test.describe('next/image is using Netlify Image CDN', () => { expect(nextImageResponse.status()).toBe(200) // ensure next/image is using Image CDN - // source image is jpg, but when requesting it through Image CDN avif will be returned - expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif') + // source image is jpg, but when requesting it through Image CDN avif or webp will be returned + expect(['image/avif', 'image/webp']).toContain( + await nextImageResponse.headerValue('content-type'), + ) await expectImageWasLoaded(page.locator('img')) }) @@ -142,7 +144,9 @@ test.describe('next/image is using Netlify Image CDN', () => { ) expect(nextImageResponse.status()).toBe(200) - expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif') + expect(['image/avif', 'image/webp']).toContain( + await nextImageResponse.headerValue('content-type'), + ) await expectImageWasLoaded(page.locator('img')) }) @@ -164,7 +168,9 @@ test.describe('next/image is using Netlify Image CDN', () => { ) expect(nextImageResponse.status()).toBe(200) - expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif') + expect(['image/avif', 'image/webp']).toContain( + await nextImageResponse.headerValue('content-type'), + ) await expectImageWasLoaded(page.locator('img')) }) @@ -183,7 +189,9 @@ test.describe('next/image is using Netlify Image CDN', () => { ) expect(nextImageResponse?.status()).toBe(200) - expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif') + expect(['image/avif', 'image/webp']).toContain( + await nextImageResponse.headerValue('content-type'), + ) await expectImageWasLoaded(page.locator('img')) }) @@ -203,7 +211,9 @@ test.describe('next/image is using Netlify Image CDN', () => { ) expect(nextImageResponse.status()).toEqual(200) - expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif') + expect(['image/avif', 'image/webp']).toContain( + await nextImageResponse.headerValue('content-type'), + ) await expectImageWasLoaded(page.locator('img')) })