1 /* tslint:disable:no-unused-expression */
3 import * as chai from 'chai'
4 import { keyBy } from 'lodash'
6 import { join } from 'path'
7 import * as request from 'supertest'
17 getVideosListPagination,
25 searchVideoWithPagination,
28 setAccessTokensToServers,
35 import { viewVideo } from '../utils/videos'
37 const expect = chai.expect
39 describe('Test a single server', function () {
40 let server: ServerInfo = null
43 let videosListBase: any[] = null
45 before(async function () {
50 server = await runServer(1)
52 await setAccessTokensToServers([ server ])
55 it('Should list video categories', async function () {
56 const res = await getVideoCategories(server.url)
58 const categories = res.body
59 expect(Object.keys(categories)).to.have.length.above(10)
61 expect(categories[11]).to.equal('News')
64 it('Should list video licences', async function () {
65 const res = await getVideoLicences(server.url)
67 const licences = res.body
68 expect(Object.keys(licences)).to.have.length.above(5)
70 expect(licences[3]).to.equal('Attribution - No Derivatives')
73 it('Should list video languages', async function () {
74 const res = await getVideoLanguages(server.url)
76 const languages = res.body
77 expect(Object.keys(languages)).to.have.length.above(5)
79 expect(languages[3]).to.equal('Mandarin')
82 it('Should list video privacies', async function () {
83 const res = await getVideoPrivacies(server.url)
85 const privacies = res.body
86 expect(Object.keys(privacies)).to.have.length.at.least(3)
88 expect(privacies[3]).to.equal('Private')
91 it('Should not have videos', async function () {
92 const res = await getVideosList(server.url)
94 expect(res.body.total).to.equal(0)
95 expect(res.body.data).to.be.an('array')
96 expect(res.body.data.length).to.equal(0)
99 it('Should upload the video', async function () {
100 const videoAttributes = {
101 name: 'my super name',
105 tags: [ 'tag1', 'tag2', 'tag3' ]
107 const res = await uploadVideo(server.url, server.accessToken, videoAttributes)
108 expect(res.body.video).to.not.be.undefined
109 expect(res.body.video.id).to.equal(1)
110 expect(res.body.video.uuid).to.have.length.above(5)
113 it('Should seed the uploaded video', async function () {
114 // Yes, this could be long
117 const res = await getVideosList(server.url)
119 expect(res.body.total).to.equal(1)
120 expect(res.body.data).to.be.an('array')
121 expect(res.body.data.length).to.equal(1)
123 const video = res.body.data[0]
124 expect(video.name).to.equal('my super name')
125 expect(video.category).to.equal(2)
126 expect(video.categoryLabel).to.equal('Films')
127 expect(video.licence).to.equal(6)
128 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
129 expect(video.language).to.equal(3)
130 expect(video.languageLabel).to.equal('Mandarin')
131 expect(video.nsfw).to.be.ok
132 expect(video.description).to.equal('my super description')
133 expect(video.serverHost).to.equal('localhost:9001')
134 expect(video.accountName).to.equal('root')
135 expect(video.isLocal).to.be.true
136 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
137 expect(dateIsValid(video.createdAt)).to.be.true
138 expect(dateIsValid(video.updatedAt)).to.be.true
140 const res2 = await getVideo(server.url, res.body.data[0].id)
141 const videoDetails = res2.body
143 expect(videoDetails.files).to.have.lengthOf(1)
145 const file = videoDetails.files[0]
146 const magnetUri = file.magnetUri
147 expect(file.magnetUri).to.have.lengthOf.above(2)
148 expect(file.torrentUrl).to.equal(`${server.url}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
149 expect(file.fileUrl).to.equal(`${server.url}/static/webseed/${videoDetails.uuid}-${file.resolution}.webm`)
150 expect(file.resolution).to.equal(720)
151 expect(file.resolutionLabel).to.equal('720p')
152 expect(file.size).to.equal(218910)
154 const test = await testVideoImage(server.url, 'video_short.webm', videoDetails.thumbnailPath)
155 expect(test).to.equal(true)
157 videoId = videoDetails.id
158 videoUUID = videoDetails.uuid
160 const torrent = await webtorrentAdd(magnetUri)
161 expect(torrent.files).to.be.an('array')
162 expect(torrent.files.length).to.equal(1)
163 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
166 it('Should get the video', async function () {
167 // Yes, this could be long
170 const res = await getVideo(server.url, videoId)
172 const video = res.body
173 expect(video.name).to.equal('my super name')
174 expect(video.category).to.equal(2)
175 expect(video.categoryLabel).to.equal('Films')
176 expect(video.licence).to.equal(6)
177 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
178 expect(video.language).to.equal(3)
179 expect(video.languageLabel).to.equal('Mandarin')
180 expect(video.nsfw).to.be.ok
181 expect(video.description).to.equal('my super description')
182 expect(video.serverHost).to.equal('localhost:9001')
183 expect(video.accountName).to.equal('root')
184 expect(video.isLocal).to.be.true
185 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
186 expect(dateIsValid(video.createdAt)).to.be.true
187 expect(dateIsValid(video.updatedAt)).to.be.true
188 expect(video.channel.name).to.equal('Default root channel')
189 expect(video.channel.isLocal).to.be.true
190 expect(dateIsValid(video.channel.createdAt)).to.be.true
191 expect(dateIsValid(video.channel.updatedAt)).to.be.true
193 expect(video.files).to.have.lengthOf(1)
195 const file = video.files[0]
196 expect(file.magnetUri).to.have.lengthOf.above(2)
197 expect(file.resolution).to.equal(720)
198 expect(file.resolutionLabel).to.equal('720p')
199 expect(file.size).to.equal(218910)
201 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
202 expect(test).to.equal(true)
204 // Wait the async views increment
208 it('Should get the video by UUID', async function () {
209 // Yes, this could be long
212 const res = await getVideo(server.url, videoUUID)
214 const video = res.body
215 expect(video.name).to.equal('my super name')
217 // Wait the async views increment
221 it('Should have the views updated', async function () {
222 await viewVideo(server.url, videoId)
223 await viewVideo(server.url, videoId)
224 await viewVideo(server.url, videoId)
226 const res = await getVideo(server.url, videoId)
228 const video = res.body
229 expect(video.views).to.equal(3)
232 it('Should search the video by name', async function () {
233 const res = await searchVideo(server.url, 'my')
235 expect(res.body.total).to.equal(1)
236 expect(res.body.data).to.be.an('array')
237 expect(res.body.data.length).to.equal(1)
239 const video = res.body.data[0]
240 expect(video.name).to.equal('my super name')
241 expect(video.category).to.equal(2)
242 expect(video.categoryLabel).to.equal('Films')
243 expect(video.licence).to.equal(6)
244 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
245 expect(video.language).to.equal(3)
246 expect(video.languageLabel).to.equal('Mandarin')
247 expect(video.nsfw).to.be.ok
248 expect(video.description).to.equal('my super description')
249 expect(video.serverHost).to.equal('localhost:9001')
250 expect(video.accountName).to.equal('root')
251 expect(video.isLocal).to.be.true
252 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
253 expect(dateIsValid(video.createdAt)).to.be.true
254 expect(dateIsValid(video.updatedAt)).to.be.true
256 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
257 expect(test).to.equal(true)
260 // Not implemented yet
261 // it('Should search the video by serverHost', async function () {
262 // const res = await videosUtils.searchVideo(server.url, '9001', 'host')
264 // expect(res.body.total).to.equal(1)
265 // expect(res.body.data).to.be.an('array')
266 // expect(res.body.data.length).to.equal(1)
268 // const video = res.body.data[0]
269 // expect(video.name).to.equal('my super name')
270 // expect(video.description).to.equal('my super description')
271 // expect(video.serverHost).to.equal('localhost:9001')
272 // expect(video.author).to.equal('root')
273 // expect(video.isLocal).to.be.true
274 // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
275 // expect(dateIsValid(video.createdAt)).to.be.true
276 // expect(dateIsValid(video.updatedAt)).to.be.true
278 // const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
279 // expect(test).to.equal(true)
286 // Not implemented yet
287 // it('Should search the video by tag', async function () {
288 // const res = await searchVideo(server.url, 'tag1')
290 // expect(res.body.total).to.equal(1)
291 // expect(res.body.data).to.be.an('array')
292 // expect(res.body.data.length).to.equal(1)
294 // const video = res.body.data[0]
295 // expect(video.name).to.equal('my super name')
296 // expect(video.category).to.equal(2)
297 // expect(video.categoryLabel).to.equal('Films')
298 // expect(video.licence).to.equal(6)
299 // expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
300 // expect(video.language).to.equal(3)
301 // expect(video.languageLabel).to.equal('Mandarin')
302 // expect(video.nsfw).to.be.ok
303 // expect(video.description).to.equal('my super description')
304 // expect(video.serverHost).to.equal('localhost:9001')
305 // expect(video.accountName).to.equal('root')
306 // expect(video.isLocal).to.be.true
307 // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
308 // expect(dateIsValid(video.createdAt)).to.be.true
309 // expect(dateIsValid(video.updatedAt)).to.be.true
311 // const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
312 // expect(test).to.equal(true)
315 it('Should not find a search by name', async function () {
316 const res = await searchVideo(server.url, 'hello')
318 expect(res.body.total).to.equal(0)
319 expect(res.body.data).to.be.an('array')
320 expect(res.body.data.length).to.equal(0)
323 // Not implemented yet
324 // it('Should not find a search by author', async function () {
325 // const res = await searchVideo(server.url, 'hello')
327 // expect(res.body.total).to.equal(0)
328 // expect(res.body.data).to.be.an('array')
329 // expect(res.body.data.length).to.equal(0)
332 // Not implemented yet
333 // it('Should not find a search by tag', async function () {
334 // const res = await searchVideo(server.url, 'hello')
336 // expect(res.body.total).to.equal(0)
337 // expect(res.body.data).to.be.an('array')
338 // expect(res.body.data.length).to.equal(0)
341 it('Should remove the video', async function () {
342 await removeVideo(server.url, server.accessToken, videoId)
344 const files1 = await readdirPromise(join(__dirname, '..', '..', '..', 'test1/videos/'))
345 expect(files1).to.have.lengthOf(0)
347 const files2 = await readdirPromise(join(__dirname, '..', '..', '..', 'test1/thumbnails/'))
348 expect(files2).to.have.lengthOf(0)
351 it('Should not have videos', async function () {
352 const res = await getVideosList(server.url)
354 expect(res.body.total).to.equal(0)
355 expect(res.body.data).to.be.an('array')
356 expect(res.body.data).to.have.lengthOf(0)
359 it('Should upload 6 videos', async function () {
363 'video_short.mp4', 'video_short.ogv', 'video_short.webm',
364 'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
367 const tasks: Promise<any>[] = []
368 for (const video of videos) {
369 const videoAttributes = {
370 name: video + ' name',
371 description: video + ' description',
376 tags: [ 'tag1', 'tag2', 'tag3' ],
380 const p = uploadVideo(server.url, server.accessToken, videoAttributes)
384 await Promise.all(tasks)
387 it('Should have the correct durations', async function () {
388 const res = await getVideosList(server.url)
390 expect(res.body.total).to.equal(6)
391 const videos = res.body.data
392 expect(videos).to.be.an('array')
393 expect(videos).to.have.lengthOf(6)
395 const videosByName = keyBy<{ duration: number }>(videos, 'name')
396 expect(videosByName['video_short.mp4 name'].duration).to.equal(5)
397 expect(videosByName['video_short.ogv name'].duration).to.equal(5)
398 expect(videosByName['video_short.webm name'].duration).to.equal(5)
399 expect(videosByName['video_short1.webm name'].duration).to.equal(10)
400 expect(videosByName['video_short2.webm name'].duration).to.equal(5)
401 expect(videosByName['video_short3.webm name'].duration).to.equal(5)
404 it('Should have the correct thumbnails', async function () {
405 const res = await getVideosList(server.url)
407 const videos = res.body.data
409 videosListBase = videos
411 for (const video of videos) {
412 const videoName = video.name.replace(' name', '')
413 const test = await testVideoImage(server.url, videoName, video.thumbnailPath)
415 expect(test).to.equal(true)
419 it('Should list only the two first videos', async function () {
420 const res = await getVideosListPagination(server.url, 0, 2, 'name')
422 const videos = res.body.data
423 expect(res.body.total).to.equal(6)
424 expect(videos.length).to.equal(2)
425 expect(videos[0].name).to.equal(videosListBase[0].name)
426 expect(videos[1].name).to.equal(videosListBase[1].name)
429 it('Should list only the next three videos', async function () {
430 const res = await getVideosListPagination(server.url, 2, 3, 'name')
432 const videos = res.body.data
433 expect(res.body.total).to.equal(6)
434 expect(videos.length).to.equal(3)
435 expect(videos[0].name).to.equal(videosListBase[2].name)
436 expect(videos[1].name).to.equal(videosListBase[3].name)
437 expect(videos[2].name).to.equal(videosListBase[4].name)
440 it('Should list the last video', async function () {
441 const res = await getVideosListPagination(server.url, 5, 6, 'name')
443 const videos = res.body.data
444 expect(res.body.total).to.equal(6)
445 expect(videos.length).to.equal(1)
446 expect(videos[0].name).to.equal(videosListBase[5].name)
449 it('Should search the first video', async function () {
450 const res = await searchVideoWithPagination(server.url, 'webm', 0, 1, 'name')
452 const videos = res.body.data
453 expect(res.body.total).to.equal(4)
454 expect(videos.length).to.equal(1)
455 expect(videos[0].name).to.equal('video_short1.webm name')
458 it('Should search the last two videos', async function () {
459 const res = await searchVideoWithPagination(server.url, 'webm', 2, 2, 'name')
461 const videos = res.body.data
462 expect(res.body.total).to.equal(4)
463 expect(videos.length).to.equal(2)
464 expect(videos[0].name).to.equal('video_short3.webm name')
465 expect(videos[1].name).to.equal('video_short.webm name')
468 it('Should search all the webm videos', async function () {
469 const res = await searchVideoWithPagination(server.url, 'webm', 0, 15)
471 const videos = res.body.data
472 expect(res.body.total).to.equal(4)
473 expect(videos.length).to.equal(4)
476 // Not implemented yet
477 // it('Should search all the root author videos', async function () {
478 // const res = await searchVideoWithPagination(server.url, 'root', 0, 15)
480 // const videos = res.body.data
481 // expect(res.body.total).to.equal(6)
482 // expect(videos.length).to.equal(6)
485 // Not implemented yet
486 // it('Should search all the 9001 port videos', async function () {
487 // const res = await videosUtils.searchVideoWithPagination(server.url, '9001', 'host', 0, 15)
489 // const videos = res.body.data
490 // expect(res.body.total).to.equal(6)
491 // expect(videos.length).to.equal(6)
497 // it('Should search all the localhost videos', async function () {
498 // const res = await videosUtils.searchVideoWithPagination(server.url, 'localhost', 'host', 0, 15)
500 // const videos = res.body.data
501 // expect(res.body.total).to.equal(6)
502 // expect(videos.length).to.equal(6)
508 it('Should list and sort by name in descending order', async function () {
509 const res = await getVideosListSort(server.url, '-name')
511 const videos = res.body.data
512 expect(res.body.total).to.equal(6)
513 expect(videos.length).to.equal(6)
514 expect(videos[0].name).to.equal('video_short.webm name')
515 expect(videos[1].name).to.equal('video_short.ogv name')
516 expect(videos[2].name).to.equal('video_short.mp4 name')
517 expect(videos[3].name).to.equal('video_short3.webm name')
518 expect(videos[4].name).to.equal('video_short2.webm name')
519 expect(videos[5].name).to.equal('video_short1.webm name')
522 it('Should search and sort by name in ascending order', async function () {
523 const res = await searchVideoWithSort(server.url, 'webm', 'name')
525 const videos = res.body.data
526 expect(res.body.total).to.equal(4)
527 expect(videos.length).to.equal(4)
529 expect(videos[0].name).to.equal('video_short1.webm name')
530 expect(videos[1].name).to.equal('video_short2.webm name')
531 expect(videos[2].name).to.equal('video_short3.webm name')
532 expect(videos[3].name).to.equal('video_short.webm name')
534 videoId = videos[2].id
537 it('Should update a video', async function () {
539 name: 'my super video updated',
544 description: 'my super description updated',
545 tags: [ 'tagup1', 'tagup2' ]
547 await updateVideo(server.url, server.accessToken, videoId, attributes)
550 it('Should have the video updated', async function () {
553 const res = await getVideo(server.url, videoId)
555 const video = res.body
557 expect(video.name).to.equal('my super video updated')
558 expect(video.category).to.equal(4)
559 expect(video.categoryLabel).to.equal('Art')
560 expect(video.licence).to.equal(2)
561 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
562 expect(video.language).to.equal(5)
563 expect(video.languageLabel).to.equal('Arabic')
564 expect(video.nsfw).to.be.ok
565 expect(video.description).to.equal('my super description updated')
566 expect(video.serverHost).to.equal('localhost:9001')
567 expect(video.accountName).to.equal('root')
568 expect(video.account.name).to.equal('root')
569 expect(video.isLocal).to.be.true
570 expect(video.tags).to.deep.equal([ 'tagup1', 'tagup2' ])
571 expect(dateIsValid(video.createdAt)).to.be.true
572 expect(dateIsValid(video.updatedAt)).to.be.true
574 expect(video.channel.name).to.equal('Default root channel')
575 expect(video.channel.isLocal).to.be.true
576 expect(dateIsValid(video.channel.createdAt)).to.be.true
577 expect(dateIsValid(video.channel.updatedAt)).to.be.true
579 expect(video.files).to.have.lengthOf(1)
581 const file = video.files[0]
582 const magnetUri = file.magnetUri
583 expect(file.magnetUri).to.have.lengthOf.above(2)
584 expect(file.resolution).to.equal(720)
585 expect(file.resolutionLabel).to.equal('720p')
586 expect(file.size).to.equal(292677)
588 const test = await testVideoImage(server.url, 'video_short3.webm', video.thumbnailPath)
589 expect(test).to.equal(true)
591 const torrent = await webtorrentAdd(magnetUri)
592 expect(torrent.files).to.be.an('array')
593 expect(torrent.files.length).to.equal(1)
594 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
597 it('Should update only the tags of a video', async function () {
599 tags: [ 'tag1', 'tag2', 'supertag' ]
602 await updateVideo(server.url, server.accessToken, videoId, attributes)
604 const res = await getVideo(server.url, videoId)
605 const video = res.body
607 expect(video.name).to.equal('my super video updated')
608 expect(video.category).to.equal(4)
609 expect(video.categoryLabel).to.equal('Art')
610 expect(video.licence).to.equal(2)
611 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
612 expect(video.language).to.equal(5)
613 expect(video.languageLabel).to.equal('Arabic')
614 expect(video.nsfw).to.be.ok
615 expect(video.description).to.equal('my super description updated')
616 expect(video.serverHost).to.equal('localhost:9001')
617 expect(video.accountName).to.equal('root')
618 expect(video.isLocal).to.be.true
619 expect(video.tags).to.deep.equal([ 'supertag', 'tag1', 'tag2' ])
620 expect(dateIsValid(video.createdAt)).to.be.true
621 expect(dateIsValid(video.updatedAt)).to.be.true
623 expect(video.channel.name).to.equal('Default root channel')
624 expect(video.channel.isLocal).to.be.true
625 expect(dateIsValid(video.channel.createdAt)).to.be.true
626 expect(dateIsValid(video.channel.updatedAt)).to.be.true
628 expect(video.files).to.have.lengthOf(1)
630 const file = video.files[0]
631 expect(file.magnetUri).to.have.lengthOf.above(2)
632 expect(file.resolution).to.equal(720)
633 expect(file.resolutionLabel).to.equal('720p')
634 expect(file.size).to.equal(292677)
637 it('Should update only the description of a video', async function () {
639 description: 'hello everybody'
642 await updateVideo(server.url, server.accessToken, videoId, attributes)
644 const res = await getVideo(server.url, videoId)
645 const video = res.body
647 expect(video.name).to.equal('my super video updated')
648 expect(video.category).to.equal(4)
649 expect(video.categoryLabel).to.equal('Art')
650 expect(video.licence).to.equal(2)
651 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
652 expect(video.language).to.equal(5)
653 expect(video.languageLabel).to.equal('Arabic')
654 expect(video.nsfw).to.be.ok
655 expect(video.description).to.equal('hello everybody')
656 expect(video.serverHost).to.equal('localhost:9001')
657 expect(video.accountName).to.equal('root')
658 expect(video.isLocal).to.be.true
659 expect(video.tags).to.deep.equal([ 'supertag', 'tag1', 'tag2' ])
660 expect(dateIsValid(video.createdAt)).to.be.true
661 expect(dateIsValid(video.updatedAt)).to.be.true
663 expect(video.channel.name).to.equal('Default root channel')
664 expect(video.channel.isLocal).to.be.true
665 expect(dateIsValid(video.channel.createdAt)).to.be.true
666 expect(dateIsValid(video.channel.updatedAt)).to.be.true
668 expect(video.files).to.have.lengthOf(1)
670 const file = video.files[0]
671 expect(file.magnetUri).to.have.lengthOf.above(2)
672 expect(file.resolution).to.equal(720)
673 expect(file.resolutionLabel).to.equal('720p')
674 expect(file.size).to.equal(292677)
677 it('Should like a video', async function () {
678 await rateVideo(server.url, server.accessToken, videoId, 'like')
680 const res = await getVideo(server.url, videoId)
681 const video = res.body
683 expect(video.likes).to.equal(1)
684 expect(video.dislikes).to.equal(0)
687 it('Should dislike the same video', async function () {
688 await rateVideo(server.url, server.accessToken, videoId, 'dislike')
690 const res = await getVideo(server.url, videoId)
691 const video = res.body
693 expect(video.likes).to.equal(0)
694 expect(video.dislikes).to.equal(1)
697 it('Should upload a video with minimum parameters', async function () {
698 const path = '/api/v1/videos/upload'
700 const req = request(server.url)
702 .set('Accept', 'application/json')
703 .set('Authorization', 'Bearer ' + server.accessToken)
704 .field('name', 'minimum parameters')
705 .field('privacy', '1')
706 .field('nsfw', 'false')
707 .field('channelId', '1')
709 const filePath = join(__dirname, '..', 'api', 'fixtures', 'video_short.webm')
711 await req.attach('videofile', filePath)
714 const res = await getVideosList(server.url)
715 const video = res.body.data.find(v => v.name === 'minimum parameters')
717 expect(video.name).to.equal('minimum parameters')
718 expect(video.category).to.equal(null)
719 expect(video.categoryLabel).to.equal('Misc')
720 expect(video.licence).to.equal(null)
721 expect(video.licenceLabel).to.equal('Unknown')
722 expect(video.language).to.equal(null)
723 expect(video.languageLabel).to.equal('Unknown')
724 expect(video.nsfw).to.not.be.ok
725 expect(video.description).to.equal(null)
726 expect(video.serverHost).to.equal('localhost:9001')
727 expect(video.accountName).to.equal('root')
728 expect(video.isLocal).to.be.true
729 expect(video.tags).to.deep.equal([ ])
730 expect(dateIsValid(video.createdAt)).to.be.true
731 expect(dateIsValid(video.updatedAt)).to.be.true
734 after(async function () {
735 killallServers([ server ])
737 // Keep the logs if the test failed