X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fplugins%2Fhtml-injection.ts;h=80d67ae0e47ad1384f3457d433a109df705f4513;hb=04aed76711909507e74905bde3a7fa024d3585c9;hp=293c1df21d9845c0eb9a20370409524206f06e63;hpb=1f5221fb4a511bb175083a9c7f578679c6122ce3;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts index 293c1df21..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' import { cleanupTests, flushAndRunServer, - getPluginsCSS, - installPlugin, makeHTMLRequest, + PluginsCommand, ServerInfo, - setAccessTokensToServers, - uninstallPlugin + setAccessTokensToServers } from '../../../shared/extra-utils' const expect = chai.expect -describe('Test plugins HTML inection', function () { +describe('Test plugins HTML injection', function () { let server: ServerInfo = null + let command: PluginsCommand before(async function () { this.timeout(30000) server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) + + command = server.pluginsCommand }) it('Should not inject global css file in HTML', async function () { { - const res = await getPluginsCSS(server.url) - expect(res.text).to.be.empty + const text = await command.getCSS() + expect(text).to.be.empty } for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) { @@ -40,17 +41,13 @@ describe('Test plugins HTML inection', function () { it('Should install a plugin and a theme', async function () { this.timeout(30000) - await installPlugin({ - url: server.url, - accessToken: server.accessToken, - npmName: 'peertube-plugin-hello-world' - }) + await command.install({ npmName: 'peertube-plugin-hello-world' }) }) it('Should have the correct global css', async function () { { - const res = await getPluginsCSS(server.url) - expect(res.text).to.contain('background-color: red') + const text = await command.getCSS() + expect(text).to.contain('background-color: red') } for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) { @@ -60,15 +57,11 @@ describe('Test plugins HTML inection', function () { }) it('Should have an empty global css on uninstall', async function () { - await uninstallPlugin({ - url: server.url, - accessToken: server.accessToken, - npmName: 'peertube-plugin-hello-world' - }) + await command.uninstall({ npmName: 'peertube-plugin-hello-world' }) { - const res = await getPluginsCSS(server.url) - expect(res.text).to.be.empty + const text = await command.getCSS() + expect(text).to.be.empty } for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {