Skip to content

Commit

Permalink
Test/gnosis coverage (#1853)
Browse files Browse the repository at this point in the history
  • Loading branch information
MareskoY authored Nov 21, 2023
1 parent ea5fa0d commit cdb3afa
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-test-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
- ethereum
- base
- gho
- gnosis
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
- ethereum
- gho
- base
- gnosis
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-deploy-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
- ethereum
- base
- gho
- gnosis
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

Expand Down
15 changes: 15 additions & 0 deletions cypress/configs/v3-markets/gnosis-v3-smoke.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'cypress';

import { defaultConfig } from '../base.cypress';

const folder = `./cypress/e2e/1-v3-markets/7-gnosis-v3-market/`;

export default defineConfig({
...defaultConfig,
e2e: {
specPattern: [
folder + '0-assets/usdc.gnosis-v3.cy.ts',
folder + '0-assets/sdai.gnosis-v3.cy.ts',
],
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import assets from '../../../../fixtures/assets.json';
import constants from '../../../../fixtures/constans.json';
import { skipState } from '../../../../support/steps/common';
import { configEnvWithTenderlyGnosisFork } from '../../../../support/steps/configuration.steps';
import { borrow, repay, supply, withdraw } from '../../../../support/steps/main.steps';
import { dashboardAssetValuesVerification } from '../../../../support/steps/verification.steps';

const testData = {
depositBaseAmount: {
asset: assets.gnosisV3Market.xDAI,
amount: 9000,
hasApproval: true,
},
testCases: {
borrow: [
{
asset: assets.gnosisV3Market.USDC,
amount: 50,
apyType: constants.borrowAPYType.default,
hasApproval: true,
},
],
deposit: {
asset: assets.gnosisV3Market.USDC,
amount: 10.1,
hasApproval: false,
},
repay: [
{
asset: assets.gnosisV3Market.USDC,
apyType: constants.apyType.variable,
amount: 2,
hasApproval: true,
repayOption: constants.repayType.default,
},
{
asset: assets.gnosisV3Market.USDC,
apyType: constants.apyType.variable,
repayableAsset: assets.gnosisV3Market.aUSDC,
amount: 2,
hasApproval: true,
repayOption: constants.repayType.default,
},
],
withdraw: {
asset: assets.gnosisV3Market.USDC,
isCollateral: true,
amount: 1,
hasApproval: true,
},
},
verifications: {
finalDashboard: [
{
type: constants.dashboardTypes.deposit,
assetName: assets.gnosisV3Market.USDC.shortName,
amount: 7.0,
collateralType: constants.collateralType.isCollateral,
isCollateral: true,
},
{
type: constants.dashboardTypes.borrow,
assetName: assets.gnosisV3Market.USDC.shortName,
amount: 46.0,
apyType: constants.borrowAPYType.variable,
},
],
},
};

describe('USDC INTEGRATION SPEC, GNOSIS V3 MARKET', () => {
const skipTestState = skipState(false);
configEnvWithTenderlyGnosisFork({ v3: true });

supply(testData.depositBaseAmount, skipTestState, true);
testData.testCases.borrow.forEach((borrowCase) => {
borrow(borrowCase, skipTestState, true);
});
supply(testData.testCases.deposit, skipTestState, true);
testData.testCases.repay.forEach((repayCase) => {
repay(repayCase, skipTestState, false);
});
withdraw(testData.testCases.withdraw, skipTestState, false);
dashboardAssetValuesVerification(testData.verifications.finalDashboard, skipTestState);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import assets from '../../../../fixtures/assets.json';
import constants from '../../../../fixtures/constans.json';
import { skipState } from '../../../../support/steps/common';
import { configEnvWithTenderlyGnosisFork } from '../../../../support/steps/configuration.steps';
import {
borrow,
changeCollateral,
changeCollateralNegative,
repay,
supply,
withdraw,
} from '../../../../support/steps/main.steps';
import {
borrowsUnavailable,
dashboardAssetValuesVerification,
} from '../../../../support/steps/verification.steps';

const testData = {
testCases: {
deposit: {
asset: assets.gnosisV3Market.xDAI,
amount: 500,
hasApproval: true,
},
collateral: {
switchOff: {
asset: assets.gnosisV3Market.xDAI,
isCollateralType: true,
hasApproval: true,
},
switchOn: {
asset: assets.gnosisV3Market.xDAI,
isCollateralType: false,
hasApproval: true,
},
switchNegative: {
asset: assets.gnosisV3Market.xDAI,
isCollateralType: true,
},
},
borrow: [
{
asset: assets.gnosisV3Market.xDAI,
amount: 100,
apyType: constants.borrowAPYType.default,
hasApproval: false,
},
],
withdraw: [
{
asset: assets.gnosisV3Market.xDAI,
isCollateral: true,
amount: 50,
hasApproval: false,
},
],
repay: [
{
asset: assets.gnosisV3Market.xDAI,
apyType: constants.apyType.variable,
amount: 10,
hasApproval: true,
repayOption: constants.repayType.default,
},
{
asset: assets.gnosisV3Market.xDAI,
apyType: constants.apyType.variable,
repayableAsset: assets.gnosisV3Market.aWXDAI,
amount: 10,
hasApproval: false,
repayOption: constants.repayType.default,
},
],
},
verifications: {
finalDashboard: [
{
type: constants.dashboardTypes.deposit,
assetName: assets.gnosisV3Market.xDAI.shortName,
amount: 450,
collateralType: constants.collateralType.isCollateral,
isCollateral: true,
},
{
type: constants.dashboardTypes.borrow,
assetName: assets.gnosisV3Market.xDAI.shortName,
amount: 90,
apyType: constants.borrowAPYType.variable,
},
],
},
};

describe('xDAI INTEGRATION SPEC, GNOSIS V3 MARKET', () => {
const skipTestState = skipState(false);
configEnvWithTenderlyGnosisFork({ v3: true });

supply(testData.testCases.deposit, skipTestState, true);
describe('Check Collateral switching', () => {
changeCollateral(testData.testCases.collateral.switchOff, skipTestState, false);
borrowsUnavailable(skipTestState);
changeCollateral(testData.testCases.collateral.switchOn, skipTestState, false);
});
testData.testCases.borrow.forEach((borrowCase) => {
borrow(borrowCase, skipTestState, true);
});
changeCollateralNegative(testData.testCases.collateral.switchNegative, skipTestState, false);
testData.testCases.withdraw.forEach((withdrawCase) => {
withdraw(withdrawCase, skipTestState, false);
});
testData.testCases.repay.forEach((repayCase) => {
repay(repayCase, skipTestState, false);
});
dashboardAssetValuesVerification(testData.verifications.finalDashboard, skipTestState);
});
26 changes: 26 additions & 0 deletions cypress/fixtures/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -1055,5 +1055,31 @@
"collateral": true,
"wrapped": false
}
},
"gnosisV3Market": {
"xDAI": {
"fullName": "xDAI",
"shortName": "xDAI",
"collateral": true,
"wrapped": false
},
"aWXDAI": {
"fullName": "aWXDAI",
"shortName": "aWXDAI",
"collateral": true,
"wrapped": false
},
"USDC": {
"fullName": "USDC",
"shortName": "USDC",
"collateral": true,
"wrapped": false
},
"aUSDC": {
"fullName": "aUSDC",
"shortName": "aUSDC",
"collateral": true,
"wrapped": false
}
}
}
4 changes: 4 additions & 0 deletions cypress/support/steps/configuration.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ export const configEnvWithTenderlyAEthereumV3Fork = createConfigWithTenderlyFork
ChainId.mainnet,
'fork_proto_mainnet_v3'
);
export const configEnvWithTenderlyGnosisFork = createConfigWithTenderlyFork(
ChainId.xdai,
'fork_proto_gnosis_v3'
);
export const configEnvWithTenderlyGoerliGhoFork = createConfigWithTenderlyFork(
ChainId.goerli,
'fork_proto_goerli_gho_v3'
Expand Down

2 comments on commit cdb3afa

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.