-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #609 from OasisDEX/daily-improvements-05-nov-6
Daily improvements - 05 November
- Loading branch information
Showing
8 changed files
with
461 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
import { testWithSynpress } from '@synthetixio/synpress'; | ||
import { metaMaskFixtures } from '@synthetixio/synpress/playwright'; | ||
import baseSetup from 'utils/synpress/test-wallet-setup/base.setup'; | ||
import { setup } from 'utils/setup'; | ||
import * as tenderly from 'utils/tenderly'; | ||
import { extremelyLongTestTimeout } from 'utils/config'; | ||
import { App } from 'src/app'; | ||
import { | ||
close, | ||
manageDebtOrCollateral, | ||
openPosition, | ||
} from 'tests/sharedTestSteps/positionManagement'; | ||
|
||
let app: App; | ||
let forkId: string; | ||
|
||
const test = testWithSynpress(metaMaskFixtures(baseSetup)); | ||
|
||
test.describe('Aave V3 Borrow - Base - Wallet connected', async () => { | ||
test.beforeEach(async ({ metamask, page }) => { | ||
test.setTimeout(extremelyLongTestTimeout); | ||
|
||
app = new App(page); | ||
({ forkId } = await setup({ metamask, app, network: 'base' })); | ||
}); | ||
|
||
test.afterEach(async () => { | ||
await tenderly.deleteFork(forkId); | ||
await app.page.close(); | ||
}); | ||
|
||
test('It should open and magage an Aave V3 Borrow Base position @regression', async ({ | ||
metamask, | ||
}) => { | ||
test.info().annotations.push({ | ||
type: 'Test case', | ||
description: '12473', | ||
}); | ||
|
||
test.setTimeout(extremelyLongTestTimeout); | ||
|
||
await app.page.goto('/base/aave/v3/borrow/eth-usdbc#simulate'); | ||
|
||
await test.step('It should Open a position', async () => { | ||
await app.page.waitForTimeout(1_000); | ||
|
||
await openPosition({ | ||
metamask, | ||
app, | ||
forkId, | ||
deposit: { token: 'ETH', amount: '9.12345' }, | ||
borrow: { token: 'USDBC', amount: '2000' }, | ||
}); | ||
}); | ||
|
||
// Skip again if DB collision also happeningwith omni | ||
await test.step('It should Deposit and Borrow in a single tx', async () => { | ||
await app.page.waitForTimeout(1_000); | ||
|
||
await manageDebtOrCollateral({ | ||
metamask, | ||
app, | ||
forkId, | ||
deposit: { token: 'ETH', amount: '1' }, | ||
borrow: { token: 'USDBC', amount: '3000' }, | ||
expectedCollateralDeposited: { | ||
amount: '10.12', | ||
token: 'ETH', | ||
}, | ||
expectedDebt: { amount: '5,[0-9]{3}.[0-9]{2}([0-9]{1,2})?', token: 'USDBC' }, | ||
protocol: 'Aave V3', | ||
}); | ||
}); | ||
|
||
await test.step('It should Withdraw and Pay back in a single tx', async () => { | ||
await app.page.waitForTimeout(1_000); | ||
|
||
await app.position.manage.withdrawCollateral(); | ||
|
||
await manageDebtOrCollateral({ | ||
metamask, | ||
app, | ||
forkId, | ||
withdraw: { token: 'ETH', amount: '2' }, | ||
payBack: { token: 'USDBC', amount: '1000' }, | ||
expectedCollateralDeposited: { | ||
amount: '8.12', | ||
token: 'ETH', | ||
}, | ||
expectedDebt: { amount: '4,[0-9]{3}.[0-9]{2}([0-9]{1,2})?', token: 'USDBC' }, | ||
protocol: 'Aave V3', | ||
}); | ||
}); | ||
|
||
await test.step('It should Borrow and Deposit in a single tx', async () => { | ||
await app.page.waitForTimeout(1_000); | ||
|
||
await app.position.manage.openManageOptions({ currentLabel: 'ETH' }); | ||
await app.position.manage.select('Manage debt'); | ||
|
||
await manageDebtOrCollateral({ | ||
metamask, | ||
app, | ||
forkId, | ||
borrow: { token: 'USDBC', amount: '2000' }, | ||
deposit: { token: 'ETH', amount: '1' }, | ||
expectedCollateralDeposited: { | ||
amount: '9.12', | ||
token: 'ETH', | ||
}, | ||
expectedDebt: { amount: '6,[0-9]{3}.[0-9]{2}([0-9]{1,2})?', token: 'USDBC' }, | ||
protocol: 'Aave V3', | ||
}); | ||
}); | ||
|
||
await test.step('It should Pay back and Withdraw in a single tx', async () => { | ||
// Reload page to avoid random fails | ||
await app.page.reload(); | ||
await app.page.waitForTimeout(1_000); | ||
|
||
await app.position.manage.openManageOptions({ currentLabel: 'ETH' }); | ||
await app.position.manage.select('Manage debt'); | ||
await app.position.manage.payBackDebt(); | ||
|
||
await manageDebtOrCollateral({ | ||
metamask, | ||
app, | ||
forkId, | ||
payBack: { token: 'USDBC', amount: '3000' }, | ||
withdraw: { token: 'ETH', amount: '1.5' }, | ||
expectedCollateralDeposited: { | ||
amount: '7.62', | ||
token: 'ETH', | ||
}, | ||
expectedDebt: { amount: '3,[0-9]{3}.[0-9]{2}([0-9]{1,2})?', token: 'USDBC' }, | ||
protocol: 'Aave V3', | ||
allowanceNotNeeded: true, | ||
}); | ||
}); | ||
|
||
// Skip again if DB collision also happening with omni | ||
await test.step('It should Close a position', async () => { | ||
// Pause and Reload page to avoid random fails | ||
await app.page.reload(); | ||
await app.page.waitForTimeout(1_000); | ||
|
||
await close({ | ||
metamask, | ||
app, | ||
forkId, | ||
positionType: 'Borrow', | ||
closeTo: 'collateral', | ||
collateralToken: 'ETH', | ||
debtToken: 'USDBC', | ||
tokenAmountAfterClosing: '[0-9]{1,2}.[0-9]{1,2}', | ||
}); | ||
}); | ||
}); | ||
}); |
106 changes: 106 additions & 0 deletions
106
tests/withWallet/aaveV3/optimism/aaveV3MultiplyOptimism1.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { testWithSynpress } from '@synthetixio/synpress'; | ||
import { metaMaskFixtures } from '@synthetixio/synpress/playwright'; | ||
import optimismSetup from 'utils/synpress/test-wallet-setup/optimism.setup'; | ||
import { setup } from 'utils/setup'; | ||
import * as tenderly from 'utils/tenderly'; | ||
import { extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config'; | ||
import { App } from 'src/app'; | ||
import { adjustRisk, close, openPosition } from 'tests/sharedTestSteps/positionManagement'; | ||
|
||
let app: App; | ||
let forkId: string; | ||
let walletAddress: string; | ||
|
||
const test = testWithSynpress(metaMaskFixtures(optimismSetup)); | ||
|
||
test.describe('Aave v3 Multiply - Optimism - Wallet connected', async () => { | ||
test.beforeEach(async ({ metamask, page }) => { | ||
test.setTimeout(extremelyLongTestTimeout); | ||
|
||
app = new App(page); | ||
({ forkId } = await setup({ metamask, app, network: 'optimism' })); | ||
}); | ||
|
||
test.afterEach(async () => { | ||
await tenderly.deleteFork(forkId); | ||
await app.page.close(); | ||
}); | ||
|
||
test('It should open and manage an Aave v3 Multiply Optimism position - ETH/USDC @regression', async ({ | ||
metamask, | ||
}) => { | ||
test.setTimeout(extremelyLongTestTimeout); | ||
|
||
await app.page.goto('/optimism/aave/v3/multiply/eth-usdc'); | ||
|
||
await test.step('It should Open a position', async () => { | ||
await app.page.waitForTimeout(1_000); | ||
|
||
await openPosition({ | ||
metamask, | ||
app, | ||
forkId, | ||
deposit: { token: 'ETH', amount: '10.12345' }, | ||
}); | ||
}); | ||
|
||
await test.step('It should Adjust risk - Up', async () => { | ||
await tenderly.changeAccountOwner({ | ||
account: '0x2047e97451955c98bf8378f6ac2f04d95578990c', | ||
newOwner: walletAddress, | ||
forkId, | ||
}); | ||
|
||
await app.page.goto('/optimism/aave/v3/multiply/eth-usdc.e/2#overview'); | ||
|
||
await app.page.waitForTimeout(1_000); | ||
|
||
await adjustRisk({ | ||
metamask, | ||
forkId, | ||
app, | ||
risk: 'up', | ||
newSliderPosition: 0.9, | ||
}); | ||
}); | ||
|
||
await test.step('It should Adjust risk - Down', async () => { | ||
await app.page.waitForTimeout(1_000); | ||
|
||
await adjustRisk({ | ||
metamask, | ||
forkId, | ||
app, | ||
risk: 'down', | ||
newSliderPosition: 0.05, | ||
}); | ||
}); | ||
}); | ||
|
||
test('It should close an existent Aave V3 Multiply Optimism position - Close to collateral token (ETH) @regression', async ({ | ||
metamask, | ||
}) => { | ||
test.setTimeout(veryLongTestTimeout); | ||
|
||
await tenderly.changeAccountOwner({ | ||
account: '0x2047e97451955c98bf8378f6ac2f04d95578990c', | ||
newOwner: walletAddress, | ||
forkId, | ||
}); | ||
|
||
await app.page.goto('/optimism/aave/v3/multiply/eth-usdc.e/2#overview'); | ||
|
||
await app.page.waitForTimeout(1_000); | ||
|
||
await close({ | ||
metamask, | ||
app, | ||
forkId, | ||
positionType: 'Multiply', | ||
closeTo: 'collateral', | ||
collateralToken: 'ETH', | ||
debtToken: 'USDC', | ||
tokenAmountAfterClosing: '0.[0-9]{3,4}', | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.