aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-23 16:39:51 +0100
committerChocobozzz <me@florianbigard.com>2018-02-23 16:44:37 +0100
commitb5c0e95544cec5a33cee3df41c1607d2a0cd5403 (patch)
tree38a5db1faed107f7b75583c32125152812594821 /server/tests
parente3bb78a2134a5e5755b6dbd8987894572ca31269 (diff)
downloadPeerTube-b5c0e95544cec5a33cee3df41c1607d2a0cd5403.tar.gz
PeerTube-b5c0e95544cec5a33cee3df41c1607d2a0cd5403.tar.zst
PeerTube-b5c0e95544cec5a33cee3df41c1607d2a0cd5403.zip
Avoids easy cheating on vidoe views
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/videos/multiple-servers.ts17
-rw-r--r--server/tests/api/videos/single-server.ts20
2 files changed, 27 insertions, 10 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index c82ac1348..27c4c30b8 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -421,15 +421,22 @@ describe('Test multiple servers', function () {
421 }) 421 })
422 422
423 it('Should view multiple videos on owned servers', async function () { 423 it('Should view multiple videos on owned servers', async function () {
424 this.timeout(10000) 424 this.timeout(15000)
425 425
426 const tasks: Promise<any>[] = [] 426 const tasks: Promise<any>[] = []
427 tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) 427 await viewVideo(servers[2].url, localVideosServer3[0])
428 tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) 428 await viewVideo(servers[2].url, localVideosServer3[0])
429 tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) 429 await viewVideo(servers[2].url, localVideosServer3[0])
430 tasks.push(viewVideo(servers[2].url, localVideosServer3[1])) 430 await viewVideo(servers[2].url, localVideosServer3[1])
431 431
432 await Promise.all(tasks) 432 await Promise.all(tasks)
433 await wait(1500)
434
435 await viewVideo(servers[2].url, localVideosServer3[0])
436
437 await wait(1500)
438
439 await viewVideo(servers[2].url, localVideosServer3[0])
433 440
434 await wait(5000) 441 await wait(5000)
435 442
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 83b6a0e9a..cf2721838 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -8,7 +8,7 @@ import {
8 checkVideoFilesWereRemoved, completeVideoCheck, flushTests, getVideo, getVideoCategories, getVideoLanguages, getVideoLicences, 8 checkVideoFilesWereRemoved, completeVideoCheck, flushTests, getVideo, getVideoCategories, getVideoLanguages, getVideoLicences,
9 getVideoPrivacies, getVideosList, getVideosListPagination, getVideosListSort, killallServers, rateVideo, removeVideo, runServer, 9 getVideoPrivacies, getVideosList, getVideosListPagination, getVideosListSort, killallServers, rateVideo, removeVideo, runServer,
10 searchVideo, searchVideoWithPagination, searchVideoWithSort, ServerInfo, setAccessTokensToServers, testImage, updateVideo, uploadVideo, 10 searchVideo, searchVideoWithPagination, searchVideoWithSort, ServerInfo, setAccessTokensToServers, testImage, updateVideo, uploadVideo,
11 viewVideo 11 viewVideo, wait
12} from '../../utils' 12} from '../../utils'
13 13
14const expect = chai.expect 14const expect = chai.expect
@@ -149,8 +149,7 @@ describe('Test a single server', function () {
149 }) 149 })
150 150
151 it('Should get and seed the uploaded video', async function () { 151 it('Should get and seed the uploaded video', async function () {
152 // Yes, this could be long 152 this.timeout(5000)
153 this.timeout(60000)
154 153
155 const res = await getVideosList(server.url) 154 const res = await getVideosList(server.url)
156 155
@@ -163,8 +162,7 @@ describe('Test a single server', function () {
163 }) 162 })
164 163
165 it('Should get the video by UUID', async function () { 164 it('Should get the video by UUID', async function () {
166 // Yes, this could be long 165 this.timeout(5000)
167 this.timeout(60000)
168 166
169 const res = await getVideo(server.url, videoUUID) 167 const res = await getVideo(server.url, videoUUID)
170 168
@@ -173,10 +171,22 @@ describe('Test a single server', function () {
173 }) 171 })
174 172
175 it('Should have the views updated', async function () { 173 it('Should have the views updated', async function () {
174 this.timeout(10000)
175
176 await viewVideo(server.url, videoId) 176 await viewVideo(server.url, videoId)
177 await viewVideo(server.url, videoId) 177 await viewVideo(server.url, videoId)
178 await viewVideo(server.url, videoId) 178 await viewVideo(server.url, videoId)
179 179
180 await wait(1500)
181
182 await viewVideo(server.url, videoId)
183 await viewVideo(server.url, videoId)
184
185 await wait(1500)
186
187 await viewVideo(server.url, videoId)
188 await viewVideo(server.url, videoId)
189
180 const res = await getVideo(server.url, videoId) 190 const res = await getVideo(server.url, videoId)
181 191
182 const video = res.body 192 const video = res.body