aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/html-injection.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 10:33:49 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commitae2abfd3aed3e75d39a316b49b914d187faa7475 (patch)
tree4d5060dc310f3d8cdcd5829779522f49b3d10e71 /server/tests/plugins/html-injection.ts
parent9c6327f803aaf4200672f1fc40b2f43786daca47 (diff)
downloadPeerTube-ae2abfd3aed3e75d39a316b49b914d187faa7475.tar.gz
PeerTube-ae2abfd3aed3e75d39a316b49b914d187faa7475.tar.zst
PeerTube-ae2abfd3aed3e75d39a316b49b914d187faa7475.zip
Introduce plugins command
Diffstat (limited to 'server/tests/plugins/html-injection.ts')
-rw-r--r--server/tests/plugins/html-injection.ts33
1 files changed, 13 insertions, 20 deletions
diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts
index 4fa8caa3a..80d67ae0e 100644
--- a/server/tests/plugins/html-injection.ts
+++ b/server/tests/plugins/html-injection.ts
@@ -5,30 +5,31 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 flushAndRunServer,
8 getPluginsCSS,
9 installPlugin,
10 makeHTMLRequest, 8 makeHTMLRequest,
9 PluginsCommand,
11 ServerInfo, 10 ServerInfo,
12 setAccessTokensToServers, 11 setAccessTokensToServers
13 uninstallPlugin
14} from '../../../shared/extra-utils' 12} from '../../../shared/extra-utils'
15 13
16const expect = chai.expect 14const expect = chai.expect
17 15
18describe('Test plugins HTML injection', function () { 16describe('Test plugins HTML injection', function () {
19 let server: ServerInfo = null 17 let server: ServerInfo = null
18 let command: PluginsCommand
20 19
21 before(async function () { 20 before(async function () {
22 this.timeout(30000) 21 this.timeout(30000)
23 22
24 server = await flushAndRunServer(1) 23 server = await flushAndRunServer(1)
25 await setAccessTokensToServers([ server ]) 24 await setAccessTokensToServers([ server ])
25
26 command = server.pluginsCommand
26 }) 27 })
27 28
28 it('Should not inject global css file in HTML', async function () { 29 it('Should not inject global css file in HTML', async function () {
29 { 30 {
30 const res = await getPluginsCSS(server.url) 31 const text = await command.getCSS()
31 expect(res.text).to.be.empty 32 expect(text).to.be.empty
32 } 33 }
33 34
34 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) { 35 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {
@@ -40,17 +41,13 @@ describe('Test plugins HTML injection', function () {
40 it('Should install a plugin and a theme', async function () { 41 it('Should install a plugin and a theme', async function () {
41 this.timeout(30000) 42 this.timeout(30000)
42 43
43 await installPlugin({ 44 await command.install({ npmName: 'peertube-plugin-hello-world' })
44 url: server.url,
45 accessToken: server.accessToken,
46 npmName: 'peertube-plugin-hello-world'
47 })
48 }) 45 })
49 46
50 it('Should have the correct global css', async function () { 47 it('Should have the correct global css', async function () {
51 { 48 {
52 const res = await getPluginsCSS(server.url) 49 const text = await command.getCSS()
53 expect(res.text).to.contain('background-color: red') 50 expect(text).to.contain('background-color: red')
54 } 51 }
55 52
56 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) { 53 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {
@@ -60,15 +57,11 @@ describe('Test plugins HTML injection', function () {
60 }) 57 })
61 58
62 it('Should have an empty global css on uninstall', async function () { 59 it('Should have an empty global css on uninstall', async function () {
63 await uninstallPlugin({ 60 await command.uninstall({ npmName: 'peertube-plugin-hello-world' })
64 url: server.url,
65 accessToken: server.accessToken,
66 npmName: 'peertube-plugin-hello-world'
67 })
68 61
69 { 62 {
70 const res = await getPluginsCSS(server.url) 63 const text = await command.getCSS()
71 expect(res.text).to.be.empty 64 expect(text).to.be.empty
72 } 65 }
73 66
74 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) { 67 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {