Skip to content

Commit

Permalink
Merge pull request #409 from OasisDEX/daily-improvements-16-july
Browse files Browse the repository at this point in the history
Daily improvements - 16 July
  • Loading branch information
juan-langa authored Jul 16, 2024
2 parents 0a23be3 + eff1766 commit 37aacf4
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 55 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ jobs:
path: playwright-reports/with-wallet-maker-and-spark
retention-days: 30

with-wallet-open-positions-tests-aave-ethereum-earn-multiply:
name: 'Open Positions - Aave - Ethereum - Earn & Multiply'
with-wallet-open-positions-tests-aave-ethereum-borrow:
name: 'Open Positions - Aave - Ethereum - Borrow'
runs-on: ubuntu-latest
env:
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }}
Expand All @@ -164,21 +164,21 @@ jobs:
run: npx playwright install && npx playwright install-deps
- name: Install xvfb
run: apt-get update -y && apt-get -y install xvfb && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
- name: Run Open positions - Aave - Ethereum - Earn & Multiply tests
- name: Run Open Positions - Aave - Ethereum - Borrow tests
run: |
TENDERLY_PROJECT=${{ secrets.TENDERLY_PROJECT }} \
TENDERLY_USER=${{ secrets.TENDERLY_USER }} \
TENDERLY_ACCESS_KEY=${{ secrets.TENDERLY_ACCESS_KEY }} \
yarn nightly:with-wallet:open-positions:aave:ethereum:earn-multiply
yarn nightly:with-wallet:open-positions:aave:ethereum:borrow
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report-with-wallet-open-positions-aave-ethereum-earn-multiply
path: playwright-reports/with-wallet-open-positions-aave-ethereum-earn-multiply
name: playwright-report-with-wallet-open-positions-aave-ethereum-borrow
path: playwright-reports/with-wallet-open-positions-aave-ethereum-borrow
retention-days: 30

with-wallet-open-positions-tests-aave-ethereum-borrow:
name: 'Open Positions - Aave - Ethereum - Borrow'
with-wallet-open-positions-tests-aave-ethereum-earn-multiply:
name: 'Open Positions - Aave - Ethereum - Earn & Multiply'
runs-on: ubuntu-latest
env:
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }}
Expand All @@ -197,17 +197,17 @@ jobs:
run: npx playwright install && npx playwright install-deps
- name: Install xvfb
run: apt-get update -y && apt-get -y install xvfb && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
- name: Run Open Positions - Aave - Ethereum - Borrow tests
- name: Run Open positions - Aave - Ethereum - Earn & Multiply tests
run: |
TENDERLY_PROJECT=${{ secrets.TENDERLY_PROJECT }} \
TENDERLY_USER=${{ secrets.TENDERLY_USER }} \
TENDERLY_ACCESS_KEY=${{ secrets.TENDERLY_ACCESS_KEY }} \
yarn nightly:with-wallet:open-positions:aave:ethereum:borrow
yarn nightly:with-wallet:open-positions:aave:ethereum:earn-multiply
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report-with-wallet-open-positions-aave-ethereum-borrow
path: playwright-reports/with-wallet-open-positions-aave-ethereum-borrow
name: playwright-report-with-wallet-open-positions-aave-ethereum-earn-multiply
path: playwright-reports/with-wallet-open-positions-aave-ethereum-earn-multiply
retention-days: 30

with-wallet-open-positions-tests-aave-l2s:
Expand Down
4 changes: 2 additions & 2 deletions tests/noWallet/rays.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test } from '#noWalletFixtures';
import { longTestTimeout } from 'utils/config';

