|
2 | 2 |
|
3 | 3 | Local viewer for YDB clusters |
4 | 4 |
|
5 | | -## How to work with this repo |
| 5 | +## Development |
6 | 6 |
|
7 | | -### Development |
8 | | - |
9 | | -1) Run on a machine with Docker installed: |
| 7 | +1. Run on a machine with Docker installed: |
10 | 8 | ``` |
11 | 9 | docker pull cr.yandex/yc/yandex-docker-local-ydb |
12 | 10 | docker run --hostname localhost -e YDB_ALLOW_ORIGIN="http://localhost:3000" -dp 2135:2135 -dp 8765:8765 cr.yandex/yc/yandex-docker-local-ydb |
13 | 11 | ``` |
14 | | -2) Run the frontend app in the development mode, via invoking `npm run dev` |
15 | | -3) Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\ |
| 12 | +2. Run the frontend app in the development mode, via invoking `npm run dev` |
| 13 | +3. Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\ |
16 | 14 | You will also see any lint errors in the console. |
17 | 15 |
|
18 | 16 | For API reference, open Swagger UI on http://localhost:8765/viewer/api/. |
19 | 17 |
|
20 | | -### Making a production bundle. |
| 18 | +## E2E Tests |
| 19 | + |
| 20 | +For e2e tests we use `@playwright/tests`. Tests configuration is in `playwright.config.ts`. Tests are set up in `tests` dir. |
| 21 | + |
| 22 | +### Commands |
| 23 | + |
| 24 | +Install all Playwright dependencies and chromium to run tests. |
| 25 | + |
| 26 | +``` |
| 27 | +npm run test:e2e:install |
| 28 | +``` |
| 29 | + |
| 30 | +Run tests. If `PLAYWRIGHT_BASE_URL` is provided, tests run on this url, otherwise Playwright `webServer` is started with `npm run dev` on `http://localhost:3000` and all tests run there. |
| 31 | + |
| 32 | +``` |
| 33 | +npm run test:e2e |
| 34 | +``` |
| 35 | + |
| 36 | +### CI |
| 37 | + |
| 38 | +E2E tests are run in CI in `e2e_tests` job. Tests run on Playwright `webServer` (it is started with `npm run dev`), `webServer` uses docker container `cr.yandex/yc/yandex-docker-local-ydb` as backend. |
| 39 | + |
| 40 | +## Making a production bundle. |
21 | 41 |
|
22 | 42 | Base command `npm run build` builds the app for production to the `build` folder.\ |
23 | 43 | It correctly bundles React in production mode and optimizes the build for the best performance. |
24 | 44 |
|
25 | 45 | The build is minified and the filenames include the hashes. |
26 | 46 |
|
27 | 47 | To test production bundle with latest YDB backend release, do the following: |
28 | | -1) Build a production bundle with a few tweaks for embedded version: `npm run build:embedded`. |
29 | | -2) Invoke `docker run -it --hostname localhost -dp 2135:2135 -p 8765:8765 -v ~/projects/ydb-embedded-ui/build:/ydb_data/node_1/contentmonitoring cr.yandex/yc/yandex-docker-local-ydb:latest` |
30 | | -3) Open [embedded YDB UI](http://localhost:8765/monitoring) to view it in the browser. |
| 48 | + |
| 49 | +1. Build a production bundle with a few tweaks for embedded version: `npm run build:embedded`. |
| 50 | +2. Invoke `docker run -it --hostname localhost -dp 2135:2135 -p 8765:8765 -v ~/projects/ydb-embedded-ui/build:/ydb_data/node_1/contentmonitoring cr.yandex/yc/yandex-docker-local-ydb:latest` |
| 51 | +3. Open [embedded YDB UI](http://localhost:8765/monitoring) to view it in the browser. |
0 commit comments