diff --git a/packages/tests/fixtures/avatar-resized-120x120.webp b/packages/tests/fixtures/avatar-resized-120x120.webp new file mode 100644 index 000000000..216d7e1a4 Binary files /dev/null and b/packages/tests/fixtures/avatar-resized-120x120.webp differ diff --git a/packages/tests/fixtures/avatar-resized-1500x1500.webp b/packages/tests/fixtures/avatar-resized-1500x1500.webp new file mode 100644 index 000000000..0fe2ed08a Binary files /dev/null and b/packages/tests/fixtures/avatar-resized-1500x1500.webp differ diff --git a/packages/tests/fixtures/avatar-resized-48x48.webp b/packages/tests/fixtures/avatar-resized-48x48.webp new file mode 100644 index 000000000..803df797f Binary files /dev/null and b/packages/tests/fixtures/avatar-resized-48x48.webp differ diff --git a/packages/tests/fixtures/avatar-resized-600x600.webp b/packages/tests/fixtures/avatar-resized-600x600.webp new file mode 100644 index 000000000..a286b7a89 Binary files /dev/null and b/packages/tests/fixtures/avatar-resized-600x600.webp differ diff --git a/packages/tests/fixtures/avatar.webp b/packages/tests/fixtures/avatar.webp new file mode 100644 index 000000000..92546cda4 Binary files /dev/null and b/packages/tests/fixtures/avatar.webp differ diff --git a/packages/tests/src/api/users/users.ts b/packages/tests/src/api/users/users.ts index af4f19340..222493a38 100644 --- a/packages/tests/src/api/users/users.ts +++ b/packages/tests/src/api/users/users.ts @@ -272,8 +272,8 @@ describe('Test users', function () { } }) - it('Should be able to update my avatar with a gif, and then a png', async function () { - for (const extension of [ '.png', '.gif' ]) { + it('Should be able to update my avatar with a gif, a webp and a png', async function () { + for (const extension of [ '.png', '.gif', '.webp' ]) { const fixture = 'avatar' + extension await server.users.updateMyAvatar({ token: userToken, fixture }) diff --git a/packages/tests/src/shared/checks.ts b/packages/tests/src/shared/checks.ts index 1c3bff2a5..0981f2ce4 100644 --- a/packages/tests/src/shared/checks.ts +++ b/packages/tests/src/shared/checks.ts @@ -62,12 +62,13 @@ async function testAvatarSize (options: { // We don't test big GIF avatars if (extension === '.gif' && avatar.width > 150) return - const data = await readFile(buildAbsoluteFixturePath(imageName + extension)) + const fixturePath = buildAbsoluteFixturePath(imageName + extension) + const data = await readFile(fixturePath) const minLength = data.length - ((40 * data.length) / 100) const maxLength = data.length + ((40 * data.length) / 100) - expect(body.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture') - expect(body.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture') + expect(body.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture ' + fixturePath) + expect(body.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture ' + fixturePath) } async function testImageGeneratedByFFmpeg (url: string, imageName: string, imageHTTPPath: string, extension = '.jpg') {