X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fsingle-server.ts;h=c1d86776a00d1031d7c85c0f967001598bbc39c7;hb=0567049a9819d67070aa6d548a75a7e632a4aaa4;hp=e5e12dd1918333685f877a3d9b9c6e2668bdc026;hpb=bf54587a3e2ad9c2c186828f2a5682b91ee2cc00;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index e5e12dd19..c1d86776a 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -2,17 +2,18 @@ import 'mocha' import * as chai from 'chai' +import { checkVideoFilesWereRemoved, completeVideoCheck, testImage } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { Video, VideoPrivacy } from '@shared/models' import { - checkVideoFilesWereRemoved, cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, - testImage, - wait + setDefaultAccountAvatar, + setDefaultChannelAvatar, + waitJobs } from '@shared/server-commands' -import { Video, VideoPrivacy } from '@shared/models' -import { completeVideoCheck } from '@server/tests/shared/video' const expect = chai.expect @@ -97,6 +98,8 @@ describe('Test a single server', function () { server = await createSingleServer(1) await setAccessTokensToServers([ server ]) + await setDefaultChannelAvatar(server) + await setDefaultAccountAvatar(server) }) it('Should list video categories', async function () { @@ -177,22 +180,21 @@ describe('Test a single server', function () { it('Should have the views updated', async function () { this.timeout(20000) - await server.videos.view({ id: videoId }) - await server.videos.view({ id: videoId }) - await server.videos.view({ id: videoId }) + await server.views.simulateView({ id: videoId }) + await server.views.simulateView({ id: videoId }) + await server.views.simulateView({ id: videoId }) await wait(1500) - await server.videos.view({ id: videoId }) - await server.videos.view({ id: videoId }) + await server.views.simulateView({ id: videoId }) + await server.views.simulateView({ id: videoId }) await wait(1500) - await server.videos.view({ id: videoId }) - await server.videos.view({ id: videoId }) + await server.views.simulateView({ id: videoId }) + await server.views.simulateView({ id: videoId }) - // Wait the repeatable job - await wait(8000) + await server.debug.sendCommand({ body: { command: 'process-video-views-buffer' } }) const video = await server.videos.get({ id: videoId }) expect(video.views).to.equal(3) @@ -357,6 +359,8 @@ describe('Test a single server', function () { it('Should have the video updated', async function () { this.timeout(60000) + await waitJobs([ server ]) + const video = await server.videos.get({ id: videoId }) await completeVideoCheck(server, video, updateCheckAttributes())