aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-03 11:38:07 +0200
committerChocobozzz <me@florianbigard.com>2022-05-03 14:49:15 +0200
commit26e3e98ff0e222a9fb9226938ac6902af77921bd (patch)
tree73d1c6f2524e380862d3365f12043fc319d40841 /server/tests/api/notifications
parent86c5229b4d726202378ef46854383bcafca22310 (diff)
downloadPeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.tar.gz
PeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.tar.zst
PeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.zip
Support live session in server
Diffstat (limited to 'server/tests/api/notifications')
-rw-r--r--server/tests/api/notifications/user-notifications.ts76
1 files changed, 73 insertions, 3 deletions
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 47e85a30c..1705fda55 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -7,8 +7,8 @@ import {
7 checkMyVideoImportIsFinished, 7 checkMyVideoImportIsFinished,
8 checkNewActorFollow, 8 checkNewActorFollow,
9 checkNewVideoFromSubscription, 9 checkNewVideoFromSubscription,
10 checkVideoStudioEditionIsFinished,
11 checkVideoIsPublished, 10 checkVideoIsPublished,
11 checkVideoStudioEditionIsFinished,
12 FIXTURE_URLS, 12 FIXTURE_URLS,
13 MockSmtpServer, 13 MockSmtpServer,
14 prepareNotificationsTest, 14 prepareNotificationsTest,
@@ -16,8 +16,8 @@ import {
16} from '@server/tests/shared' 16} from '@server/tests/shared'
17import { wait } from '@shared/core-utils' 17import { wait } from '@shared/core-utils'
18import { buildUUID } from '@shared/extra-utils' 18import { buildUUID } from '@shared/extra-utils'
19import { UserNotification, UserNotificationType, VideoStudioTask, VideoPrivacy } from '@shared/models' 19import { UserNotification, UserNotificationType, VideoPrivacy, VideoStudioTask } from '@shared/models'
20import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' 20import { cleanupTests, findExternalSavedVideo, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands'
21 21
22const expect = chai.expect 22const expect = chai.expect
23 23
@@ -323,6 +323,76 @@ describe('Test user notifications', function () {
323 }) 323 })
324 }) 324 })
325 325
326 describe('My live replay is published', function () {
327
328 let baseParams: CheckerBaseParams
329
330 before(() => {
331 baseParams = {
332 server: servers[1],
333 emails,
334 socketNotifications: adminNotificationsServer2,
335 token: servers[1].accessToken
336 }
337 })
338
339 it('Should send a notification is a live replay of a non permanent live is published', async function () {
340 this.timeout(120000)
341
342 const { shortUUID } = await servers[1].live.create({
343 fields: {
344 name: 'non permanent live',
345 privacy: VideoPrivacy.PUBLIC,
346 channelId: servers[1].store.channel.id,
347 saveReplay: true,
348 permanentLive: false
349 }
350 })
351
352 const ffmpegCommand = await servers[1].live.sendRTMPStreamInVideo({ videoId: shortUUID })
353
354 await waitJobs(servers)
355 await servers[1].live.waitUntilPublished({ videoId: shortUUID })
356
357 await stopFfmpeg(ffmpegCommand)
358 await servers[1].live.waitUntilReplacedByReplay({ videoId: shortUUID })
359
360 await waitJobs(servers)
361 await checkVideoIsPublished({ ...baseParams, videoName: 'non permanent live', shortUUID, checkType: 'presence' })
362 })
363
364 it('Should send a notification is a live replay of a permanent live is published', async function () {
365 this.timeout(120000)
366
367 const { shortUUID } = await servers[1].live.create({
368 fields: {
369 name: 'permanent live',
370 privacy: VideoPrivacy.PUBLIC,
371 channelId: servers[1].store.channel.id,
372 saveReplay: true,
373 permanentLive: true
374 }
375 })
376
377 const ffmpegCommand = await servers[1].live.sendRTMPStreamInVideo({ videoId: shortUUID })
378
379 await waitJobs(servers)
380 await servers[1].live.waitUntilPublished({ videoId: shortUUID })
381
382 const liveDetails = await servers[1].videos.get({ id: shortUUID })
383
384 await stopFfmpeg(ffmpegCommand)
385
386 await servers[1].live.waitUntilWaiting({ videoId: shortUUID })
387 await waitJobs(servers)
388
389 const video = await findExternalSavedVideo(servers[1], liveDetails)
390 expect(video).to.exist
391
392 await checkVideoIsPublished({ ...baseParams, videoName: video.name, shortUUID: video.shortUUID, checkType: 'presence' })
393 })
394 })
395
326 describe('Video studio', function () { 396 describe('Video studio', function () {
327 let baseParams: CheckerBaseParams 397 let baseParams: CheckerBaseParams
328 398