aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/user-notifications.ts1
-rw-r--r--server/tests/api/notifications/user-notifications.ts41
-rw-r--r--server/tests/api/transcoding/video-editor.ts8
-rw-r--r--server/tests/shared/notifications.ts34
4 files changed, 75 insertions, 9 deletions
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index 4bc8084a1..93355e8b3 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -171,6 +171,7 @@ describe('Test user notifications API validators', function () {
171 abuseNewMessage: UserNotificationSettingValue.WEB, 171 abuseNewMessage: UserNotificationSettingValue.WEB,
172 abuseStateChange: UserNotificationSettingValue.WEB, 172 abuseStateChange: UserNotificationSettingValue.WEB,
173 newPeerTubeVersion: UserNotificationSettingValue.WEB, 173 newPeerTubeVersion: UserNotificationSettingValue.WEB,
174 myVideoEditionFinished: UserNotificationSettingValue.WEB,
174 newPluginVersion: UserNotificationSettingValue.WEB 175 newPluginVersion: UserNotificationSettingValue.WEB
175 } 176 }
176 177
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index f9f3e0e0e..c87686cb5 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -7,6 +7,7 @@ import {
7 checkMyVideoImportIsFinished, 7 checkMyVideoImportIsFinished,
8 checkNewActorFollow, 8 checkNewActorFollow,
9 checkNewVideoFromSubscription, 9 checkNewVideoFromSubscription,
10 checkVideoEditionIsFinished,
10 checkVideoIsPublished, 11 checkVideoIsPublished,
11 FIXTURE_URLS, 12 FIXTURE_URLS,
12 MockSmtpServer, 13 MockSmtpServer,
@@ -15,7 +16,7 @@ import {
15} from '@server/tests/shared' 16} from '@server/tests/shared'
16import { wait } from '@shared/core-utils' 17import { wait } from '@shared/core-utils'
17import { buildUUID } from '@shared/extra-utils' 18import { buildUUID } from '@shared/extra-utils'
18import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models' 19import { UserNotification, UserNotificationType, VideoEditorTask, VideoPrivacy } from '@shared/models'
19import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' 20import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'
20 21
21const expect = chai.expect 22const expect = chai.expect
@@ -23,10 +24,12 @@ const expect = chai.expect
23describe('Test user notifications', function () { 24describe('Test user notifications', function () {
24 let servers: PeerTubeServer[] = [] 25 let servers: PeerTubeServer[] = []
25 let userAccessToken: string 26 let userAccessToken: string
27
26 let userNotifications: UserNotification[] = [] 28 let userNotifications: UserNotification[] = []
27 let adminNotifications: UserNotification[] = [] 29 let adminNotifications: UserNotification[] = []
28 let adminNotificationsServer2: UserNotification[] = [] 30 let adminNotificationsServer2: UserNotification[] = []
29 let emails: object[] = [] 31 let emails: object[] = []
32
30 let channelId: number 33 let channelId: number
31 34
32 before(async function () { 35 before(async function () {
@@ -320,6 +323,42 @@ describe('Test user notifications', function () {
320 }) 323 })
321 }) 324 })
322 325
326 describe('Video editor', function () {
327 let baseParams: CheckerBaseParams
328
329 before(() => {
330 baseParams = {
331 server: servers[1],
332 emails,
333 socketNotifications: adminNotificationsServer2,
334 token: servers[1].accessToken
335 }
336 })
337
338 it('Should send a notification after editor edition', async function () {
339 this.timeout(240000)
340
341 const { name, shortUUID, id } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true })
342
343 await waitJobs(servers)
344 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
345
346 const tasks: VideoEditorTask[] = [
347 {
348 name: 'cut',
349 options: {
350 start: 0,
351 end: 1
352 }
353 }
354 ]
355 await servers[1].videoEditor.createEditionTasks({ videoId: id, tasks })
356 await waitJobs(servers)
357
358 await checkVideoEditionIsFinished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
359 })
360 })
361
323 describe('My video is imported', function () { 362 describe('My video is imported', function () {
324 let baseParams: CheckerBaseParams 363 let baseParams: CheckerBaseParams
325 364
diff --git a/server/tests/api/transcoding/video-editor.ts b/server/tests/api/transcoding/video-editor.ts
index a9b6950cc..f70bd49e6 100644
--- a/server/tests/api/transcoding/video-editor.ts
+++ b/server/tests/api/transcoding/video-editor.ts
@@ -56,13 +56,7 @@ describe('Test video editor', function () {
56 56
57 await servers[0].config.enableMinimumTranscoding() 57 await servers[0].config.enableMinimumTranscoding()
58 58
59 await servers[0].config.updateExistingSubConfig({ 59 await servers[0].config.enableEditor()
60 newConfig: {
61 videoEditor: {
62 enabled: true
63 }
64 }
65 })
66 }) 60 })
67 61
68 describe('Cutting', function () { 62 describe('Cutting', function () {
diff --git a/server/tests/shared/notifications.ts b/server/tests/shared/notifications.ts
index 78d3787f0..f1ddbbbf7 100644
--- a/server/tests/shared/notifications.ts
+++ b/server/tests/shared/notifications.ts
@@ -47,6 +47,7 @@ function getAllNotificationsSettings (): UserNotificationSetting {
47 abuseStateChange: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 47 abuseStateChange: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
48 autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 48 autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
49 newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 49 newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
50 myVideoEditionFinished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
50 newPluginVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL 51 newPluginVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
51 } 52 }
52} 53}
@@ -109,6 +110,34 @@ async function checkVideoIsPublished (options: CheckerBaseParams & {
109 await checkNotification({ ...options, notificationChecker, emailNotificationFinder }) 110 await checkNotification({ ...options, notificationChecker, emailNotificationFinder })
110} 111}
111 112
113async function checkVideoEditionIsFinished (options: CheckerBaseParams & {
114 videoName: string
115 shortUUID: string
116 checkType: CheckerType
117}) {
118 const { videoName, shortUUID } = options
119 const notificationType = UserNotificationType.MY_VIDEO_EDITION_FINISHED
120
121 function notificationChecker (notification: UserNotification, checkType: CheckerType) {
122 if (checkType === 'presence') {
123 expect(notification).to.not.be.undefined
124 expect(notification.type).to.equal(notificationType)
125
126 checkVideo(notification.video, videoName, shortUUID)
127 checkActor(notification.video.channel)
128 } else {
129 expect(notification.video).to.satisfy(v => v === undefined || v.name !== videoName)
130 }
131 }
132
133 function emailNotificationFinder (email: object) {
134 const text: string = email['text']
135 return text.includes(shortUUID) && text.includes('Edition of your video')
136 }
137
138 await checkNotification({ ...options, notificationChecker, emailNotificationFinder })
139}
140
112async function checkMyVideoImportIsFinished (options: CheckerBaseParams & { 141async function checkMyVideoImportIsFinished (options: CheckerBaseParams & {
113 videoName: string 142 videoName: string
114 shortUUID: string 143 shortUUID: string
@@ -656,6 +685,8 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an
656 await setDefaultChannelAvatar(servers) 685 await setDefaultChannelAvatar(servers)
657 await setDefaultAccountAvatar(servers) 686 await setDefaultAccountAvatar(servers)
658 687
688 await servers[1].config.enableEditor()
689
659 if (serversCount > 1) { 690 if (serversCount > 1) {
660 await doubleFollow(servers[0], servers[1]) 691 await doubleFollow(servers[0], servers[1])
661 } 692 }
@@ -724,7 +755,8 @@ export {
724 checkNewCommentAbuseForModerators, 755 checkNewCommentAbuseForModerators,
725 checkNewAccountAbuseForModerators, 756 checkNewAccountAbuseForModerators,
726 checkNewPeerTubeVersion, 757 checkNewPeerTubeVersion,
727 checkNewPluginVersion 758 checkNewPluginVersion,
759 checkVideoEditionIsFinished
728} 760}
729 761
730// --------------------------------------------------------------------------- 762// ---------------------------------------------------------------------------