diff options
Diffstat (limited to 'server/tests/shared')
-rw-r--r-- | server/tests/shared/checks.ts | 11 | ||||
-rw-r--r-- | server/tests/shared/videos.ts | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/server/tests/shared/checks.ts b/server/tests/shared/checks.ts index feaef37c6..90179c6ac 100644 --- a/server/tests/shared/checks.ts +++ b/server/tests/shared/checks.ts | |||
@@ -61,6 +61,16 @@ async function testImageSize (url: string, imageName: string, imageHTTPPath: str | |||
61 | expect(body.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture') | 61 | expect(body.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture') |
62 | } | 62 | } |
63 | 63 | ||
64 | async function testImageGeneratedByFFmpeg (url: string, imageName: string, imageHTTPPath: string, extension = '.jpg') { | ||
65 | if (process.env.ENABLE_FFMPEG_THUMBNAIL_PIXEL_COMPARISON_TESTS !== 'true') { | ||
66 | console.log( | ||
67 | 'Pixel comparison of image generated by ffmpeg is disabled. ' + | ||
68 | 'You can enable it using `ENABLE_FFMPEG_THUMBNAIL_PIXEL_COMPARISON_TESTS=true env variable') | ||
69 | } | ||
70 | |||
71 | return testImage(url, imageName, imageHTTPPath, extension) | ||
72 | } | ||
73 | |||
64 | async function testImage (url: string, imageName: string, imageHTTPPath: string, extension = '.jpg') { | 74 | async function testImage (url: string, imageName: string, imageHTTPPath: string, extension = '.jpg') { |
65 | const res = await makeGetRequest({ | 75 | const res = await makeGetRequest({ |
66 | url, | 76 | url, |
@@ -148,6 +158,7 @@ async function checkVideoDuration (server: PeerTubeServer, videoUUID: string, du | |||
148 | 158 | ||
149 | export { | 159 | export { |
150 | dateIsValid, | 160 | dateIsValid, |
161 | testImageGeneratedByFFmpeg, | ||
151 | testImageSize, | 162 | testImageSize, |
152 | testImage, | 163 | testImage, |
153 | expectLogDoesNotContain, | 164 | expectLogDoesNotContain, |
diff --git a/server/tests/shared/videos.ts b/server/tests/shared/videos.ts index 856fabd11..0bd161820 100644 --- a/server/tests/shared/videos.ts +++ b/server/tests/shared/videos.ts | |||
@@ -7,7 +7,7 @@ import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO | |||
7 | import { getLowercaseExtension, pick, uuidRegex } from '@shared/core-utils' | 7 | import { getLowercaseExtension, pick, uuidRegex } from '@shared/core-utils' |
8 | import { HttpStatusCode, VideoCaption, VideoDetails, VideoPrivacy, VideoResolution } from '@shared/models' | 8 | import { HttpStatusCode, VideoCaption, VideoDetails, VideoPrivacy, VideoResolution } from '@shared/models' |
9 | import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs } from '@shared/server-commands' | 9 | import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs } from '@shared/server-commands' |
10 | import { dateIsValid, expectStartWith, testImage } from './checks' | 10 | import { dateIsValid, expectStartWith, testImageGeneratedByFFmpeg } from './checks' |
11 | import { checkWebTorrentWorks } from './webtorrent' | 11 | import { checkWebTorrentWorks } from './webtorrent' |
12 | 12 | ||
13 | loadLanguages() | 13 | loadLanguages() |
@@ -197,11 +197,11 @@ async function completeVideoCheck (options: { | |||
197 | expect(video.downloadEnabled).to.equal(attributes.downloadEnabled) | 197 | expect(video.downloadEnabled).to.equal(attributes.downloadEnabled) |
198 | 198 | ||
199 | expect(video.thumbnailPath).to.exist | 199 | expect(video.thumbnailPath).to.exist |
200 | await testImage(server.url, attributes.thumbnailfile || attributes.fixture, video.thumbnailPath) | 200 | await testImageGeneratedByFFmpeg(server.url, attributes.thumbnailfile || attributes.fixture, video.thumbnailPath) |
201 | 201 | ||
202 | if (attributes.previewfile) { | 202 | if (attributes.previewfile) { |
203 | expect(video.previewPath).to.exist | 203 | expect(video.previewPath).to.exist |
204 | await testImage(server.url, attributes.previewfile, video.previewPath) | 204 | await testImageGeneratedByFFmpeg(server.url, attributes.previewfile, video.previewPath) |
205 | } | 205 | } |
206 | 206 | ||
207 | await completeWebVideoFilesCheck({ server, originServer, videoUUID: video.uuid, ...pick(attributes, [ 'fixture', 'files' ]) }) | 207 | await completeWebVideoFilesCheck({ server, originServer, videoUUID: video.uuid, ...pick(attributes, [ 'fixture', 'files' ]) }) |