]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - support/doc/development/tests.md
Improve e2e workflow and add doc
[github/Chocobozzz/PeerTube.git] / support / doc / development / tests.md
1 # Tests
2
3 ## Preparation
4
5 Prepare PostgreSQL user so PeerTube can delete/create the test databases:
6
7 ```
8 $ sudo -u postgres createuser you_username --createdb --superuser
9 ```
10
11 Prepare databases:
12
13 ```
14 $ npm run clean:server:test
15 ```
16
17 Build PeerTube:
18
19 ```
20 $ npm run build
21 ```
22
23 ## Server tests
24
25 ### Dependencies
26
27 Run docker containers needed by some test files:
28
29 ```
30 $ sudo docker run -p 9444:9000 chocobozzz/s3-ninja
31 $ sudo docker run -p 10389:10389 chocobozzz/docker-test-openldap
32 ```
33
34 ### Test
35
36 To run all test suites:
37
38 ```
39 $ npm run test # See scripts/test.sh to run a particular suite
40 ```
41
42 To run a particular test file:
43
44 ```
45 TS_NODE_TRANSPILE_ONLY=true mocha -- --timeout 30000 --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/videos/video-transcoder.ts
46 ```
47
48 ### Configuration
49
50 Some env variables can be defined to disable/enable some tests:
51
52 * `DISABLE_HTTP_IMPORT_TESTS`: disable import tests (because of youtube that could rate limit your IP)
53 * `ENABLE_OBJECT_STORAGE_TESTS=true`: enable object storage tests (needs a docker container first)
54
55
56 ## Client E2E tests
57
58 ### Local tests
59
60 To run tests on local web browsers (comment web browsers you don't have in `client/e2e/wdio.local.conf.ts`):
61
62 ```
63 $ npm run e2e:local
64 ```
65
66 ### Browserstack tests
67
68 To run tests on browser stack:
69
70 ```
71 $ BROWSERSTACK_USER=your_user BROWSERSTACK_KEY=your_key npm run e2e:browserstack
72 ```