Skip to content

Commit d735442

Browse files
authored
test: add chopsticks e2e tests (#481)
1 parent af7f278 commit d735442

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3886
-2215
lines changed

.github/workflows/pr.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,10 @@ jobs:
101101
run: yarn install
102102

103103
- name: Unit tests.
104-
run: yarn test
104+
run: yarn test:unit
105+
106+
- name: Integration tests.
107+
run: yarn test:integration
108+
109+
- name: E2E tests.
110+
run: yarn test:e2e

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ zombienet/bin/*
2323
# Binaries
2424
/bin/*
2525
!bin/README.md
26+
27+
# Chopsticks
28+
db.sqlite
29+
db.sqlite-*

README.md

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -397,40 +397,10 @@ api.claimAssets(
397397

398398
Note: claimAssets works when pallet-xcm is configured as the AssetTrap for the given runtime. This is true for all relay chains and system parachains but may not be for other chains.
399399

400-
## License
401-
402-
The source code in this repository is distributed under the Apache 2.0 license. See the [LICENSE](https://github.com/paritytech/asset-transfer-api/blob/main/LICENSE) file. This source code comes with absolutely no warranty. Use at your own risk.
403-
404-
## Zombienet Testing
405-
406-
Zombienet is used to launch a complete network including a relay chain, and two parachains. It will create HRMP channels betweens the launched parachains allowing the testing environment to send XCM messages and transfer assets.
407-
408-
### **Requirements**:
409-
410-
**Zombienet Binary**: You can download the appropriate binary from the zombienet repository [here](https://github.com/paritytech/zombienet/releases). Ensure that it is in the root of this directory. Note: For macos users if permission is denied to run the binary you can `chmod 755 <file_name>` to allow permissions.
411-
412-
**Test Network Binaries**: You will need the following binaries depending on whether you want to run a small or medium network:
413-
414-
- polkadot: You can find the releases [here](https://github.com/paritytech/polkadot-sdk/releases). (Needed for small, or medium network)
415-
- trappist-collator: This binary is compiled along with polkadot above. You can find it [here](https://github.com/paritytech/trappist). (Needed for medium network)
416-
- polkadot-parachain (ie: cumulus): You can find the releases [here](https://github.com/paritytech/polkadot-sdk/releases). (Needed for small, or medium network)
417-
418-
NOTES:
419-
420-
- When it comes to picking a version for both `cumulus` and `polkadot` ensure they are the same. Cumulus will have an extra 0 at the end though. Ex: v0.9.37 (polkadot) -> v0.9.370 (cumulus)
421-
422-
- You can retrieve the binaries via the release, or by compiling yourself. It's recommended to compile it yourself.
423-
424-
Copy each binary that is necessary into the root `<root>/bin` folder.
425-
426-
### Running Zombienet
427-
428-
From the root directory run `./<zombienet_binary_name> -p native spawn ./zombienet/<network_file>.toml | tee zombienet.log`
429-
430-
### Create an asset
400+
## E2E Testing
431401

432-
From the root directory run `yarn start:zombienet-post-script`. You can run this right after running your zombienet network.
402+
You can access the E2E tests and their documentation [here](./e2e-tests/).
433403

434-
## E2E Testing
404+
## License
435405

436-
You can access the E2E tests and its documentation [here](./e2e-tests/).
406+
The source code in this repository is distributed under the Apache 2.0 license. See the [LICENSE](https://github.com/paritytech/asset-transfer-api/blob/main/LICENSE) file. This source code comes with absolutely no warranty. Use at your own risk.

e2e-tests/README.md

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,15 @@
11
## E2E Tests
22

3-
End-to-end tests that run on a zombienet testnet.
3+
End-to-End tests that run using Chopsticks.
44

5-
**NOTE: tested using polkadot v1.4.0**
6-
7-
### Setup
8-
9-
To setup the testing environment you need to first download the `polkadot`, `polkadot-execute-worker`, `polkadot-prepare-worker` and `polkadot-parachain` from the `polkadot-sdk` [release page](https://github.com/paritytech/polkadot-sdk/releases/latest), as well as the `trappist-node` from its [release page](https://github.com/paritytech/trappist/releases/latest), and place them in the `../zombienet/bin/` folder.
10-
11-
You also need to have the latest `zombienet` executable in the `../zombienet/` folder, which you can download from [here](https://github.com/paritytech/zombienet/releases/latest).
12-
13-
### Launching zombienet
14-
15-
To launch the zombienet run the following commands:
5+
To run the end-to-end tests run the command:
166

177
```bash
18-
$ yarn build && yarn e2e:build
8+
$ yarn build && yarn build:e2e
199
```
2010

2111
Then run:
2212

2313
```bash
24-
$ yarn e2e:zombienet
14+
$ yarn test:e2e
2515
```
26-
27-
And this will launch the zombienet using the config file located in the `../zombienet/` directory. Once it finished its setup, you can proceed to the following step.
28-
29-
### Launching the tests
30-
31-
For testing, we provide 4 options:
32-
33-
- Testing liquidity tokens transfers with the command `yarn e2e:liquidity-assets`.
34-
- Testing foreign assets transfers with the command `yarn e2e:foreign-assets`.
35-
- Testing local transferss with the command `yarn e2e:local`.
36-
- Testing assets transfers with the command `yarn e2e:assets`.
37-
38-
Each of these commands will run the appropiate script to setup the basics, located in `../scripts/`. Wait for it to finish setting up the testing environment, and then go through the tests indicated in the `./tests/index.ts` file for the chosen option.
39-
40-
After each testing suite has been completed, it's recommended to restart the zombienet before running another test suite.

e2e-tests/balance.ts

Lines changed: 0 additions & 138 deletions
This file was deleted.

e2e-tests/consts.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)