Add CLI plugins tests
[oweals/peertube.git] / server / tests / api / server / plugins.ts
1 /* tslint:disable:no-unused-expression */
2
3 import 'mocha'
4 import * as chai from 'chai'
5 import { About } from '../../../../shared/models/server/about.model'
6 import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
7 import {
8   cleanupTests,
9   deleteCustomConfig,
10   flushAndRunServer,
11   getAbout,
12   getConfig,
13   getCustomConfig, installPlugin,
14   killallServers, parallelTests,
15   registerUser,
16   reRunServer, ServerInfo,
17   setAccessTokensToServers,
18   updateCustomConfig, uploadVideo
19 } from '../../../../shared/extra-utils'
20 import { ServerConfig } from '../../../../shared/models'
21 import { PeerTubePlugin } from '../../../../shared/models/plugins/peertube-plugin.model'
22
23 const expect = chai.expect
24
25 describe('Test plugins', function () {
26   let server = null
27
28   before(async function () {
29     this.timeout(30000)
30
31     server = await flushAndRunServer(1)
32     await setAccessTokensToServers([ server ])
33
34     {
35       await installPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-hello-world' })
36     }
37
38     {
39       await installPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-background-color' })
40     }
41   })
42
43   it('Should list available plugins and themes', async function () {
44     // List without filter
45     // List with filter (plugin and theme)
46   })
47
48   it('Should search available plugins', async function () {
49     // Search with filter (plugin and theme)
50     // Add pagination
51     // Add sort
52     // Add peertube engine
53   })
54
55   it('Should have an empty global css', async function () {
56     // get /global.css
57   })
58
59   it('Should install a plugin and a theme', async function () {
60
61   })
62
63   it('Should have the correct global css', async function () {
64     // get /global.css
65   })
66
67   it('Should have the plugin loaded in the configuration', async function () {
68     // Check registered themes/plugins
69   })
70
71   it('Should update the default theme in the configuration', async function () {
72     // Update config
73   })
74
75   it('Should list plugins and themes', async function () {
76     // List without filter
77     // List with filter (theme/plugin)
78     // List with pagination
79     // List with sort
80   })
81
82   it('Should get a plugin and a theme', async function () {
83     // Get plugin
84     // Get theme
85   })
86
87   it('Should get registered settings', async function () {
88     // Get plugin
89   })
90
91   it('Should update the settings', async function () {
92     // Update /settings
93
94     // get /plugin
95   })
96
97   it('Should update the plugin and the theme', async function () {
98     // update BDD -> 0.0.1
99     // update package.json (theme + plugin)
100     // list to check versions
101     // update plugin + theme
102     // list to check they have been updated
103     // check package.json are upgraded too
104   })
105
106   it('Should uninstall the plugin', async function () {
107     // uninstall
108     // list
109   })
110
111   it('Should have an empty global css', async function () {
112     // get /global.css
113   })
114
115   it('Should list uninstalled plugins', async function () {
116     // { uninstalled: true }
117   })
118
119   it('Should uninstall the theme', async function () {
120     // Uninstall
121   })
122
123   it('Should have updated the configuration', async function () {
124     // get /config (default theme + registered themes + registered plugins)
125   })
126
127   after(async function () {
128     await cleanupTests([ server ])
129   })
130 })