update docs and remove references to testcafe

This commit is contained in:
Lukas Hass
2022-02-18 16:11:26 +01:00
parent 3d86204db6
commit ed0e49d16e
7 changed files with 51 additions and 61 deletions
-5
View File
@@ -1,5 +0,0 @@
FROM testcafe/testcafe:1.18.2
USER root
RUN apk add docker-compose
USER user
+41 -9
View File
@@ -1,20 +1,52 @@
End-to-end tests
# End-to-end tests
This directory contains automated end to end tests.
To run them locally:
## Installation
```console
$ npm install
$ ADMIN_API_TOKEN=123 npm test
```bash
npm install
npx playwright install --with-deps
```
## Run on development environment
Start WorkAdventure with:
```bash
docker-compose up -d
```
Wait 2-3 minutes for the environment to start, then:
Start the tests with:
```bash
ADMIN_API_TOKEN=123 npm run test
```
You'll need to adapt the `ADMIN_API_TOKEN` to the value you use in your `.env` file.
Alternatively, you can use docker-compose to run the tests:
## Run on production like environment
```console
$ PROJECT_DIR=$(pwd) docker-compose -f docker-compose.testcafe.yml up --exit-code-from testcafe
Start WorkAdventure with:
```bash
docker-compose -f docker-compose.yaml -f docker-compose.e2e.yml up -d --build
```
Note: by default, tests are running in Chrome locally and in Chromium in the Docker image.
Start the tests with:
```bash
ADMIN_API_TOKEN=123 npm run test-prod-like
```
You'll need to adapt the `ADMIN_API_TOKEN` to the value you use in your `.env` file.
## Run selected tests
End-to-end tests can take a while to run. To run only one test in one browser, use:
```bash
ADMIN_API_TOKEN=123 npm run test -- [name of the test file] --project=[chromium|firefox|webkit]
```
+1 -1
View File
@@ -6,7 +6,7 @@
"dockerode": "^3.3.1"
},
"scripts": {
"test": "ADMIN_API_TOKEN=123 playwright test",
"test": "playwright test",
"test-prod-like": "OVERRIDE_DOCKER_COMPOSE=docker-compose.e2e.yml npm run test"
}
}
+1 -12
View File
@@ -8,23 +8,12 @@ const path = require("path");
const fs = require('fs');
/**
* Execute Docker compose, passing the correct host directory (in case this is run from the TestCafe container)
* Execute Docker compose, passing the correct host directory
*/
export function dockerCompose(command: string): void {
let param = '';
const projectDir = process.env.PROJECT_DIR;
const overrideDockerCompose = process.env.OVERRIDE_DOCKER_COMPOSE;
if (!projectDir && fs.existsSync('/project')) {
// We are probably in the docker-image AND we did not pass PROJECT_DIR env variable
throw new Error('Incorrect docker-compose command used to fire testcafe tests. You need to add a PROJECT_DIR environment variable. Please refer to the CONTRIBUTING.md guide');
}
if (projectDir) {
const dirName = path.basename(projectDir);
param = '--project-name '+dirName+' --project-directory '+projectDir;
}
if (overrideDockerCompose) {
param += ' -f docker-compose.yaml -f '+overrideDockerCompose;
}