+ await checkNewBlacklistOnMyVideo(baseParams, uuid, name, 'unblacklist')
+ })
+ })
+
+ describe('My video is published', function () {
+ let baseParams: CheckerBaseParams
+
+ before(() => {
+ baseParams = {
+ server: servers[1],
+ emails,
+ socketNotifications: adminNotificationsServer2,
+ token: servers[1].accessToken
+ }
+ })
+
+ it('Should not send a notification if transcoding is not enabled', async function () {
+ const { name, uuid } = await uploadVideoByLocalAccount(servers)
+ await waitJobs(servers)
+
+ await checkVideoIsPublished(baseParams, name, uuid, 'absence')
+ })
+
+ it('Should not send a notification if the wait transcoding is false', async function () {
+ this.timeout(50000)
+
+ await uploadVideoByRemoteAccount(servers, { waitTranscoding: false })
+ await waitJobs(servers)
+
+ const notification = await getLastNotification(servers[ 0 ].url, userAccessToken)
+ if (notification) {
+ expect(notification.type).to.not.equal(UserNotificationType.MY_VIDEO_PUBLISHED)
+ }
+ })
+
+ it('Should send a notification even if the video is not transcoded in other resolutions', async function () {
+ this.timeout(50000)
+
+ const { name, uuid } = await uploadVideoByRemoteAccount(servers, { waitTranscoding: true, fixture: 'video_short_240p.mp4' })
+ await waitJobs(servers)
+
+ await checkVideoIsPublished(baseParams, name, uuid, 'presence')
+ })
+
+ it('Should send a notification with a transcoded video', async function () {
+ this.timeout(50000)
+
+ const { name, uuid } = await uploadVideoByRemoteAccount(servers, { waitTranscoding: true })
+ await waitJobs(servers)
+
+ await checkVideoIsPublished(baseParams, name, uuid, 'presence')
+ })
+
+ it('Should send a notification when an imported video is transcoded', async function () {
+ this.timeout(50000)
+
+ const name = 'video import ' + uuidv4()
+
+ const attributes = {
+ name,
+ channelId,
+ privacy: VideoPrivacy.PUBLIC,
+ targetUrl: getYoutubeVideoUrl(),
+ waitTranscoding: true
+ }
+ const res = await importVideo(servers[1].url, servers[1].accessToken, attributes)
+ const uuid = res.body.video.uuid
+
+ await waitJobs(servers)
+ await checkVideoIsPublished(baseParams, name, uuid, 'presence')
+ })
+
+ it('Should send a notification when the scheduled update has been proceeded', async function () {
+ this.timeout(70000)
+
+ // In 2 seconds
+ let updateAt = new Date(new Date().getTime() + 2000)
+
+ const data = {
+ privacy: VideoPrivacy.PRIVATE,
+ scheduleUpdate: {
+ updateAt: updateAt.toISOString(),
+ privacy: VideoPrivacy.PUBLIC
+ }
+ }
+ const { name, uuid } = await uploadVideoByRemoteAccount(servers, data)
+
+ await wait(6000)
+ await checkVideoIsPublished(baseParams, name, uuid, 'presence')
+ })
+ })
+
+ describe('My video is imported', function () {
+ let baseParams: CheckerBaseParams
+
+ before(() => {
+ baseParams = {
+ server: servers[0],
+ emails,
+ socketNotifications: adminNotifications,
+ token: servers[0].accessToken
+ }
+ })
+
+ it('Should send a notification when the video import failed', async function () {
+ this.timeout(70000)
+
+ const name = 'video import ' + uuidv4()
+
+ const attributes = {
+ name,
+ channelId,
+ privacy: VideoPrivacy.PRIVATE,
+ targetUrl: getBadVideoUrl()
+ }
+ const res = await importVideo(servers[0].url, servers[0].accessToken, attributes)
+ const uuid = res.body.video.uuid
+
+ await waitJobs(servers)
+ await checkMyVideoImportIsFinished(baseParams, name, uuid, getBadVideoUrl(), false, 'presence')
+ })
+
+ it('Should send a notification when the video import succeeded', async function () {
+ this.timeout(70000)
+
+ const name = 'video import ' + uuidv4()
+
+ const attributes = {
+ name,
+ channelId,
+ privacy: VideoPrivacy.PRIVATE,
+ targetUrl: getYoutubeVideoUrl()
+ }
+ const res = await importVideo(servers[0].url, servers[0].accessToken, attributes)
+ const uuid = res.body.video.uuid
+
+ await waitJobs(servers)
+ await checkMyVideoImportIsFinished(baseParams, name, uuid, getYoutubeVideoUrl(), true, 'presence')