Removind cypress tests from the docs (sadly)

This commit is contained in:
leogermani 2019-05-08 15:40:54 -03:00
parent eee021120d
commit c4bdce5548
2 changed files with 8 additions and 23 deletions

View File

@ -43,6 +43,8 @@ In addition to [our documentation](https://wiki.tainacan.org/) and [instructiona
### Contributing
Tainacan is a free, open source software licensed under **GPLv3**. Contributions to the codebase will abide to the same license; other contributions may be under additional or other terms.
See how to [setup your local development environment](docs/setup-local.md).
To contribute with our project, you can report bugs and other issues, or suggest new features. You are also free to submit pull requests or translate Tainacan to multiple languages. If you are interested in contributing, you can get started by reading our [contribution guidelines](docs/CONTRIBUTING.md).
### Acknowledgements

View File

@ -67,15 +67,15 @@ While developing, you might want to run `build-watch.sh`. This script will watch
## Tests
Tainacan uses `phpunit` to run tests for the backend and the API, and `cypress` tu run tests for the front end. This is a very important part of the development proccess! Never commit anything before run all the tests to make sure you did not break anything. If you are developing a new feature, you must write tests for it. If you are fixing a bug, you should first write a test that reproduces the bug and then make it pass.
Tainacan uses `phpunit` to run tests for the backend and the API. This is a very important part of the development proccess! Never commit anything before run all the tests to make sure you did not break anything. If you are developing a new feature, you must write tests for it. If you are fixing a bug, you should first write a test that reproduces the bug and then make it pass.
To execute all the tests, simply execute the `run-tests` script. But first you need to configure PHPUnit.
To execute all the tests, simply execute the `phpunit` command from the project root folder. But first you need to configure PHPUnit.
#### Preparing PHPUnit
To run the unit tests it is necessary to create a new MySQL database for your unit tests. This database will be cleaned and restored every time you run PHPUnit.
Install the WordPress test library by running the script provided in:
Install the WordPress test library by running the script provided in the `tests/bin` folder, by running the following command:
```
tests/bin/install-wp-tests.sh wordpress_test root root /path/to/wordpress-test-folder localhost latest
@ -85,12 +85,12 @@ The parameters are:
* Database name
* MySQL username
* MySQL password
* WordPress Test Directory
* WordPress Test Directory*
* MySQL host
* WordPress version
* Optional: skip create database
`WordPress Test Directory` will be created with 2 sub folders:
\* `WordPress Test Directory` will be created with 2 sub folders:
* `wordpress-test` - An installation of WordPress
* `wordpress-tests-lib` - As the name says, the WordPress Tests Library
@ -103,13 +103,7 @@ You only need to do all this once, and now you are ready to run tests.
#### Running tests
If you want to run all the tests, simply run:
```
./run-tests.sh
```
If you want to run only backend tests, run
Simply type this command from the project root folder:
```
phpunit
@ -117,14 +111,3 @@ phpunit
(Note that `phpunit` accpets several parametrs, for example if you want to run just a specific group of tests).
If you want to run front-end tests, opening the Cypress app and beeing able to run individual tests and debug, run
```
./run-cypress.sh
```
**Important note about the Cypress setup:**
Cypress will use the same local WordPress installation you configure in the build to run its tests. But before it does so, it will edit the `wp-config.php` file and change the `$db_prefix` variable, so, in reality, it will run all the tests in a brand new WordPress installation. After the tests are completed, it deletes this installation from the database and restores the `wp-config.php` as it was before. So, make sure you allways let the script run till the end to restore you configuration. For instance, if you opened Cypress window and are running the tests, dont exit it by Ctrl+C in the terminal. Close the window gently and let the script finish its job.
If, by any reason, you interrupt the script, no worries, just manually edit you `wp-config.php` and delete the line added by the script.