From 12d6b873cd4c5eb8c4fd298885e0c7fa6deb3756 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 2 Sep 2021 08:57:59 +0200 Subject: Improve e2e workflow and add doc --- support/doc/development/tests.md | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 support/doc/development/tests.md (limited to 'support') diff --git a/support/doc/development/tests.md b/support/doc/development/tests.md new file mode 100644 index 000000000..e311d3267 --- /dev/null +++ b/support/doc/development/tests.md @@ -0,0 +1,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 +``` -- cgit v1.2.3