aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc/development/tests.md
blob: e311d326793e8e8f1bc6411de26d2534d11cc0d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Tests

## Preparation

Prepare PostgreSQL user so PeerTube can delete/create the test databases:

```
$ sudo -u postgres createuser you_username --createdb --superuser
```

Prepare databases:

```
$ npm run clean:server:test
```

Build PeerTube:

```
$ npm run build
```

## Server tests

### Dependencies

Run docker containers needed by some test files:

```
$ sudo docker run -p 9444:9000 chocobozzz/s3-ninja
$ sudo docker run -p 10389:10389 chocobozzz/docker-test-openldap
```

### Test

To run all test suites:

```
$ npm run test # See scripts/test.sh to run a particular suite
```

To run a particular test file:

```
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
```

### Configuration

Some env variables can be defined to disable/enable some tests:

 * `DISABLE_HTTP_IMPORT_TESTS`: disable import tests (because of youtube that could rate limit your IP)
 * `ENABLE_OBJECT_STORAGE_TESTS=true`: enable object storage tests (needs a docker container first)


## Client E2E tests

### Local tests

To run tests on local web browsers (comment web browsers you don't have in `client/e2e/wdio.local.conf.ts`):

```
$ npm run e2e:local
```

### Browserstack tests

To run tests on browser stack:

```
$ BROWSERSTACK_USER=your_user BROWSERSTACK_KEY=your_key npm run e2e:browserstack
```