Add testing md
This commit is contained in:
1 parent
5a55a50c48
commit
614a89dedb
2 files changed
+39
No files matched your search
@@ -30,6 +30,7 @@ XMRChat is a tip-for-chat application. Users can set up a page and have others s
|
||||
- [Client](#client)
|
||||
|
||||
- [Development](#development)
|
||||
- [Testing 🔬](#testing)
|
||||
|
||||
## <a name="tech-stack">Technology Stack 🚀</a>
|
||||
|
||||
@@ -234,6 +235,19 @@ npm i
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## <a name="testing">Testing 🔬</a>
|
||||
|
||||
For detailed testing instructions, see [TESTING.md](./TESTING.md).
|
||||
|
||||
**Client tests** live in `client/` and can be run with:
|
||||
|
||||
```bash
|
||||
cd client
|
||||
npx playwright test
|
||||
```
|
||||
|
||||
We also provide a GitHub Actions workflow to SSH into your server, spin up containers, run migrations, and execute Playwright tests. See [TESTING.md](./TESTING.md) for more information.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the Apache License 2.0.
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
# Testing
|
||||
|
||||
This document describes how to run tests in the XMRChat project.
|
||||
Tests are using [Playwright](https://playwright.dev/) and run from client directory.
|
||||
|
||||
## Setup tests
|
||||
|
||||
To setup tests the server needs to be running with `TEST_ENV` variable set to `true`. It adds the TestModule for creating a user and page for making tips in tests.
|
||||
You need to pass the url of running client application to `TEST_BASE_URL` ( for example http://localhost:3002 ) env in client when running tests. It is used in `playwright.config.ts` file as base url for navigation.
|
||||
|
||||
## Running tests
|
||||
|
||||
**Locally**
|
||||
You can run tests locally while the both server and client are running.
|
||||
|
||||
```bash
|
||||
cd client
|
||||
# Make sure you have TEST_BASE_URL then run:
|
||||
npx playwright test
|
||||
```
|
||||
|
||||
**Github actions**
|
||||
|
||||
The test.yml workflow file runs the tests in a server.
|
||||
It needs setting `SERVER_HOST` and `SERVER_USERNAME` and `SERVER_PASSWORD` secrets in repository secrets and also changing the wokrflow file to run the tests from where you have XMRChat.
|
||||
Reference in new issue
Block a user