]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/single-server.ts
Fix video play promise error on non supported browsers
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / single-server.ts
index 2a3126f3258df29ace508ab6c18d00dc458ff18f..476a25479ebc2c69092516bfd4152f44437ebe3b 100644 (file)
@@ -3,12 +3,12 @@
 import * as chai from 'chai'
 import { keyBy } from 'lodash'
 import 'mocha'
-import { join } from 'path'
 import { VideoPrivacy } from '../../../../shared/models/videos'
 import {
-  completeVideoCheck, flushTests, getVideo, getVideoCategories, getVideoLanguages, getVideoLicences, getVideoPrivacies,
-  getVideosList, getVideosListPagination, getVideosListSort, killallServers, rateVideo, readdirPromise, removeVideo, runServer, searchVideo,
-  searchVideoWithPagination, searchVideoWithSort, ServerInfo, setAccessTokensToServers, testVideoImage, updateVideo, uploadVideo, viewVideo
+  checkVideoFilesWereRemoved, completeVideoCheck, flushTests, getVideo, getVideoCategories, getVideoLanguages, getVideoLicences,
+  getVideoPrivacies, getVideosList, getVideosListPagination, getVideosListSort, killallServers, rateVideo, removeVideo, runServer,
+  searchVideo, searchVideoWithPagination, searchVideoWithSort, ServerInfo, setAccessTokensToServers, testImage, updateVideo, uploadVideo,
+  viewVideo
 } from '../../utils'
 
 const expect = chai.expect
@@ -32,6 +32,7 @@ describe('Test a single server', function () {
     duration: 5,
     tags: [ 'tag1', 'tag2', 'tag3' ],
     privacy: VideoPrivacy.PUBLIC,
+    commentsEnabled: true,
     channel: {
       name: 'Default root channel',
       description: '',
@@ -51,7 +52,7 @@ describe('Test a single server', function () {
     category: 4,
     licence: 2,
     language: 5,
-    nsfw: true,
+    nsfw: false,
     description: 'my super description updated',
     host: 'localhost:9001',
     account: 'root',
@@ -59,6 +60,7 @@ describe('Test a single server', function () {
     tags: [ 'tagup1', 'tagup2' ],
     privacy: VideoPrivacy.PUBLIC,
     duration: 5,
+    commentsEnabled: false,
     channel: {
       name: 'Default root channel',
       description: '',
@@ -74,7 +76,7 @@ describe('Test a single server', function () {
   }
 
   before(async function () {
-    this.timeout(10000)
+    this.timeout(30000)
 
     await flushTests()
 
@@ -274,11 +276,7 @@ describe('Test a single server', function () {
   it('Should remove the video', async function () {
     await removeVideo(server.url, server.accessToken, videoId)
 
-    const files1 = await readdirPromise(join(__dirname, '..', '..', '..', '..', 'test1', 'videos'))
-    expect(files1).to.have.lengthOf(0)
-
-    const files2 = await readdirPromise(join(__dirname, '..', '..', '..', '..', 'test1', 'thumbnails'))
-    expect(files2).to.have.lengthOf(0)
+    await checkVideoFilesWereRemoved(videoUUID, 1)
   })
 
   it('Should not have videos', async function () {
@@ -343,7 +341,7 @@ describe('Test a single server', function () {
 
     for (const video of videos) {
       const videoName = video.name.replace(' name', '')
-      const test = await testVideoImage(server.url, videoName, video.thumbnailPath)
+      const test = await testImage(server.url, videoName, video.thumbnailPath)
 
       expect(test).to.equal(true)
     }
@@ -475,6 +473,7 @@ describe('Test a single server', function () {
       language: 5,
       nsfw: false,
       description: 'my super description updated',
+      commentsEnabled: false,
       tags: [ 'tagup1', 'tagup2' ]
     }
     await updateVideo(server.url, server.accessToken, videoId, attributes)