aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/live/live.ts4
-rw-r--r--server/tests/api/search/search-channels.ts7
-rw-r--r--server/tests/api/server/services.ts66
-rw-r--r--server/tests/cli/create-transcoding-job.ts16
-rw-r--r--server/tests/client.ts10
5 files changed, 69 insertions, 34 deletions
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index ba952aff5..5cac3bc4e 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -439,7 +439,7 @@ describe('Test live', function () {
439 }) 439 })
440 440
441 it('Should enable transcoding without additional resolutions', async function () { 441 it('Should enable transcoding without additional resolutions', async function () {
442 this.timeout(60000) 442 this.timeout(120000)
443 443
444 liveVideoId = await createLiveWrapper(false) 444 liveVideoId = await createLiveWrapper(false)
445 445
@@ -453,7 +453,7 @@ describe('Test live', function () {
453 }) 453 })
454 454
455 it('Should enable transcoding with some resolutions', async function () { 455 it('Should enable transcoding with some resolutions', async function () {
456 this.timeout(60000) 456 this.timeout(120000)
457 457
458 const resolutions = [ 240, 480 ] 458 const resolutions = [ 240, 480 ]
459 await updateConf(resolutions) 459 await updateConf(resolutions)
diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts
index 8a01aff90..67612537c 100644
--- a/server/tests/api/search/search-channels.ts
+++ b/server/tests/api/search/search-channels.ts
@@ -129,6 +129,13 @@ describe('Test channels search', function () {
129 } 129 }
130 130
131 { 131 {
132 const body = await command.advancedChannelSearch({ search: { handles: [ 'squall_channel@' + server.host ] } })
133 expect(body.total).to.equal(1)
134 expect(body.data).to.have.lengthOf(1)
135 expect(body.data[0].displayName).to.equal('Squall channel')
136 }
137
138 {
132 const body = await command.advancedChannelSearch({ search: { handles: [ 'chocobozzz_channel' ] } }) 139 const body = await command.advancedChannelSearch({ search: { handles: [ 'chocobozzz_channel' ] } })
133 expect(body.total).to.equal(0) 140 expect(body.total).to.equal(0)
134 expect(body.data).to.have.lengthOf(0) 141 expect(body.data).to.have.lengthOf(0)
diff --git a/server/tests/api/server/services.ts b/server/tests/api/server/services.ts
index 69d030dbb..3a87df981 100644
--- a/server/tests/api/server/services.ts
+++ b/server/tests/api/server/services.ts
@@ -52,42 +52,46 @@ describe('Test services', function () {
52 52
53 it('Should have a valid oEmbed video response', async function () { 53 it('Should have a valid oEmbed video response', async function () {
54 for (const basePath of [ '/videos/watch/', '/w/' ]) { 54 for (const basePath of [ '/videos/watch/', '/w/' ]) {
55 const oembedUrl = 'http://localhost:' + server.port + basePath + video.uuid 55 for (const suffix of [ '', '?param=1' ]) {
56 56 const oembedUrl = server.url + basePath + video.uuid + suffix
57 const res = await server.services.getOEmbed({ oembedUrl }) 57
58 const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' + 58 const res = await server.services.getOEmbed({ oembedUrl })
59 `title="${video.name}" src="http://localhost:${server.port}/videos/embed/${video.uuid}" ` + 59 const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' +
60 'frameborder="0" allowfullscreen></iframe>' 60 `title="${video.name}" src="http://localhost:${server.port}/videos/embed/${video.uuid}" ` +
61 const expectedThumbnailUrl = 'http://localhost:' + server.port + video.previewPath 61 'frameborder="0" allowfullscreen></iframe>'
62 62 const expectedThumbnailUrl = 'http://localhost:' + server.port + video.previewPath
63 expect(res.body.html).to.equal(expectedHtml) 63
64 expect(res.body.title).to.equal(video.name) 64 expect(res.body.html).to.equal(expectedHtml)
65 expect(res.body.author_name).to.equal(server.store.channel.displayName) 65 expect(res.body.title).to.equal(video.name)
66 expect(res.body.width).to.equal(560) 66 expect(res.body.author_name).to.equal(server.store.channel.displayName)
67 expect(res.body.height).to.equal(315) 67 expect(res.body.width).to.equal(560)
68 expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl) 68 expect(res.body.height).to.equal(315)
69 expect(res.body.thumbnail_width).to.equal(850) 69 expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl)
70 expect(res.body.thumbnail_height).to.equal(480) 70 expect(res.body.thumbnail_width).to.equal(850)
71 expect(res.body.thumbnail_height).to.equal(480)
72 }
71 } 73 }
72 }) 74 })
73 75
74 it('Should have a valid playlist oEmbed response', async function () { 76 it('Should have a valid playlist oEmbed response', async function () {
75 for (const basePath of [ '/videos/watch/playlist/', '/w/p/' ]) { 77 for (const basePath of [ '/videos/watch/playlist/', '/w/p/' ]) {
76 const oembedUrl = 'http://localhost:' + server.port + basePath + playlistUUID 78 for (const suffix of [ '', '?param=1' ]) {
77 79 const oembedUrl = server.url + basePath + playlistUUID + suffix
78 const res = await server.services.getOEmbed({ oembedUrl }) 80
79 const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' + 81 const res = await server.services.getOEmbed({ oembedUrl })
80 `title="${playlistDisplayName}" src="http://localhost:${server.port}/video-playlists/embed/${playlistUUID}" ` + 82 const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' +
81 'frameborder="0" allowfullscreen></iframe>' 83 `title="${playlistDisplayName}" src="http://localhost:${server.port}/video-playlists/embed/${playlistUUID}" ` +
82 84 'frameborder="0" allowfullscreen></iframe>'
83 expect(res.body.html).to.equal(expectedHtml) 85
84 expect(res.body.title).to.equal('The Life and Times of Scrooge McDuck') 86 expect(res.body.html).to.equal(expectedHtml)
85 expect(res.body.author_name).to.equal(server.store.channel.displayName) 87 expect(res.body.title).to.equal('The Life and Times of Scrooge McDuck')
86 expect(res.body.width).to.equal(560) 88 expect(res.body.author_name).to.equal(server.store.channel.displayName)
87 expect(res.body.height).to.equal(315) 89 expect(res.body.width).to.equal(560)
88 expect(res.body.thumbnail_url).exist 90 expect(res.body.height).to.equal(315)
89 expect(res.body.thumbnail_width).to.equal(280) 91 expect(res.body.thumbnail_url).exist
90 expect(res.body.thumbnail_height).to.equal(157) 92 expect(res.body.thumbnail_width).to.equal(280)
93 expect(res.body.thumbnail_height).to.equal(157)
94 }
91 } 95 }
92 }) 96 })
93 97
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index 3fd624091..2b388ab0c 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -33,9 +33,10 @@ async function checkFilesInObjectStorage (files: VideoFile[], type: 'webtorrent'
33function runTests (objectStorage: boolean) { 33function runTests (objectStorage: boolean) {
34 let servers: PeerTubeServer[] = [] 34 let servers: PeerTubeServer[] = []
35 const videosUUID: string[] = [] 35 const videosUUID: string[] = []
36 const publishedAt: string[] = []
36 37
37 before(async function () { 38 before(async function () {
38 this.timeout(60000) 39 this.timeout(120000)
39 40
40 const config = objectStorage 41 const config = objectStorage
41 ? ObjectStorageCommand.getDefaultConfig() 42 ? ObjectStorageCommand.getDefaultConfig()
@@ -54,6 +55,11 @@ function runTests (objectStorage: boolean) {
54 for (let i = 1; i <= 5; i++) { 55 for (let i = 1; i <= 5; i++) {
55 const { uuid, shortUUID } = await servers[0].videos.upload({ attributes: { name: 'video' + i } }) 56 const { uuid, shortUUID } = await servers[0].videos.upload({ attributes: { name: 'video' + i } })
56 57
58 await waitJobs(servers)
59
60 const video = await servers[0].videos.get({ id: uuid })
61 publishedAt.push(video.publishedAt as string)
62
57 if (i > 2) { 63 if (i > 2) {
58 videosUUID.push(uuid) 64 videosUUID.push(uuid)
59 } else { 65 } else {
@@ -225,6 +231,14 @@ function runTests (objectStorage: boolean) {
225 } 231 }
226 }) 232 })
227 233
234 it('Should not have updated published at attributes', async function () {
235 for (const id of videosUUID) {
236 const video = await servers[0].videos.get({ id })
237
238 expect(publishedAt.some(p => video.publishedAt === p)).to.be.true
239 }
240 })
241
228 after(async function () { 242 after(async function () {
229 await cleanupTests(servers) 243 await cleanupTests(servers)
230 }) 244 })
diff --git a/server/tests/client.ts b/server/tests/client.ts
index a91bec906..6c32c81db 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -482,6 +482,16 @@ describe('Test a client controllers', function () {
482 } 482 }
483 } 483 }
484 }) 484 })
485
486 it('Should add noindex header for some paths', async function () {
487 const paths = [ '/about/peertube' ]
488
489 for (const path of paths) {
490 const { headers } = await makeHTMLRequest(servers[0].url, path)
491
492 expect(headers['x-robots-tag']).to.equal('noindex')
493 }
494 })
485 }) 495 })
486 496
487 describe('Embed HTML', function () { 497 describe('Embed HTML', function () {