X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fusers%2Fuser-notifications.ts;h=69e51677e0da89050746740313bc31c90e28a8f4;hb=6c32d302126f455779f5593192775b86833f1f33;hp=ad68d8e69af142d12e300e4d76bd29cc1eba257a;hpb=2f1548fda32c3ba9e53913270394eedfacd55986;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/users/user-notifications.ts b/server/tests/api/users/user-notifications.ts index ad68d8e69..69e51677e 100644 --- a/server/tests/api/users/user-notifications.ts +++ b/server/tests/api/users/user-notifications.ts @@ -165,6 +165,8 @@ describe('Test users notifications', function () { }) it('Should not send notifications if the user does not follow the video publisher', async function () { + this.timeout(10000) + await uploadVideoByLocalAccount(servers) const notification = await getLastNotification(servers[ 0 ].url, userAccessToken) @@ -175,7 +177,7 @@ describe('Test users notifications', function () { }) it('Should send a new video notification if the user follows the local video publisher', async function () { - this.timeout(10000) + this.timeout(15000) await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:9001') await waitJobs(servers) @@ -644,6 +646,8 @@ describe('Test users notifications', function () { }) it('Should not send a notification if transcoding is not enabled', async function () { + this.timeout(10000) + const { name, uuid } = await uploadVideoByLocalAccount(servers) await waitJobs(servers) @@ -717,6 +721,24 @@ describe('Test users notifications', function () { await wait(6000) await checkVideoIsPublished(baseParams, name, uuid, 'presence') }) + + it('Should not send a notification before the video is published', async function () { + this.timeout(20000) + + let updateAt = new Date(new Date().getTime() + 100000) + + 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, 'absence') + }) }) describe('My video is imported', function () { @@ -781,6 +803,8 @@ describe('Test users notifications', function () { }) it('Should send a notification only to moderators when a user registers on the instance', async function () { + this.timeout(10000) + await registerUser(servers[0].url, 'user_45', 'password') await waitJobs(servers) @@ -849,6 +873,8 @@ describe('Test users notifications', function () { }) it('Should notify when a local account is following one of our channel', async function () { + this.timeout(10000) + await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:9001') await waitJobs(servers) @@ -857,6 +883,8 @@ describe('Test users notifications', function () { }) it('Should notify when a remote account is following one of our channel', async function () { + this.timeout(10000) + await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:9001') await waitJobs(servers) @@ -926,6 +954,8 @@ describe('Test users notifications', function () { }) it('Should not have notifications', async function () { + this.timeout(10000) + await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { newVideoFromSubscription: UserNotificationSettingValue.NONE })) @@ -943,6 +973,8 @@ describe('Test users notifications', function () { }) it('Should only have web notifications', async function () { + this.timeout(10000) + await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { newVideoFromSubscription: UserNotificationSettingValue.WEB })) @@ -967,6 +999,8 @@ describe('Test users notifications', function () { }) it('Should only have mail notifications', async function () { + this.timeout(10000) + await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { newVideoFromSubscription: UserNotificationSettingValue.EMAIL })) @@ -991,6 +1025,8 @@ describe('Test users notifications', function () { }) it('Should have email and web notifications', async function () { + this.timeout(10000) + await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { newVideoFromSubscription: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL })) @@ -1010,6 +1046,8 @@ describe('Test users notifications', function () { }) after(async function () { + MockSmtpServer.Instance.kill() + killallServers(servers) }) })