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
- The scripts are capable of running the tests with specific parameters so we can use specific scenarios for testing
- Each script has reports to the console with the results of the execution and stored in the
src/Sygma_Tests/reports
folder
- 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 will trigger ALL 2 ALL transfers
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
# With specific amount
yarn transfer:fungible -a 1000000000000000000
# Combining parameters
yarn transfer:fungible -s 2,6 -d 5,10 -r 0x0000000000000000000000000000000000000000000000000000000000001100 -a 1000000000000000000
Parameters:
-s, --source
: Source chain IDs (comma-separated)-d, --destination
: Destination chain IDs (comma-separated)-r, --resources
: Resource IDs (comma-separated)-a, --amount
: Amount (comma-separated)- if a parameter is not provided, the script will use the default values which are all the valid values for the parameter
- the amount parameter is recommended to be provided only with a sepcific resource ID so that the decimals are correctly applied
# Basic usage will trigger ALL 2 ALL transfers
yarn transfer:gmp
# With specific source chains
yarn transfer:fungible -s 2,6,11
# With specific destination chains
yarn transfer:fungible -d 5,6,10
# Combining parameters
yarn transfer:fungible -s 2,6 -d 5,10
Parameters:
-s, --source
: Source chain IDs (comma-separated)-d, --destination
: Destination chain IDs (comma-separated)- if a parameter is not provided, the script will use the default values which are all the valid values for the parameter
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