diff options
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 39 | ||||
-rw-r--r-- | server/tests/api/videos/services.ts | 8 | ||||
-rw-r--r-- | server/tests/api/videos/single-server.ts | 29 | ||||
-rw-r--r-- | server/tests/api/videos/video-abuse.ts | 18 | ||||
-rw-r--r-- | server/tests/api/videos/video-blacklist-management.ts | 11 | ||||
-rw-r--r-- | server/tests/api/videos/video-blacklist.ts | 12 | ||||
-rw-r--r-- | server/tests/api/videos/video-channels.ts | 16 | ||||
-rw-r--r-- | server/tests/api/videos/video-comments.ts | 18 | ||||
-rw-r--r-- | server/tests/api/videos/video-description.ts | 14 | ||||
-rw-r--r-- | server/tests/api/videos/video-nsfw.ts | 14 | ||||
-rw-r--r-- | server/tests/api/videos/video-privacy.ts | 16 | ||||
-rw-r--r-- | server/tests/api/videos/video-transcoder.ts | 18 |
12 files changed, 97 insertions, 116 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index edc46a644..cb18898ce 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -15,7 +15,8 @@ import { | |||
15 | dateIsValid, | 15 | dateIsValid, |
16 | doubleFollow, | 16 | doubleFollow, |
17 | flushAndRunMultipleServers, | 17 | flushAndRunMultipleServers, |
18 | flushTests, getLocalVideos, | 18 | flushTests, |
19 | getLocalVideos, | ||
19 | getVideo, | 20 | getVideo, |
20 | getVideoChannelsList, | 21 | getVideoChannelsList, |
21 | getVideosList, | 22 | getVideosList, |
@@ -39,7 +40,7 @@ import { | |||
39 | getVideoCommentThreads, | 40 | getVideoCommentThreads, |
40 | getVideoThreadComments | 41 | getVideoThreadComments |
41 | } from '../../utils/videos/video-comments' | 42 | } from '../../utils/videos/video-comments' |
42 | import { getAccountsList } from '../../utils/users/accounts' | 43 | import { waitJobs } from '../../utils/server/jobs' |
43 | 44 | ||
44 | const expect = chai.expect | 45 | const expect = chai.expect |
45 | 46 | ||
@@ -102,7 +103,7 @@ describe('Test multiple servers', function () { | |||
102 | } | 103 | } |
103 | await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) | 104 | await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) |
104 | 105 | ||
105 | await wait(10000) | 106 | await waitJobs(servers) |
106 | 107 | ||
107 | // All servers should have this video | 108 | // All servers should have this video |
108 | let publishedAt: string = null | 109 | let publishedAt: string = null |
@@ -177,7 +178,7 @@ describe('Test multiple servers', function () { | |||
177 | await uploadVideo(servers[1].url, userAccessToken, videoAttributes) | 178 | await uploadVideo(servers[1].url, userAccessToken, videoAttributes) |
178 | 179 | ||
179 | // Transcoding | 180 | // Transcoding |
180 | await wait(30000) | 181 | await waitJobs(servers) |
181 | 182 | ||
182 | // All servers should have this video | 183 | // All servers should have this video |
183 | for (const server of servers) { | 184 | for (const server of servers) { |
@@ -266,7 +267,7 @@ describe('Test multiple servers', function () { | |||
266 | } | 267 | } |
267 | await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2) | 268 | await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2) |
268 | 269 | ||
269 | await wait(10000) | 270 | await waitJobs(servers) |
270 | 271 | ||
271 | // All servers should have this video | 272 | // All servers should have this video |
272 | for (const server of servers) { | 273 | for (const server of servers) { |
@@ -496,15 +497,15 @@ describe('Test multiple servers', function () { | |||
496 | await viewVideo(servers[2].url, localVideosServer3[1]) | 497 | await viewVideo(servers[2].url, localVideosServer3[1]) |
497 | 498 | ||
498 | await Promise.all(tasks) | 499 | await Promise.all(tasks) |
499 | await wait(1500) | 500 | await waitJobs(servers) |
500 | 501 | ||
501 | await viewVideo(servers[2].url, localVideosServer3[0]) | 502 | await viewVideo(servers[2].url, localVideosServer3[0]) |
502 | 503 | ||
503 | await wait(1500) | 504 | await waitJobs(servers) |
504 | 505 | ||
505 | await viewVideo(servers[2].url, localVideosServer3[0]) | 506 | await viewVideo(servers[2].url, localVideosServer3[0]) |
506 | 507 | ||
507 | await wait(5000) | 508 | await waitJobs(servers) |
508 | 509 | ||
509 | for (const server of servers) { | 510 | for (const server of servers) { |
510 | const res = await getVideosList(server.url) | 511 | const res = await getVideosList(server.url) |
@@ -535,7 +536,7 @@ describe('Test multiple servers', function () { | |||
535 | 536 | ||
536 | await Promise.all(tasks) | 537 | await Promise.all(tasks) |
537 | 538 | ||
538 | await wait(10000) | 539 | await waitJobs(servers) |
539 | 540 | ||
540 | let baseVideos = null | 541 | let baseVideos = null |
541 | 542 | ||
@@ -572,7 +573,7 @@ describe('Test multiple servers', function () { | |||
572 | await wait(200) | 573 | await wait(200) |
573 | await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[0], 'like') | 574 | await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[0], 'like') |
574 | 575 | ||
575 | await wait(10000) | 576 | await waitJobs(servers) |
576 | 577 | ||
577 | let baseVideos = null | 578 | let baseVideos = null |
578 | for (const server of servers) { | 579 | for (const server of servers) { |
@@ -614,7 +615,7 @@ describe('Test multiple servers', function () { | |||
614 | 615 | ||
615 | await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes) | 616 | await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes) |
616 | 617 | ||
617 | await wait(5000) | 618 | await waitJobs(servers) |
618 | }) | 619 | }) |
619 | 620 | ||
620 | it('Should have the video 3 updated on each server', async function () { | 621 | it('Should have the video 3 updated on each server', async function () { |
@@ -670,7 +671,7 @@ describe('Test multiple servers', function () { | |||
670 | await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id) | 671 | await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id) |
671 | await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id) | 672 | await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id) |
672 | 673 | ||
673 | await wait(5000) | 674 | await waitJobs(servers) |
674 | }) | 675 | }) |
675 | 676 | ||
676 | it('Should not have files of videos 3 and 3-2 on each server', async function () { | 677 | it('Should not have files of videos 3 and 3-2 on each server', async function () { |
@@ -749,7 +750,7 @@ describe('Test multiple servers', function () { | |||
749 | await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, text) | 750 | await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, text) |
750 | } | 751 | } |
751 | 752 | ||
752 | await wait(5000) | 753 | await waitJobs(servers) |
753 | 754 | ||
754 | { | 755 | { |
755 | const res = await getVideoCommentThreads(servers[1].url, videoUUID, 0, 5) | 756 | const res = await getVideoCommentThreads(servers[1].url, videoUUID, 0, 5) |
@@ -759,7 +760,7 @@ describe('Test multiple servers', function () { | |||
759 | await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, videoUUID, threadId, text) | 760 | await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, videoUUID, threadId, text) |
760 | } | 761 | } |
761 | 762 | ||
762 | await wait(5000) | 763 | await waitJobs(servers) |
763 | 764 | ||
764 | { | 765 | { |
765 | const res1 = await getVideoCommentThreads(servers[2].url, videoUUID, 0, 5) | 766 | const res1 = await getVideoCommentThreads(servers[2].url, videoUUID, 0, 5) |
@@ -775,7 +776,7 @@ describe('Test multiple servers', function () { | |||
775 | await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, childCommentId, text2) | 776 | await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, childCommentId, text2) |
776 | } | 777 | } |
777 | 778 | ||
778 | await wait(5000) | 779 | await waitJobs(servers) |
779 | }) | 780 | }) |
780 | 781 | ||
781 | it('Should have these threads', async function () { | 782 | it('Should have these threads', async function () { |
@@ -848,7 +849,7 @@ describe('Test multiple servers', function () { | |||
848 | 849 | ||
849 | await deleteVideoComment(servers[2].url, servers[2].accessToken, videoUUID, childOfFirstChild.comment.id) | 850 | await deleteVideoComment(servers[2].url, servers[2].accessToken, videoUUID, childOfFirstChild.comment.id) |
850 | 851 | ||
851 | await wait(5000) | 852 | await waitJobs(servers) |
852 | }) | 853 | }) |
853 | 854 | ||
854 | it('Should not have this comment anymore', async function () { | 855 | it('Should not have this comment anymore', async function () { |
@@ -877,7 +878,7 @@ describe('Test multiple servers', function () { | |||
877 | const threadId = res1.body.data.find(c => c.text === 'my super first comment').id | 878 | const threadId = res1.body.data.find(c => c.text === 'my super first comment').id |
878 | await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId) | 879 | await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId) |
879 | 880 | ||
880 | await wait(5000) | 881 | await waitJobs(servers) |
881 | }) | 882 | }) |
882 | 883 | ||
883 | it('Should have the thread comments deleted on other servers too', async function () { | 884 | it('Should have the thread comments deleted on other servers too', async function () { |
@@ -910,7 +911,7 @@ describe('Test multiple servers', function () { | |||
910 | 911 | ||
911 | await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes) | 912 | await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes) |
912 | 913 | ||
913 | await wait(5000) | 914 | await waitJobs(servers) |
914 | 915 | ||
915 | for (const server of servers) { | 916 | for (const server of servers) { |
916 | const res = await getVideo(server.url, videoUUID) | 917 | const res = await getVideo(server.url, videoUUID) |
@@ -941,7 +942,7 @@ describe('Test multiple servers', function () { | |||
941 | await req.attach('videofile', filePath) | 942 | await req.attach('videofile', filePath) |
942 | .expect(200) | 943 | .expect(200) |
943 | 944 | ||
944 | await wait(40000) | 945 | await waitJobs(servers) |
945 | 946 | ||
946 | for (const server of servers) { | 947 | for (const server of servers) { |
947 | const res = await getVideosList(server.url) | 948 | const res = await getVideosList(server.url) |
diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.ts index 51db000a2..2f1424292 100644 --- a/server/tests/api/videos/services.ts +++ b/server/tests/api/videos/services.ts | |||
@@ -54,7 +54,8 @@ describe('Test services', function () { | |||
54 | const maxWidth = 50 | 54 | const maxWidth = 50 |
55 | 55 | ||
56 | const res = await getOEmbed(server.url, oembedUrl, format, maxHeight, maxWidth) | 56 | const res = await getOEmbed(server.url, oembedUrl, format, maxHeight, maxWidth) |
57 | const expectedHtml = `<iframe width="50" height="50" src="http://localhost:9001/videos/embed/${server.video.uuid}" ` + | 57 | const expectedHtml = '<iframe width="50" height="50" sandbox="allow-same-origin allow-scripts" ' + |
58 | `src="http://localhost:9001/videos/embed/${server.video.uuid}" ` + | ||
58 | 'frameborder="0" allowfullscreen></iframe>' | 59 | 'frameborder="0" allowfullscreen></iframe>' |
59 | 60 | ||
60 | expect(res.body.html).to.equal(expectedHtml) | 61 | expect(res.body.html).to.equal(expectedHtml) |
@@ -69,10 +70,5 @@ describe('Test services', function () { | |||
69 | 70 | ||
70 | after(async function () { | 71 | after(async function () { |
71 | killallServers([ server ]) | 72 | killallServers([ server ]) |
72 | |||
73 | // Keep the logs if the test failed | ||
74 | if (this['ok']) { | ||
75 | await flushTests() | ||
76 | } | ||
77 | }) | 73 | }) |
78 | }) | 74 | }) |
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index 5e163e9df..d8af94e8f 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts | |||
@@ -5,10 +5,31 @@ import { keyBy } from 'lodash' | |||
5 | import 'mocha' | 5 | import 'mocha' |
6 | import { VideoPrivacy } from '../../../../shared/models/videos' | 6 | import { VideoPrivacy } from '../../../../shared/models/videos' |
7 | import { | 7 | import { |
8 | checkVideoFilesWereRemoved, completeVideoCheck, flushTests, getVideo, getVideoCategories, getVideoLanguages, getVideoLicences, | 8 | checkVideoFilesWereRemoved, |
9 | getVideoPrivacies, getVideosList, getVideosListPagination, getVideosListSort, killallServers, rateVideo, removeVideo, runServer, | 9 | completeVideoCheck, |
10 | searchVideo, searchVideoWithPagination, searchVideoWithSort, ServerInfo, setAccessTokensToServers, testImage, updateVideo, uploadVideo, | 10 | flushTests, |
11 | viewVideo, wait | 11 | getVideo, |
12 | getVideoCategories, | ||
13 | getVideoLanguages, | ||
14 | getVideoLicences, | ||
15 | getVideoPrivacies, | ||
16 | getVideosList, | ||
17 | getVideosListPagination, | ||
18 | getVideosListSort, | ||
19 | killallServers, | ||
20 | rateVideo, | ||
21 | removeVideo, | ||
22 | runServer, | ||
23 | searchVideo, | ||
24 | searchVideoWithPagination, | ||
25 | searchVideoWithSort, | ||
26 | ServerInfo, | ||
27 | setAccessTokensToServers, | ||
28 | testImage, | ||
29 | updateVideo, | ||
30 | uploadVideo, | ||
31 | viewVideo, | ||
32 | wait | ||
12 | } from '../../utils' | 33 | } from '../../utils' |
13 | 34 | ||
14 | const expect = chai.expect | 35 | const expect = chai.expect |
diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts index f1c4ef0ce..dde309b96 100644 --- a/server/tests/api/videos/video-abuse.ts +++ b/server/tests/api/videos/video-abuse.ts | |||
@@ -5,17 +5,16 @@ import 'mocha' | |||
5 | import { VideoAbuse } from '../../../../shared/models/videos' | 5 | import { VideoAbuse } from '../../../../shared/models/videos' |
6 | import { | 6 | import { |
7 | flushAndRunMultipleServers, | 7 | flushAndRunMultipleServers, |
8 | flushTests, | ||
9 | getVideoAbusesList, | 8 | getVideoAbusesList, |
10 | getVideosList, | 9 | getVideosList, |
11 | killallServers, | 10 | killallServers, |
12 | reportVideoAbuse, | 11 | reportVideoAbuse, |
13 | ServerInfo, | 12 | ServerInfo, |
14 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
15 | uploadVideo, | 14 | uploadVideo |
16 | wait | ||
17 | } from '../../utils/index' | 15 | } from '../../utils/index' |
18 | import { doubleFollow } from '../../utils/server/follows' | 16 | import { doubleFollow } from '../../utils/server/follows' |
17 | import { waitJobs } from '../../utils/server/jobs' | ||
19 | 18 | ||
20 | const expect = chai.expect | 19 | const expect = chai.expect |
21 | 20 | ||
@@ -48,7 +47,7 @@ describe('Test video abuses', function () { | |||
48 | await uploadVideo(servers[1].url, servers[1].accessToken, video2Attributes) | 47 | await uploadVideo(servers[1].url, servers[1].accessToken, video2Attributes) |
49 | 48 | ||
50 | // Wait videos propagation, server 2 has transcoding enabled | 49 | // Wait videos propagation, server 2 has transcoding enabled |
51 | await wait(15000) | 50 | await waitJobs(servers) |
52 | 51 | ||
53 | const res = await getVideosList(servers[0].url) | 52 | const res = await getVideosList(servers[0].url) |
54 | const videos = res.body.data | 53 | const videos = res.body.data |
@@ -68,13 +67,13 @@ describe('Test video abuses', function () { | |||
68 | }) | 67 | }) |
69 | 68 | ||
70 | it('Should report abuse on a local video', async function () { | 69 | it('Should report abuse on a local video', async function () { |
71 | this.timeout(10000) | 70 | this.timeout(15000) |
72 | 71 | ||
73 | const reason = 'my super bad reason' | 72 | const reason = 'my super bad reason' |
74 | await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[0].video.id, reason) | 73 | await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[0].video.id, reason) |
75 | 74 | ||
76 | // We wait requests propagation, even if the server 1 is not supposed to make a request to server 2 | 75 | // We wait requests propagation, even if the server 1 is not supposed to make a request to server 2 |
77 | await wait(5000) | 76 | await waitJobs(servers) |
78 | }) | 77 | }) |
79 | 78 | ||
80 | it('Should have 1 video abuses on server 1 and 0 on server 2', async function () { | 79 | it('Should have 1 video abuses on server 1 and 0 on server 2', async function () { |
@@ -103,7 +102,7 @@ describe('Test video abuses', function () { | |||
103 | await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[1].video.id, reason) | 102 | await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[1].video.id, reason) |
104 | 103 | ||
105 | // We wait requests propagation | 104 | // We wait requests propagation |
106 | await wait(5000) | 105 | await waitJobs(servers) |
107 | }) | 106 | }) |
108 | 107 | ||
109 | it('Should have 2 video abuse on server 1 and 1 on server 2', async function () { | 108 | it('Should have 2 video abuse on server 1 and 1 on server 2', async function () { |
@@ -137,10 +136,5 @@ describe('Test video abuses', function () { | |||
137 | 136 | ||
138 | after(async function () { | 137 | after(async function () { |
139 | killallServers(servers) | 138 | killallServers(servers) |
140 | |||
141 | // Keep the logs if the test failed | ||
142 | if (this['ok']) { | ||
143 | await flushTests() | ||
144 | } | ||
145 | }) | 139 | }) |
146 | }) | 140 | }) |
diff --git a/server/tests/api/videos/video-blacklist-management.ts b/server/tests/api/videos/video-blacklist-management.ts index db79784c2..4d1a06436 100644 --- a/server/tests/api/videos/video-blacklist-management.ts +++ b/server/tests/api/videos/video-blacklist-management.ts | |||
@@ -6,7 +6,6 @@ import 'mocha' | |||
6 | import { | 6 | import { |
7 | addVideoToBlacklist, | 7 | addVideoToBlacklist, |
8 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
9 | flushTests, | ||
10 | getBlacklistedVideosList, | 9 | getBlacklistedVideosList, |
11 | getSortedBlacklistedVideosList, | 10 | getSortedBlacklistedVideosList, |
12 | getVideosList, | 11 | getVideosList, |
@@ -14,10 +13,10 @@ import { | |||
14 | removeVideoFromBlacklist, | 13 | removeVideoFromBlacklist, |
15 | ServerInfo, | 14 | ServerInfo, |
16 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
17 | uploadVideo, | 16 | uploadVideo |
18 | wait | ||
19 | } from '../../utils/index' | 17 | } from '../../utils/index' |
20 | import { doubleFollow } from '../../utils/server/follows' | 18 | import { doubleFollow } from '../../utils/server/follows' |
19 | import { waitJobs } from '../../utils/server/jobs' | ||
21 | 20 | ||
22 | const expect = chai.expect | 21 | const expect = chai.expect |
23 | const orderBy = lodash.orderBy | 22 | const orderBy = lodash.orderBy |
@@ -51,7 +50,7 @@ describe('Test video blacklist management', function () { | |||
51 | await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 2nd video', description: 'A video on server 2' }) | 50 | await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 2nd video', description: 'A video on server 2' }) |
52 | 51 | ||
53 | // Wait videos propagation, server 2 has transcoding enabled | 52 | // Wait videos propagation, server 2 has transcoding enabled |
54 | await wait(15000) | 53 | await waitJobs(servers) |
55 | 54 | ||
56 | // Blacklist the two videos on server 1 | 55 | // Blacklist the two videos on server 1 |
57 | await blacklistVideosOnServer(servers[0]) | 56 | await blacklistVideosOnServer(servers[0]) |
@@ -154,9 +153,5 @@ describe('Test video blacklist management', function () { | |||
154 | 153 | ||
155 | after(async function () { | 154 | after(async function () { |
156 | killallServers(servers) | 155 | killallServers(servers) |
157 | |||
158 | if (this['ok']) { | ||
159 | await flushTests() | ||
160 | } | ||
161 | }) | 156 | }) |
162 | }) | 157 | }) |
diff --git a/server/tests/api/videos/video-blacklist.ts b/server/tests/api/videos/video-blacklist.ts index d1cefa5d7..de4c68f1d 100644 --- a/server/tests/api/videos/video-blacklist.ts +++ b/server/tests/api/videos/video-blacklist.ts | |||
@@ -5,16 +5,15 @@ import 'mocha' | |||
5 | import { | 5 | import { |
6 | addVideoToBlacklist, | 6 | addVideoToBlacklist, |
7 | flushAndRunMultipleServers, | 7 | flushAndRunMultipleServers, |
8 | flushTests, | ||
9 | getVideosList, | 8 | getVideosList, |
10 | killallServers, | 9 | killallServers, |
11 | searchVideo, | 10 | searchVideo, |
12 | ServerInfo, | 11 | ServerInfo, |
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | uploadVideo, | 13 | uploadVideo |
15 | wait | ||
16 | } from '../../utils/index' | 14 | } from '../../utils/index' |
17 | import { doubleFollow } from '../../utils/server/follows' | 15 | import { doubleFollow } from '../../utils/server/follows' |
16 | import { waitJobs } from '../../utils/server/jobs' | ||
18 | 17 | ||
19 | const expect = chai.expect | 18 | const expect = chai.expect |
20 | 19 | ||
@@ -41,7 +40,7 @@ describe('Test video blacklists', function () { | |||
41 | await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) | 40 | await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) |
42 | 41 | ||
43 | // Wait videos propagation, server 2 has transcoding enabled | 42 | // Wait videos propagation, server 2 has transcoding enabled |
44 | await wait(10000) | 43 | await waitJobs(servers) |
45 | 44 | ||
46 | const res = await getVideosList(servers[0].url) | 45 | const res = await getVideosList(servers[0].url) |
47 | const videos = res.body.data | 46 | const videos = res.body.data |
@@ -89,10 +88,5 @@ describe('Test video blacklists', function () { | |||
89 | 88 | ||
90 | after(async function () { | 89 | after(async function () { |
91 | killallServers(servers) | 90 | killallServers(servers) |
92 | |||
93 | // Keep the logs if the test failed | ||
94 | if (this['ok']) { | ||
95 | await flushTests() | ||
96 | } | ||
97 | }) | 91 | }) |
98 | }) | 92 | }) |
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 7ae505fd7..ad543e2d6 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -3,7 +3,7 @@ | |||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { User, Video } from '../../../../shared/index' | 5 | import { User, Video } from '../../../../shared/index' |
6 | import { doubleFollow, flushAndRunMultipleServers, getVideoChannelVideos, updateVideo, uploadVideo, wait } from '../../utils' | 6 | import { doubleFollow, flushAndRunMultipleServers, getVideoChannelVideos, updateVideo, uploadVideo } from '../../utils' |
7 | import { | 7 | import { |
8 | addVideoChannel, | 8 | addVideoChannel, |
9 | deleteVideoChannel, | 9 | deleteVideoChannel, |
@@ -17,6 +17,7 @@ import { | |||
17 | setAccessTokensToServers, | 17 | setAccessTokensToServers, |
18 | updateVideoChannel | 18 | updateVideoChannel |
19 | } from '../../utils/index' | 19 | } from '../../utils/index' |
20 | import { waitJobs } from '../../utils/server/jobs' | ||
20 | 21 | ||
21 | const expect = chai.expect | 22 | const expect = chai.expect |
22 | 23 | ||
@@ -49,7 +50,7 @@ describe('Test video channels', function () { | |||
49 | firstVideoChannelUUID = user.videoChannels[0].uuid | 50 | firstVideoChannelUUID = user.videoChannels[0].uuid |
50 | } | 51 | } |
51 | 52 | ||
52 | await wait(5000) | 53 | await waitJobs(servers) |
53 | }) | 54 | }) |
54 | 55 | ||
55 | it('Should have one video channel (created with root)', async () => { | 56 | it('Should have one video channel (created with root)', async () => { |
@@ -80,7 +81,7 @@ describe('Test video channels', function () { | |||
80 | videoUUID = res.body.video.uuid | 81 | videoUUID = res.body.video.uuid |
81 | } | 82 | } |
82 | 83 | ||
83 | await wait(3000) | 84 | await waitJobs(servers) |
84 | }) | 85 | }) |
85 | 86 | ||
86 | it('Should have two video channels when getting my information', async () => { | 87 | it('Should have two video channels when getting my information', async () => { |
@@ -142,7 +143,7 @@ describe('Test video channels', function () { | |||
142 | 143 | ||
143 | await updateVideoChannel(servers[0].url, servers[0].accessToken, secondVideoChannelId, videoChannelAttributes) | 144 | await updateVideoChannel(servers[0].url, servers[0].accessToken, secondVideoChannelId, videoChannelAttributes) |
144 | 145 | ||
145 | await wait(3000) | 146 | await waitJobs(servers) |
146 | }) | 147 | }) |
147 | 148 | ||
148 | it('Should have video channel updated', async function () { | 149 | it('Should have video channel updated', async function () { |
@@ -184,7 +185,7 @@ describe('Test video channels', function () { | |||
184 | 185 | ||
185 | await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, { channelId: firstVideoChannelId }) | 186 | await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, { channelId: firstVideoChannelId }) |
186 | 187 | ||
187 | await wait(5000) | 188 | await waitJobs(servers) |
188 | }) | 189 | }) |
189 | 190 | ||
190 | it('Should list the first video channel videos', async function () { | 191 | it('Should list the first video channel videos', async function () { |
@@ -219,10 +220,5 @@ describe('Test video channels', function () { | |||
219 | 220 | ||
220 | after(async function () { | 221 | after(async function () { |
221 | killallServers(servers) | 222 | killallServers(servers) |
222 | |||
223 | // Keep the logs if the test failed | ||
224 | if (this['ok']) { | ||
225 | await flushTests() | ||
226 | } | ||
227 | }) | 223 | }) |
228 | }) | 224 | }) |
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index f83d95088..d6e07c5b3 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts | |||
@@ -5,11 +5,20 @@ import 'mocha' | |||
5 | import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' | 5 | import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' |
6 | import { testImage } from '../../utils' | 6 | import { testImage } from '../../utils' |
7 | import { | 7 | import { |
8 | dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, updateMyAvatar, | 8 | dateIsValid, |
9 | flushTests, | ||
10 | killallServers, | ||
11 | runServer, | ||
12 | ServerInfo, | ||
13 | setAccessTokensToServers, | ||
14 | updateMyAvatar, | ||
9 | uploadVideo | 15 | uploadVideo |
10 | } from '../../utils/index' | 16 | } from '../../utils/index' |
11 | import { | 17 | import { |
12 | addVideoCommentReply, addVideoCommentThread, deleteVideoComment, getVideoCommentThreads, | 18 | addVideoCommentReply, |
19 | addVideoCommentThread, | ||
20 | deleteVideoComment, | ||
21 | getVideoCommentThreads, | ||
13 | getVideoThreadComments | 22 | getVideoThreadComments |
14 | } from '../../utils/videos/video-comments' | 23 | } from '../../utils/videos/video-comments' |
15 | 24 | ||
@@ -194,10 +203,5 @@ describe('Test video comments', function () { | |||
194 | 203 | ||
195 | after(async function () { | 204 | after(async function () { |
196 | killallServers([ server ]) | 205 | killallServers([ server ]) |
197 | |||
198 | // Keep the logs if the test failed | ||
199 | if (this['ok']) { | ||
200 | await flushTests() | ||
201 | } | ||
202 | }) | 206 | }) |
203 | }) | 207 | }) |
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts index c2985194c..dd5cd78c0 100644 --- a/server/tests/api/videos/video-description.ts +++ b/server/tests/api/videos/video-description.ts | |||
@@ -4,7 +4,6 @@ import * as chai from 'chai' | |||
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { | 5 | import { |
6 | flushAndRunMultipleServers, | 6 | flushAndRunMultipleServers, |
7 | flushTests, | ||
8 | getVideo, | 7 | getVideo, |
9 | getVideoDescription, | 8 | getVideoDescription, |
10 | getVideosList, | 9 | getVideosList, |
@@ -12,10 +11,10 @@ import { | |||
12 | ServerInfo, | 11 | ServerInfo, |
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | updateVideo, | 13 | updateVideo, |
15 | uploadVideo, | 14 | uploadVideo |
16 | wait | ||
17 | } from '../../utils/index' | 15 | } from '../../utils/index' |
18 | import { doubleFollow } from '../../utils/server/follows' | 16 | import { doubleFollow } from '../../utils/server/follows' |
17 | import { waitJobs } from '../../utils/server/jobs' | ||
19 | 18 | ||
20 | const expect = chai.expect | 19 | const expect = chai.expect |
21 | 20 | ||
@@ -46,7 +45,7 @@ describe('Test video description', function () { | |||
46 | } | 45 | } |
47 | await uploadVideo(servers[0].url, servers[0].accessToken, attributes) | 46 | await uploadVideo(servers[0].url, servers[0].accessToken, attributes) |
48 | 47 | ||
49 | await wait(5000) | 48 | await waitJobs(servers) |
50 | 49 | ||
51 | const res = await getVideosList(servers[0].url) | 50 | const res = await getVideosList(servers[0].url) |
52 | 51 | ||
@@ -85,7 +84,7 @@ describe('Test video description', function () { | |||
85 | } | 84 | } |
86 | await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes) | 85 | await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes) |
87 | 86 | ||
88 | await wait(5000) | 87 | await waitJobs(servers) |
89 | }) | 88 | }) |
90 | 89 | ||
91 | it('Should have a small description on each server', async function () { | 90 | it('Should have a small description on each server', async function () { |
@@ -102,10 +101,5 @@ describe('Test video description', function () { | |||
102 | 101 | ||
103 | after(async function () { | 102 | after(async function () { |
104 | killallServers(servers) | 103 | killallServers(servers) |
105 | |||
106 | // Keep the logs if the test failed | ||
107 | if (this['ok']) { | ||
108 | await flushTests() | ||
109 | } | ||
110 | }) | 104 | }) |
111 | }) | 105 | }) |
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index a8f152561..6af0ca8af 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts | |||
@@ -8,12 +8,15 @@ import { createUser } from '../../utils/users/users' | |||
8 | import { getMyVideos } from '../../utils/videos/videos' | 8 | import { getMyVideos } from '../../utils/videos/videos' |
9 | import { | 9 | import { |
10 | getAccountVideos, | 10 | getAccountVideos, |
11 | getConfig, getCustomConfig, | 11 | getConfig, |
12 | getMyUserInformation, getVideoChannelVideos, | 12 | getCustomConfig, |
13 | getMyUserInformation, | ||
14 | getVideoChannelVideos, | ||
13 | getVideosListWithToken, | 15 | getVideosListWithToken, |
14 | runServer, | 16 | runServer, |
15 | searchVideo, | 17 | searchVideo, |
16 | searchVideoWithToken, updateCustomConfig, | 18 | searchVideoWithToken, |
19 | updateCustomConfig, | ||
17 | updateMyUser | 20 | updateMyUser |
18 | } from '../../utils' | 21 | } from '../../utils' |
19 | import { ServerConfig } from '../../../../shared/models' | 22 | import { ServerConfig } from '../../../../shared/models' |
@@ -201,10 +204,5 @@ describe('Test video NSFW policy', function () { | |||
201 | 204 | ||
202 | after(async function () { | 205 | after(async function () { |
203 | killallServers([ server ]) | 206 | killallServers([ server ]) |
204 | |||
205 | // Keep the logs if the test failed | ||
206 | if (this['ok']) { | ||
207 | await flushTests() | ||
208 | } | ||
209 | }) | 207 | }) |
210 | }) | 208 | }) |
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index ea435d5af..9fefca7e3 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts | |||
@@ -5,18 +5,17 @@ import 'mocha' | |||
5 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' | 5 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' |
6 | import { | 6 | import { |
7 | flushAndRunMultipleServers, | 7 | flushAndRunMultipleServers, |
8 | flushTests, | ||
9 | getVideosList, | 8 | getVideosList, |
10 | killallServers, | 9 | killallServers, |
11 | ServerInfo, | 10 | ServerInfo, |
12 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
13 | uploadVideo, | 12 | uploadVideo |
14 | wait | ||
15 | } from '../../utils/index' | 13 | } from '../../utils/index' |
16 | import { doubleFollow } from '../../utils/server/follows' | 14 | import { doubleFollow } from '../../utils/server/follows' |
17 | import { userLogin } from '../../utils/users/login' | 15 | import { userLogin } from '../../utils/users/login' |
18 | import { createUser } from '../../utils/users/users' | 16 | import { createUser } from '../../utils/users/users' |
19 | import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../utils/videos/videos' | 17 | import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../utils/videos/videos' |
18 | import { waitJobs } from '../../utils/server/jobs' | ||
20 | 19 | ||
21 | const expect = chai.expect | 20 | const expect = chai.expect |
22 | 21 | ||
@@ -48,7 +47,7 @@ describe('Test video privacy', function () { | |||
48 | } | 47 | } |
49 | await uploadVideo(servers[0].url, servers[0].accessToken, attributes) | 48 | await uploadVideo(servers[0].url, servers[0].accessToken, attributes) |
50 | 49 | ||
51 | await wait(5000) | 50 | await waitJobs(servers) |
52 | }) | 51 | }) |
53 | 52 | ||
54 | it('Should not have this private video on server 2', async function () { | 53 | it('Should not have this private video on server 2', async function () { |
@@ -99,7 +98,7 @@ describe('Test video privacy', function () { | |||
99 | await uploadVideo(servers[1].url, servers[1].accessToken, attributes) | 98 | await uploadVideo(servers[1].url, servers[1].accessToken, attributes) |
100 | 99 | ||
101 | // Server 2 has transcoding enabled | 100 | // Server 2 has transcoding enabled |
102 | await wait(10000) | 101 | await waitJobs(servers) |
103 | }) | 102 | }) |
104 | 103 | ||
105 | it('Should not have this unlisted video listed on server 1 and 2', async function () { | 104 | it('Should not have this unlisted video listed on server 1 and 2', async function () { |
@@ -139,7 +138,7 @@ describe('Test video privacy', function () { | |||
139 | now = Date.now() | 138 | now = Date.now() |
140 | await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute) | 139 | await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute) |
141 | 140 | ||
142 | await wait(5000) | 141 | await waitJobs(servers) |
143 | }) | 142 | }) |
144 | 143 | ||
145 | it('Should have this new public video listed on server 1 and 2', async function () { | 144 | it('Should have this new public video listed on server 1 and 2', async function () { |
@@ -155,10 +154,5 @@ describe('Test video privacy', function () { | |||
155 | 154 | ||
156 | after(async function () { | 155 | after(async function () { |
157 | killallServers(servers) | 156 | killallServers(servers) |
158 | |||
159 | // Keep the logs if the test failed | ||
160 | if (this['ok']) { | ||
161 | await flushTests() | ||
162 | } | ||
163 | }) | 157 | }) |
164 | }) | 158 | }) |
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index 1eace6491..2b203c26b 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -7,7 +7,6 @@ import { getVideoFileFPS } from '../../../helpers/ffmpeg-utils' | |||
7 | import { | 7 | import { |
8 | doubleFollow, | 8 | doubleFollow, |
9 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
10 | flushTests, | ||
11 | getMyVideos, | 10 | getMyVideos, |
12 | getVideo, | 11 | getVideo, |
13 | getVideosList, | 12 | getVideosList, |
@@ -16,10 +15,10 @@ import { | |||
16 | ServerInfo, | 15 | ServerInfo, |
17 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
18 | uploadVideo, | 17 | uploadVideo, |
19 | wait, | ||
20 | webtorrentAdd | 18 | webtorrentAdd |
21 | } from '../../utils' | 19 | } from '../../utils' |
22 | import { join } from 'path' | 20 | import { join } from 'path' |
21 | import { waitJobs } from '../../utils/server/jobs' | ||
23 | 22 | ||
24 | const expect = chai.expect | 23 | const expect = chai.expect |
25 | 24 | ||
@@ -45,7 +44,7 @@ describe('Test video transcoding', function () { | |||
45 | } | 44 | } |
46 | await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) | 45 | await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) |
47 | 46 | ||
48 | await wait(10000) | 47 | await waitJobs(servers) |
49 | 48 | ||
50 | const res = await getVideosList(servers[0].url) | 49 | const res = await getVideosList(servers[0].url) |
51 | const video = res.body.data[0] | 50 | const video = res.body.data[0] |
@@ -73,7 +72,7 @@ describe('Test video transcoding', function () { | |||
73 | } | 72 | } |
74 | await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) | 73 | await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) |
75 | 74 | ||
76 | await wait(20000) | 75 | await waitJobs(servers) |
77 | 76 | ||
78 | const res = await getVideosList(servers[1].url) | 77 | const res = await getVideosList(servers[1].url) |
79 | 78 | ||
@@ -102,7 +101,7 @@ describe('Test video transcoding', function () { | |||
102 | } | 101 | } |
103 | await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) | 102 | await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) |
104 | 103 | ||
105 | await wait(20000) | 104 | await waitJobs(servers) |
106 | 105 | ||
107 | const res = await getVideosList(servers[1].url) | 106 | const res = await getVideosList(servers[1].url) |
108 | 107 | ||
@@ -125,7 +124,7 @@ describe('Test video transcoding', function () { | |||
125 | 124 | ||
126 | await doubleFollow(servers[0], servers[1]) | 125 | await doubleFollow(servers[0], servers[1]) |
127 | 126 | ||
128 | await wait(15000) | 127 | await waitJobs(servers) |
129 | 128 | ||
130 | { | 129 | { |
131 | // Upload the video, but wait transcoding | 130 | // Upload the video, but wait transcoding |
@@ -161,7 +160,7 @@ describe('Test video transcoding', function () { | |||
161 | await getVideo(servers[0].url, videoId, 404) | 160 | await getVideo(servers[0].url, videoId, 404) |
162 | } | 161 | } |
163 | 162 | ||
164 | await wait(30000) | 163 | await waitJobs(servers) |
165 | 164 | ||
166 | for (const server of servers) { | 165 | for (const server of servers) { |
167 | const res = await getVideosList(server.url) | 166 | const res = await getVideosList(server.url) |
@@ -179,10 +178,5 @@ describe('Test video transcoding', function () { | |||
179 | 178 | ||
180 | after(async function () { | 179 | after(async function () { |
181 | killallServers(servers) | 180 | killallServers(servers) |
182 | |||
183 | // Keep the logs if the test failed | ||
184 | if (this['ok']) { | ||
185 | await flushTests() | ||
186 | } | ||
187 | }) | 181 | }) |
188 | }) | 182 | }) |