test.describe('No-wallet connected - Rays', async () => {
test('It should open Rays page - Rays page header', async ({ app }) => {
test('It should open connect-wallet popup - Rays page header', async ({ app }) => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
Expand All @@ -16,7 +16,7 @@ test.describe('No-wallet connected - Rays', async () => {
await app.modals.connectWallet.shouldBeVisible();
});

test('It should open Rays page - Claim Rays block', async ({ app }) => {
test('It should open connect-wallet popup - Claim Rays block', async ({ app }) => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
Expand Down
52 changes: 26 additions & 26 deletions tests/withWallet/morphoBlue/base/morphoBlueBorrow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ test.describe('Morpho Blue Base - Borrow - Wallet connected', async () => {
forkId,
network: 'base',
walletAddress,
token: 'CBETH',
token: 'ETH',
balance: '30',
});
});

await app.page.goto('/base/morphoblue/borrow/CBETH-USDC#setup');
await app.page.goto('/base/morphoblue/borrow/ETH-USDC#setup');

await openPosition({
app,
forkId,
deposit: { token: 'CBETH', amount: '10' },
borrow: { token: 'USDC', amount: '10000' },
deposit: { token: 'ETH', amount: '5' },
borrow: { token: 'USDC', amount: '5000' },
protocol: 'Morpho Blue',
});
});
Expand All @@ -71,14 +71,14 @@ test.describe('Morpho Blue Base - Borrow - Wallet connected', async () => {
await manageDebtOrCollateral({
app,
forkId,
deposit: { token: 'CBETH', amount: '5' },
borrow: { token: 'USDC', amount: '5000' },
deposit: { token: 'ETH', amount: '1' },
borrow: { token: 'USDC', amount: '1000' },
allowanceNotNeeded: true,
expectedCollateralDeposited: {
amount: '15.00',
token: 'CBETH',
amount: '6.00',
token: 'ETH',
},
expectedDebt: { amount: '15,[0-9]{3}.[0-9]{1,2}', token: 'USDC' },
expectedDebt: { amount: '6,[0-9]{3}.[0-9]{1,2}', token: 'USDC' },
});
});

Expand All @@ -95,13 +95,13 @@ test.describe('Morpho Blue Base - Borrow - Wallet connected', async () => {
await manageDebtOrCollateral({
app,
forkId,
withdraw: { token: 'CBETH', amount: '5' },
payBack: { token: 'USDC', amount: '5000' },
withdraw: { token: 'ETH', amount: '1' },
payBack: { token: 'USDC', amount: '1000' },
expectedCollateralDeposited: {
amount: '10.00',
token: 'CBETH',
amount: '5.00',
token: 'ETH',
},
expectedDebt: { amount: '10,[0-9]{3}.[0-9]{1,2}', token: 'USDC' },
expectedDebt: { amount: '5,[0-9]{3}.[0-9]{1,2}', token: 'USDC' },
});
});

Expand All @@ -113,20 +113,20 @@ test.describe('Morpho Blue Base - Borrow - Wallet connected', async () => {

test.setTimeout(veryLongTestTimeout);

await app.position.manage.openManageOptions({ currentLabel: 'CBETH' });
await app.position.manage.openManageOptions({ currentLabel: 'ETH' });
await app.position.manage.select('Manage debt');

await manageDebtOrCollateral({
app,
forkId,
allowanceNotNeeded: true,
borrow: { token: 'USDC', amount: '5000' },
deposit: { token: 'CBETH', amount: '5' },
borrow: { token: 'USDC', amount: '1000' },
deposit: { token: 'ETH', amount: '1' },
expectedCollateralDeposited: {
amount: '15.00',
token: 'CBETH',
amount: '6.00',
token: 'ETH',
},
expectedDebt: { amount: '15,[0-9]{3}.[0-9]{1,2}', token: 'USDC' },
expectedDebt: { amount: '6,[0-9]{3}.[0-9]{1,2}', token: 'USDC' },
});
});

Expand All @@ -138,21 +138,21 @@ test.describe('Morpho Blue Base - Borrow - Wallet connected', async () => {

test.setTimeout(veryLongTestTimeout);

await app.position.manage.openManageOptions({ currentLabel: 'CBETH' });
await app.position.manage.openManageOptions({ currentLabel: 'ETH' });
await app.position.manage.select('Manage debt');
await app.position.manage.payBackDebt();

await manageDebtOrCollateral({
app,
forkId,
allowanceNotNeeded: true,
payBack: { token: 'USDC', amount: '5000' },
withdraw: { token: 'CBETH', amount: '5' },
payBack: { token: 'USDC', amount: '1000' },
withdraw: { token: 'ETH', amount: '1' },
expectedCollateralDeposited: {
amount: '10.00',
token: 'CBETH',
amount: '5.00',
token: 'ETH',
},
expectedDebt: { amount: '10,[0-9]{3}.[0-9]{1,2}', token: 'USDC' },
expectedDebt: { amount: '5,[0-9]{3}.[0-9]{1,2}', token: 'USDC' },
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ test.describe('Spark Multiply - Swap to Morpho', async () => {
[
{ colToken: 'EZETH', debtToken: 'ETH' },
{ colToken: 'OSETH', debtToken: 'ETH' },
{ colToken: 'SUSDE', debtToken: 'DAI-1' },
{ colToken: 'SUSDE', debtToken: 'DAI-2' },
{ colToken: 'SUSDE', debtToken: 'DAI-3' },
// { colToken: 'SUSDE', debtToken: 'DAI-4' },
{ colToken: 'SUSDE', debtToken: 'USDT' },
{ colToken: 'USDE', debtToken: 'DAI-1' },
{ colToken: 'USDE', debtToken: 'DAI-2' },
{ colToken: 'USDE', debtToken: 'DAI-3' },
{ colToken: 'USDE', debtToken: 'DAI-4' },
{ colToken: 'WBTC', debtToken: 'USDC' },
{ colToken: 'WBTC', debtToken: 'USDT' },
{ colToken: 'WEETH', debtToken: 'ETH' },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { BrowserContext, test } from '@playwright/test';
import { resetState } from '@synthetixio/synpress/commands/synpress';
import { metamaskSetUp } from 'utils/setup';
import * as tenderly from 'utils/tenderly';
import { setup } from 'utils/setup';
import { extremelyLongTestTimeout } from 'utils/config';
import { App } from 'src/app';
import { openPosition, swapPosition } from 'tests/sharedTestSteps/positionManagement';

let context: BrowserContext;
let app: App;
let forkId: string;

test.describe.configure({ mode: 'serial' });

test.describe('Spark Multiply - Swap to Morpho', async () => {
test.afterAll(async () => {
await tenderly.deleteFork(forkId);

await app.page.close();

await context.close();

await resetState();
});

test.use({
viewport: { width: 1400, height: 720 },
});

// Create a Maker position as part of the Swap tests setup
test('It should open a Spark Multiply position', async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
});

test.setTimeout(extremelyLongTestTimeout);

await test.step('Test setup', async () => {
({ context } = await metamaskSetUp({ network: 'mainnet' }));
let page = await context.newPage();
app = new App(page);

({ forkId } = await setup({
app,
network: 'mainnet',
extraFeaturesFlags: 'MakerTenderly:true EnableRefinance:true',
}));
});

await app.page.goto('/ethereum/spark/multiply/ETH-DAI#setup');

// Depositing collateral too quickly after loading page returns wrong simulation results
await app.position.overview.waitForComponentToBeStable();

await openPosition({
app,
forkId,
deposit: { token: 'ETH', amount: '10' },
});

await app.page.waitForTimeout(3000);

await swapPosition({
app,
forkId,
reason: 'Switch to higher max Loan To Value',
originalProtocol: 'Spark',
targetProtocol: 'Morpho',
targetPool: { colToken: 'WSTETH', debtToken: 'USDC' },
upToStep5: true,
});
});

(
[
{ colToken: 'SUSDE', debtToken: 'DAI-1' },
{ colToken: 'SUSDE', debtToken: 'DAI-2' },
{ colToken: 'SUSDE', debtToken: 'DAI-3' },
{ colToken: 'SUSDE', debtToken: 'DAI-4' },
{ colToken: 'SUSDE', debtToken: 'USDT' },
{ colToken: 'USDE', debtToken: 'DAI-1' },
{ colToken: 'USDE', debtToken: 'DAI-2' },
{ colToken: 'USDE', debtToken: 'DAI-3' },
{ colToken: 'USDE', debtToken: 'DAI-4' },
] as const
).forEach((targetPool) =>
test(`It should swap a Spark Multiply position (ETH/DAI) to Morpho Multiply (${targetPool.colToken}/${targetPool.debtToken})`, async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
});

test.setTimeout(extremelyLongTestTimeout);

// Wait an reload to avoid flakiness
await app.page.waitForTimeout(1000);
await app.page.reload();

await swapPosition({
app,
forkId,
reason: 'Switch to higher max Loan To Value',
originalProtocol: 'Spark',
targetProtocol: 'Morpho',
targetPool: { colToken: targetPool.colToken, debtToken: targetPool.debtToken },
existingDpmAndApproval: true,
rejectSwap: true,
});
})
);
});
10 changes: 5 additions & 5 deletions utils/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ export const morphoEthereumBorrowPools_4 = [
'WEETH-ETH',
];

export const morphoBaseMultiplyPools = ['ETH-USDC', 'WSTETH-USDC', 'CBETH-USDC'];
export const morphoBaseMultiplyPools = ['ETH-USDC', 'CBETH-USDC'];
// , 'WEETH-USDC' --> WEETH supply 100%
// , 'WSTETH-USDC' --> NO LIQUIDITY

export const morphoBaseEarnPools = [
'WSTETH-ETH-2',
Expand All @@ -114,11 +115,11 @@ export const morphoBaseEarnPools = [
export const morphoBaseBorrowPools = [
'AERO-USDC',
'EZETH-USDC',
'CBETH-USDC',
'WSTETH-USDC',
'ETH-USDC',
'CBETH-ETH',
'WSTETH-ETH-2',
// 'CBETH-USDC', -- NO LIQUIDITY
// 'WSTETH-USDC', -- NO LIQUIDITY
];
export const aaveV3EthereumEarnPools_1 = ['WSTETH-CBETH', 'WSTETH-ETH', 'CBETH-ETH', 'RETH-ETH'];

Expand Down Expand Up @@ -265,8 +266,7 @@ export const aaveV3ArbitrumMultiplyPools_1 = [
// 'WEETH-USDC', --> WEETH supply 100%
];

// export const aaveV3ArbitrumMultiplyPools_2 = ['RETH-DAI', 'RETH-USDC', 'WSTETH-DAI', 'WSTETH-USDC'];
export const aaveV3ArbitrumMultiplyPools_2 = ['RETH-USDC'];
export const aaveV3ArbitrumMultiplyPools_2 = ['RETH-DAI', 'RETH-USDC', 'WSTETH-DAI', 'WSTETH-USDC'];

export const aaveV3ArbitrumMultiplyPools_3 = ['DAI-ETH', 'DAI-WBTC', 'USDC-ETH', 'USDC-WBTC'];

Expand Down

0 comments on commit 37aacf4

Please sign in to comment.