Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development fix farm page tests #3690

Draft
wants to merge 19 commits into
base: development
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update docs to run tests agains mainnet
ramezsaeed committed Nov 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit ba3aaf4c26e0181fa935e9c15085931130efbaec
48 changes: 37 additions & 11 deletions packages/playground/tests/frontend_selenium/selenium.md
Original file line number Diff line number Diff line change
@@ -7,17 +7,40 @@
| [requests](https://pypi.org/project/requests/) | `2.31.0` |
| [selenium](https://pypi.org/project/selenium/) | `4.10.0` |
| [PyVirtualDisplay](https://pypi.org/project/PyVirtualDisplay/) | `3.0` |
| [webdriver-manager](https://pypi.org/project/webdriver-manager/) | `3.9.1` |
| [webdriver-manager](https://pypi.org/project/webdriver-manager/) | `4.0.2` |

## Running selenium
There are two ways to run the Automation selenium tests:

1- Run Tests against the local dashboard environment which installed from latest commit on development branch.
2- Run Tests against any live environment (Devnet, QAnet, Testnet and Mainnet)

### First
### First (Run Tests against local dashboard)
#### Prepare dashboard locally
- In the root directory 'tfgrid-sdk-ts/', run:

`yarn install`
`yarn lerna run build`
`make run project=playground`

- You need to leave the localhost running and open a new terminal.

- In the root directory, run `yarn install`, then `yarn lerna run build`, and finally `make run project=playground`.
- Change directory to frontend selenium by running `cd packages/playground/tests/frontend_selenium/` in the command line.
- Install the recommended version of the pip package listed above for a stable run, or you can just install Python 3 and use the command:
- `pip install -r requirements.txt --break-system-packages` (Use this if you don't use any of the listed packages).
- Or use Virtual Environments: First, create an environment using `python -m venv myenv`, then activate it using `source myenv/bin/activate`, and finally, install packages using `pip install -r requirements.txt`.

### Second (Run Tests against any live environment)
#### update the config files to point to the target environment
- In order to do that; will need to update the env url and some other variables directly in these files config.ini and base.by
- Ex.: to run agains Mainnet
- config.ini:
```
[Base]
net = main
```
- base.by:
```
base_url = 'https://dashboard.grid.tf/'
```

### Setup environment configurations
- Add your configuration either in [config.ini](../frontend_selenium/Config.ini) or by exporting `TFCHAIN_MNEMONICS`, `TFCHAIN_NODE_MNEMONICS`, `STELLAR_ADDRESS`, and `EMAIL`.
- Description of config under `Base` section:
- `port`: the port that the localhost is running on.
@@ -28,16 +51,19 @@
- `address`: a stellar address with a TFT trustline that will be used in TFT bridge-related tests.
- `email`: a valid email that will be used for all the automated tests.
- If the port in serve changes from `5173` for any reason, you should update the `port` under the `Base` section in [config.ini](../frontend_selenium/Config.ini) to reflect the new value.
- You'll also need to install `Xvfb`, Run `sudo apt install xvfb`.

### Second

- You need to leave the localhost running and open a new terminal.
### Prepare tests requirements
- Change directory to frontend selenium by running `cd packages/playground/tests/frontend_selenium/` in the command line.
- Install the recommended version of the pip package listed above for a stable run, or you can just install Python 3 and use the command:
- `pip install -r requirements.txt --break-system-packages` (Use this if you don't use any of the listed packages).
- Or use Virtual Environments: First, create an environment using `python -m venv myenv`, then activate it using `source myenv/bin/activate`, and finally, install packages using `pip install -r requirements.txt`.
- You'll also need to install `Xvfb`, Run `sudo apt install xvfb`.
- You can run selenium tests with pytest through the command line using `python3 -m pytest -v`.

### More options to run tests

- If you want to run the tests visually to see how they are running, you need to comment out the lines `16` and `33` in the [conftest.py](../frontend_selenium/tests/conftest.py).
- If you want to run the tests visually to see how they are running, you need to comment out the lines `16` and `34` in the [conftest.py](../frontend_selenium/tests/conftest.py).
- You can also run single test file through the command line using `python3 -m pytest -v tests/file/test_file.py`.
- You can also run specific test cases through the command line using `python3 -m pytest -v tests/file/test_file.py::test_func`.
- You can also run collection of test cases through the command line using `python3 -m pytest -v -k 'test_func or test_func'`.