]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - support/doc/development/tests.md
Add missing tests env doc
[github/Chocobozzz/PeerTube.git] / support / doc / development / tests.md
index d36cf8544f012ec67b4e10dcdaa49310f3cd51ff..e3a65c35f82272b302df1b544f221bdc624826f7 100644 (file)
@@ -5,19 +5,19 @@
 Prepare PostgreSQL user so PeerTube can delete/create the test databases:
 
 ```bash
-sudo -u postgres createuser you_username --createdb --superuser
+sudo -u postgres createuser you_username --createdb --superuser
 ```
 
 Prepare databases:
 
 ```bash
-npm run clean:server:test
+npm run clean:server:test
 ```
 
 Build PeerTube:
 
 ```bash
-npm run build
+npm run build
 ```
 
 ## Server tests
@@ -27,8 +27,20 @@ $ npm run build
 Run docker containers needed by some test files:
 
 ```bash
-$ sudo docker run -p 9444:9000 chocobozzz/s3-ninja
-$ sudo docker run -p 10389:10389 chocobozzz/docker-test-openldap
+sudo docker run -p 9444:9000 chocobozzz/s3-ninja
+sudo docker run -p 10389:10389 chocobozzz/docker-test-openldap
+```
+
+Ensure you also have these commands:
+
+```bash
+exiftool --help
+parallel --help
+```
+
+Otherwise, install the packages. On Debian-based systems (like Debian, Ubuntu or Mint):
+```bash
+sudo apt-get install parallel libimage-exiftool-perl
 ```
 
 ### Test
@@ -36,10 +48,10 @@ $ sudo docker run -p 10389:10389 chocobozzz/docker-test-openldap
 To run all test suites:
 
 ```bash
-npm run test # See scripts/test.sh to run a particular suite
+npm run test # See scripts/test.sh to run a particular suite
 ```
 
-Most of tests can be runned using:
+Most of tests can be run using:
 
 ```bash
 TS_NODE_TRANSPILE_ONLY=true npm run mocha -- --timeout 30000 --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/videos/video-transcoder.ts
@@ -57,6 +69,8 @@ Some env variables can be defined to disable/enable some tests:
 
  * `DISABLE_HTTP_IMPORT_TESTS=true`: disable import tests (because of youtube that could rate limit your IP)
  * `ENABLE_OBJECT_STORAGE_TESTS=true`: enable object storage tests (needs `chocobozzz/s3-ninja` container first)
+ * `AKISMET_KEY`: specify an Akismet key to test akismet external PeerTube plugin
+ * `OBJECT_STORAGE_SCALEWAY_KEY_ID` and `OBJECT_STORAGE_SCALEWAY_ACCESS_KEY`: specify Scaleway API keys to test object storage ACL (not supported by our `chocobozzz/s3-ninja` container)
 
 
 ### Debug server logs
@@ -67,6 +81,19 @@ While testing, you might want to display a server's logs to understand why they
 NODE_APP_INSTANCE=1 NODE_ENV=test npm run parse-log -- --level debug | less +GF
 ```
 
+You can also:
+ - checkout only the latest logs (PeerTube >= 5.0):
+
+```bash
+tail -n 100 test1/logs/peertube.log | npm run parse-log -- --level debug --files -
+```
+
+ - continuously print the latests logs (PeerTube >= 5.0):
+
+```bash
+tail -f test1/logs/peertube.log | npm run parse-log -- --level debug --files -
+```
+
 
 ## Client E2E tests
 
@@ -75,7 +102,7 @@ NODE_APP_INSTANCE=1 NODE_ENV=test npm run parse-log -- --level debug | less +GF
 To run tests on local web browsers (comment web browsers you don't have in `client/e2e/wdio.local.conf.ts`):
 
 ```bash
-$ npm run e2e:local
+PEERTUBE2_E2E_PASSWORD=password npm run e2e:local
 ```
 
 ### Browserstack tests
@@ -83,20 +110,14 @@ $ npm run e2e:local
 To run tests on browser stack:
 
 ```bash
-BROWSERSTACK_USER=your_user BROWSERSTACK_KEY=your_key npm run e2e:browserstack
+BROWSERSTACK_USER=your_user BROWSERSTACK_KEY=your_key npm run e2e:browserstack
 ```
 
 ### Add E2E tests
 
-To add E2E tests and quickly run tests using a local Chrome, first create a test instance:
-
-```bash
-$ npm run clean:server:test && NODE_APP_INSTANCE=1 NODE_ENV=test npm start
-```
-
-Then, just run your suite using:
+To add E2E tests and quickly run tests using a local Chrome:
 
 ```bash
-cd client/e2e
-../node_modules/.bin/wdio wdio.local-test.conf.ts # you can also add --mochaOpts.grep to only run tests you want
+cd client/e2e
+../node_modules/.bin/wdio wdio.local-test.conf.ts # you can also add --mochaOpts.grep to only run tests you want
 ```