{"id":27742547,"url":"https://github.com/astarnetwork/e2e-tests","last_synced_at":"2025-04-28T16:42:37.016Z","repository":{"id":208448243,"uuid":"721655648","full_name":"AstarNetwork/e2e-tests","owner":"AstarNetwork","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-28T05:33:46.000Z","size":7365,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-28T12:54:39.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AstarNetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-21T14:02:38.000Z","updated_at":"2025-02-28T05:33:49.000Z","dependencies_parsed_at":"2024-05-30T20:45:35.393Z","dependency_job_id":"a8d851e5-9f3e-4660-9e4c-157b3fb51eb6","html_url":"https://github.com/AstarNetwork/e2e-tests","commit_stats":null,"previous_names":["astarnetwork/e2e-tests"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fe2e-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fe2e-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fe2e-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstarNetwork%2Fe2e-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AstarNetwork","download_url":"https://codeload.github.com/AstarNetwork/e2e-tests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251347729,"owners_count":21575135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-28T16:42:36.053Z","updated_at":"2025-04-28T16:42:37.009Z","avatar_url":"https://github.com/AstarNetwork.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# e2e-tests\n\nEnd to end tests for Astar and Shiden.\n\nTests are powered by [Chopsticks](http://github.com/AcalaNetwork/chopsticks) to always run with latest mainnet block.\n\n## Running tests\n\nAll tests:\n`yarn test`\n\nRun one test only:\n`yarn test ./tests/xcm-transfer/kusama-relay.test.ts`\n\nOr you can just use a keyword since it is using vitest and use regex to find tests:\n`yarn test xcm`\n\n## Check compatibility with upcoming runtime\n\nIf you don't expect breaking change, simply add `{NETWORK}_WASM=wasm/runtime/path` to `.env` file to override the runtime and run the tests.\n\nIf there are expected breaking change, you can add a new network with the new runtime and add new tests using the new network. Check other tests as a reference.\n\n## Contributing\n\nThis repo is using [vitest](https://vitest.dev) as the test runner. Most of the tests are written as [snapshot tests](https://vitest.dev/guide/snapshot.html). The test will run and save the result as snapshot in a `.snap` file, and next time when the test runs again, it will compare the result with the snapshot. This eliminates the need to write assertions and make the test more readable.\n\nThere is [periodic check](https://github.com/AstarNetwork/e2e-tests/actions/workflows/check.yml) Github Action to run the tests against latest mainnet block to detect compatibility issues with live networks.\n\nIt is recommended use `yarn update-env` to update the `.env` file with latest block number before running the tests. This ensures tests are always running against the same blocks so that block data can be cached and reused to speed up test running time. Once you have a working test, update the blocks number again and rerun the tests to ensure the tests are block number indpendent. Use `redact` and event filters to make the snapshot be consistent regardless the block number.\n\n### Files\n\n- [networks](./networks) - network configs\n- [tests](./tests) - tests\n- [wasm](./wasm) - wasm runtime files to test compatibility with upcoming versions\n\n### Debugging Tips\n\n- Move the failed test to [playground.test.ts](./tests/xcm-transfer/playground.test.ts) to only run the failed test.\n- Use `yarn vitest` instead of `yarn test` to display logs.\n- Add `-u` to automatically update snapshots and use git diff tool to compare the changes.\n- For failed CI tests, check the block numbers from the `update-env` steps in the logs to local `.env` file to be able to run the tests with the same block height.\n- Remove the system events filter to see all the events in snapshots.\n\t- e.g. Replace `checkSystemEvents(toChain, 'parachainSystem', 'dmpQueue')` to `checkSystemEvents(toChain)`\n- Insert `await chain.pause()` to pause the test and inspect the Chopsticks instance in the console. The connection details will be displayed in the console log.\n\t- Edit the timeout in `vitest.config.ts` to avoid timeout error.\n\t- Try log the extrinsic hex and replay it in the Chopsticks instance to debug the issue.\n- Try replicate the issue in Chopsticks directly to create a minimal reproducible case.\n- Once you are able to reproduce the issue in Chopsticks, you may add bunch logs in the runtime and make a wasm and override it. Then use `--runtime-log-level 5` to display logs.\n\n### Writing tests\n\n#### Add new network\n\n- Create new network config in [networks](./networks) folder.\n- Update [networks/all.ts](./networks/all.ts) to include the new network.\n- Add Subway config in [scripts/configs](./scripts/configs) folder.\n- Update [run-all.sh](./scripts/run-all.sh) to include the new network.\n\n#### Add new xcm test\n\n- Checkout other tests as a reference and see if you can find something similar as a base case.\n- Starts writing in [playground.test.ts](./tests/xcm-transfer/playground.test.ts) and move to the appropriate test file once it is ready.\n- Add `-u` to automatically update snapshots and manually inspect the generated snapshot file to ensure it is expected.\n\n### Environment variables\n\n- `{NETWORK_NAME}_BLOCK_NUMBER` - block number to run tests against\n- `{NETWORK_NAME}_ENDPOINT` - endpoint to connect to\n- `{NETWORK_NAME}_WASM` - override wasm runtime\n- `DB_URL` - path to db file for caching\n\nExample `.env` file\n\n```\nPOLKADOT_BLOCK_NUMBER=15943997\nKUSAMA_BLOCK_NUMBER=18333291\nPOLKADOT9420_BLOCK_NUMBER=15943997\nKUSAMA9420_BLOCK_NUMBER=18333291\nSTATEMINT_BLOCK_NUMBER=3956812\nSTATEMINE_BLOCK_NUMBER=4689863\nACALA_BLOCK_NUMBER=3785107\nKARURA_BLOCK_NUMBER=4535779\nASTAR_BLOCK_NUMBER=3776318\nSHIDEN_BLOCK_NUMBER=4203165\nACALA2180_BLOCK_NUMBER=3785107\nKARURA2180_BLOCK_NUMBER=4535779\nMOONBEAM_BLOCK_NUMBER=3769096\nMOONRIVER_BLOCK_NUMBER=4446853\nHYDRADX_BLOCK_NUMBER=2750787\nBASILISK_BLOCK_NUMBER=3559987\nBIFROSTPOLKADOT_BLOCK_NUMBER=2522864\nBIFROST_BLOCK_NUMBER=4361576\nALTAIR_BLOCK_NUMBER=3282796\nCENTRIFUGE_BLOCK_NUMBER=3161458\nPARALLEL_BLOCK_NUMBER=3706152\nHEIKO_BLOCK_NUMBER=3710234\n\n\nACALA_ENDPOINT=ws://0.0.0.0:9000\nACALA2180_ENDPOINT=ws://0.0.0.0:9000\nKARURA_ENDPOINT=ws://0.0.0.0:9001\nKARURA2180_ENDPOINT=ws://0.0.0.0:9001\nKUSAMA_ENDPOINT=ws://0.0.0.0:9002\nKUSAMA9420_ENDPOINT=ws://0.0.0.0:9002\nPOLKADOT_ENDPOINT=ws://0.0.0.0:9003\nPOLKADOT9420_ENDPOINT=ws://0.0.0.0:9003\nSTATEMINE_ENDPOINT=ws://0.0.0.0:9004\nSTATEMINT_ENDPOINT=ws://0.0.0.0:9005\nBASILISK_ENDPOINT=ws://0.0.0.0:9006\nHYDRADX_ENDPOINT=ws://0.0.0.0:9007\nMOONBREAM_ENDPOINT=ws://0.0.0.0:9008\nMOONRIVER_ENDPOINT=ws://0.0.0.0:9009\nASTAR_BLOCK_ENDPOINT=ws://0.0.0.0:9010\nSHIDEN_BLOCK_ENDPOINT=ws://0.0.0.0:9011\nBIFROST_BLOCK_ENDPOINT=ws://0.0.0.0:9012\nALTAIR_BLOCK_ENDPOINT=ws://0.0.0.0:9013\nHEIKO_BLOCK_ENDPOINT=ws://0.0.0.0:9014\nBIFROSTPOLKADOT_BLOCK_ENDPOINT=ws://0.0.0.0:9015\nPARALLEL_BLOCK_ENDPOINT=ws://0.0.0.0:9016\nCENTRIFUGE_BLOCK_ENDPOINT=ws://0.0.0.0:9017\n\nDB_PATH=./db.sqlite\n```\n\nUse specific block number for tests and db cache can significantly improve test running speed.\n\nRun `yarn update-env` to update .env file with latest block number.\n\nTo debug failing tests on CI, find the block number config from CI log and put them in .env to run the test with the same block height.\n\n### Use Subway to catch RPC responses\n\nUse [subway](http://github.com/AcalaNetwork/subway) to run local endpoints to catch RPC responses for additional improved test running speed.\n\n- Install Subway: `cargo install --git https://github.com/AcalaNetwork/subway.git`\n- Run: `./scripts/run-all.sh`\n\n## Acknowledgement\n\nThis e2e tests repo are inspired by [Acala's e2e tests](https://github.com/AcalaNetwork/e2e-tests).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastarnetwork%2Fe2e-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastarnetwork%2Fe2e-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastarnetwork%2Fe2e-tests/lists"}