1 /* tslint:disable:no-unused-expression */
3 import * as chai from 'chai'
5 import { join } from 'path'
6 import * as request from 'supertest'
7 import { VideoPrivacy } from '../../../../shared/models/videos'
8 import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
12 checkVideoFilesWereRemoved,
17 flushAndRunMultipleServers,
27 setAccessTokensToServers,
35 } from '../../../../shared/utils'
38 addVideoCommentThread,
40 getVideoCommentThreads,
41 getVideoThreadComments
42 } from '../../../../shared/utils/videos/video-comments'
43 import { waitJobs } from '../../../../shared/utils/server/jobs'
45 const expect = chai.expect
47 describe('Test video playlists', function () {
48 let servers: ServerInfo[] = []
50 before(async function () {
53 servers = await flushAndRunMultipleServers(3)
55 // Get the access tokens
56 await setAccessTokensToServers(servers)
58 // Server 1 and server 2 follow each other
59 await doubleFollow(servers[0], servers[1])
60 // Server 1 and server 3 follow each other
61 await doubleFollow(servers[0], servers[2])
64 it('Should create a playlist on server 1 and have the playlist on server 2 and 3', async function () {
68 it('Should create a playlist on server 2 and have the playlist on server 1 but not on server 3', async function () {
69 // create 2 playlists (with videos and no videos)
70 // With thumbnail and no thumbnail
73 it('Should have the playlist on server 3 after a new follow', async function () {
74 // Server 2 and server 3 follow each other
75 await doubleFollow(servers[1], servers[2])
78 it('Should create some playlists and list them correctly', async function () {
79 // create 3 playlists with some videos in it
85 it('Should list video channel playlists', async function () {
91 it('Should list account playlists', async function () {
97 it('Should get a playlist', async function () {
99 // get non empty playlist
102 it('Should update a playlist', async function () {
105 // update other details
108 it('Should create a playlist containing different startTimestamp/endTimestamp videos', async function () {
112 it('Should correctly list playlist videos', async function () {
117 it('Should reorder the playlist', async function () {
119 // reorder 3 elements
120 // reorder at the beginning
121 // reorder at the end
122 // reorder before/after
125 it('Should update startTimestamp/endTimestamp of some elements', async function () {
129 it('Should delete some elements', async function () {
133 it('Should delete the playlist on server 1 and delete on server 2 and 3', async function () {
137 it('Should have deleted the thumbnail on server 1, 2 and 3', async function () {
141 it('Should unfollow servers 1 and 2 and hide their playlists', async function () {
145 it('Should delete a channel and remove the associated playlist', async function () {
149 it('Should delete an account and delete its playlists', async function () {
153 after(async function () {
154 killallServers(servers)
156 // Keep the logs if the test failed