X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fnotifications%2Fuser-notifications.ts;h=c87686cb5c64297e4fac0071b9012b095401683e;hb=1808a1f8e4b7b102823492a2007a46929aebf189;hp=9af20843ecaca8e34b744fd85f8724b89873fe44;hpb=636d73c58866ed235c207719e41fdde3c2d6c969;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts index 9af20843e..c87686cb5 100644 --- a/server/tests/api/notifications/user-notifications.ts +++ b/server/tests/api/notifications/user-notifications.ts @@ -2,33 +2,34 @@ import 'mocha' import * as chai from 'chai' -import { buildUUID } from '@server/helpers/uuid' import { CheckerBaseParams, checkMyVideoImportIsFinished, checkNewActorFollow, checkNewVideoFromSubscription, + checkVideoEditionIsFinished, checkVideoIsPublished, - cleanupTests, FIXTURE_URLS, MockSmtpServer, - PeerTubeServer, prepareNotificationsTest, - uploadRandomVideoOnServers, - wait, - waitJobs -} from '@shared/extra-utils' -import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models' + uploadRandomVideoOnServers +} from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { buildUUID } from '@shared/extra-utils' +import { UserNotification, UserNotificationType, VideoEditorTask, VideoPrivacy } from '@shared/models' +import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' const expect = chai.expect describe('Test user notifications', function () { let servers: PeerTubeServer[] = [] let userAccessToken: string + let userNotifications: UserNotification[] = [] let adminNotifications: UserNotification[] = [] let adminNotificationsServer2: UserNotification[] = [] let emails: object[] = [] + let channelId: number before(async function () { @@ -128,7 +129,7 @@ describe('Test user notifications', function () { }) it('Should not send a notification before the video is published', async function () { - this.timeout(50000) + this.timeout(150000) const updateAt = new Date(new Date().getTime() + 1000000) @@ -322,6 +323,42 @@ describe('Test user notifications', function () { }) }) + describe('Video editor', function () { + let baseParams: CheckerBaseParams + + before(() => { + baseParams = { + server: servers[1], + emails, + socketNotifications: adminNotificationsServer2, + token: servers[1].accessToken + } + }) + + it('Should send a notification after editor edition', async function () { + this.timeout(240000) + + const { name, shortUUID, id } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true }) + + await waitJobs(servers) + await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' }) + + const tasks: VideoEditorTask[] = [ + { + name: 'cut', + options: { + start: 0, + end: 1 + } + } + ] + await servers[1].videoEditor.createEditionTasks({ videoId: id, tasks }) + await waitJobs(servers) + + await checkVideoEditionIsFinished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' }) + }) + }) + describe('My video is imported', function () { let baseParams: CheckerBaseParams