This project contains scripts capable to execute E2E flows on Sygma testnet and mainnet environments, Sprinter API calls with execution and Cypress API tests for Sprinter - mainly for regression testing.
- Location:
src/Sygma_Tests/
- Contains end-to-end test flows for Sygma testnet and mainnet environments
- Includes tests for:
- EVM to EVM fungible transfers
- EVM to EVM GMP transfers
- Combined fungible and GMP transfers
- Location:
src/Sprinter_API_Tests/
- Contains direct API call tests for the Sprinter service
- Tests various API endpoints and functionality
- Location:
cypress/e2e/Sprinter/
- API testing suite using Cypress
- Includes:
- GET request tests
- POST request tests
- Response validation
- Error handling scenarios
Getting Started
Make sure you have the following installed on your system:
- Node.js (version 14.x or later)
- Yarn
- Cypress installed either globally or locally within your project
To get started with running Cypress tests from this repository, follow these steps:
-
Clone the repository:
git clone https://github.com/sygmaprotocol/qa-utils.git
-
Navigate to project directory:
cd qa-utils
-
Install dependencies:
yarn install
-
Populate with correct values the
.env
file. Check the.env.example
for reference.
The fungible transfer script supports the following optional parameters:
# Basic usage
yarn transfer:fungible
# With specific source chains
yarn transfer:fungible -s 2,6,11
# With specific destination chains
yarn transfer:fungible -d 5,6,10
# With specific resource IDs
yarn transfer:fungible -r 0x0000000000000000000000000000000000000000000000000000000000001100
# Combining parameters
yarn transfer:fungible -s 2,6 -d 5,10 -r 0x0000000000000000000000000000000000000000000000000000000000001100
Parameters:
-s, --source
: Source chain IDs (comma-separated)-d, --destination
: Destination chain IDs (comma-separated)-r, --resources
: Resource IDs (comma-separated)
yarn transfer:gmp
yarn transfer:fungible_and_gmp
Be sure to set account, amount, destination, token, whitelistedSourceChains and threshold in the PostCallNoContractCall.ts file prior to running the script.
yarn postCall
Be sure to set account, amount, destination, token, whitelistedSourceChains, threshold, approvalAddress, callData, contractAddress, gasLimit and outputTokenAddress in the PostCallWithContractCall.ts file prior to running the script.
yarn postaCallContract
There are several ways to run the Cypress tests in this project:
For all the GET tests
yarn cypress:run:get
For all the POST tests
yarn cypress:run:post
For all the Sprinter API calls tests
yarn cypress:run:tests
If you prefer to run the tests in the Cypress Test Runner for debugging:
yarn cypress:open
This will open the Cypress Test Runner, and you can manually select sprinter_GET_testnet.cy.ts from the UI.
You can also run the tests in specific browsers in headless mode. For example, to run the tests in Chrome:
yarn cypress run --spec cypress/e2e/Sprinter/sprinter_GET_testnet.cy.ts --browser chrome