From b5c0e95544cec5a33cee3df41c1607d2a0cd5403 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 23 Feb 2018 16:39:51 +0100 Subject: Avoids easy cheating on vidoe views --- server/tests/api/videos/multiple-servers.ts | 17 ++++++++++++----- server/tests/api/videos/single-server.ts | 20 +++++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) (limited to 'server/tests') 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 () { }) it('Should view multiple videos on owned servers', async function () { - this.timeout(10000) + this.timeout(15000) const tasks: Promise[] = [] - tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) - tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) - tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) - tasks.push(viewVideo(servers[2].url, localVideosServer3[1])) + await viewVideo(servers[2].url, localVideosServer3[0]) + await viewVideo(servers[2].url, localVideosServer3[0]) + await viewVideo(servers[2].url, localVideosServer3[0]) + await viewVideo(servers[2].url, localVideosServer3[1]) await Promise.all(tasks) + await wait(1500) + + await viewVideo(servers[2].url, localVideosServer3[0]) + + await wait(1500) + + await viewVideo(servers[2].url, localVideosServer3[0]) await wait(5000) 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 { checkVideoFilesWereRemoved, completeVideoCheck, flushTests, getVideo, getVideoCategories, getVideoLanguages, getVideoLicences, getVideoPrivacies, getVideosList, getVideosListPagination, getVideosListSort, killallServers, rateVideo, removeVideo, runServer, searchVideo, searchVideoWithPagination, searchVideoWithSort, ServerInfo, setAccessTokensToServers, testImage, updateVideo, uploadVideo, - viewVideo + viewVideo, wait } from '../../utils' const expect = chai.expect @@ -149,8 +149,7 @@ describe('Test a single server', function () { }) it('Should get and seed the uploaded video', async function () { - // Yes, this could be long - this.timeout(60000) + this.timeout(5000) const res = await getVideosList(server.url) @@ -163,8 +162,7 @@ describe('Test a single server', function () { }) it('Should get the video by UUID', async function () { - // Yes, this could be long - this.timeout(60000) + this.timeout(5000) const res = await getVideo(server.url, videoUUID) @@ -173,10 +171,22 @@ describe('Test a single server', function () { }) it('Should have the views updated', async function () { + this.timeout(10000) + await viewVideo(server.url, videoId) await viewVideo(server.url, videoId) await viewVideo(server.url, videoId) + await wait(1500) + + await viewVideo(server.url, videoId) + await viewVideo(server.url, videoId) + + await wait(1500) + + await viewVideo(server.url, videoId) + await viewVideo(server.url, videoId) + const res = await getVideo(server.url, videoId) const video = res.body -- cgit v1.2.3