* Add run test suite guide.
This commit is contained in:
Benjamin Forehand Jr 2018-10-04 14:31:26 -04:00 коммит произвёл GitHub
Родитель d30edc200e
Коммит a7dcc5cf8a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 51 добавлений и 2 удалений

Просмотреть файл

@ -40,9 +40,56 @@ $ cd redash-ui-tests
When you're ready dive right into the next steps to learn about how to work
with the tests.
## Run the test suite
#### Redash Setup
The redash instance must be setup before running the tests. Start the images ```docker-compose up -d``` in the root of the directory in which the project was downloaded to. This will download the images if you don't have them. It will also start the container in the background. You can view the status of the containers via ```docker-compose ps```. You can also stop the docker container by running ```docker-compose stop```.
All the following commands should also be run within the same directory that you downloaded the project too.
Run these following commands to setup Redash:
1. Create Database:
```
docker-compose run --rm server create_db
```
2. Create test Database
```
docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"
```
3. Create a default user named ```rootuser``` with a password ```IAMROOT``` and an organization ```default```.
```
docker-compose run --rm server /app/manage.py users create_root root@example.com "rootuser" --password "IAMROOT" --org default
```
4. Create a new data source named ```ui-tests```.
```
docker-compose run --rm server /app/manage.py ds new "ui-tests" --type "url" --options '{"title": "uitests"}'
```
You can visit ```127.0.0.1:5000```, or ```localhost:5000``` in a web browser to see the redash login page.
___
#### Docker Test
Build the redash-ui-tests with this command:
```
docker build -t "redash-ui-tests:latest"
```
Then run the tests:
```
docker run --net="host" --env REDASH_SERVER_URL=http://127.0.0.1:5000 redash-ui-tests:latest
```
If there are failures you can view the html report by first running this command
```
docker cp ui-tests:/home/user/src/report.html ./report.html
```
and open the ```report.html```, which should be located within the projects root directory, in your web browser.
#### Using Make
Redash-ui-tests include a Makefile to run setup and tests.
##### Make Commands
To setup the redash instance us:e ```make setup-redash```.
To run the docker tests use: ```make docker-ui-tests```.
To run the tests using a local firefox browser use: ```make ui-tests```.
🚧 **TODO**
## Break a test
@ -53,6 +100,8 @@ with the tests.
[docker-compose]: https://docs.docker.com/compose/
[docker-install]: https://docs.docker.com/install/
[docker]: https://docs.docker.com/
[geckodriver]: https://github.com/mozilla/geckodriver/releases
[git-downloads]: https://git-scm.com/downloads
[git]: https://git-scm.com/
[github]: https://github.com/
[pipenv]: https://pipenv.readthedocs.io/en/latest/#install-pipenv-today