]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/single-server.ts
Added "total views" in the my channels list (#5007)
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / single-server.ts
index a0e4a156c584cc495ad29855c6a0ab8feee0207b..0e429fef75864baf85eea300e6d33ef026efc6b8 100644 (file)
@@ -2,17 +2,17 @@
 
 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,
-  completeVideoCheck,
   createSingleServer,
   PeerTubeServer,
   setAccessTokensToServers,
-  testImage,
-  wait
-} from '@shared/extra-utils'
-import { Video, VideoPrivacy } from '@shared/models'
+  setDefaultAccountAvatar,
+  setDefaultChannelAvatar
+} from '@shared/server-commands'
 
 const expect = chai.expect
 
@@ -97,6 +97,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 +179,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)