-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add savings USDC deposit and withdraw tests (#102)
* Add deposit USDC test * Add USDC withdrawal test * Add max usdc withdrawal test * Remove old dai and usdc deposit tests * Adjust slippage tests * Remove unused usdc hars * Adjust dialog withdraw tests
- Loading branch information
Showing
35 changed files
with
1,354 additions
and
1,927 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
76 changes: 76 additions & 0 deletions
76
packages/app/src/features/dialogs/savings/deposit/e2e/DepositUSDC.test-e2e.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,76 @@ | ||
import { ActionsPageObject } from '@/features/actions/ActionsContainer.PageObject' | ||
import { SavingsPageObject } from '@/pages/Savings.PageObject' | ||
import { PSM_ACTIONS_DEPLOYED, PSM_ACTIONS_DEPLOYED_DATE } from '@/test/e2e/constants' | ||
import { setup } from '@/test/e2e/setup' | ||
import { setupFork } from '@/test/e2e/setupFork' | ||
import { test } from '@playwright/test' | ||
import { mainnet } from 'viem/chains' | ||
import { SavingsDialogPageObject } from '../../common/e2e/SavingsDialog.PageObject' | ||
|
||
test.describe('Deposit USDC on Mainnet', () => { | ||
const fork = setupFork({ | ||
blockNumber: PSM_ACTIONS_DEPLOYED, | ||
simulationDateOverride: PSM_ACTIONS_DEPLOYED_DATE, | ||
chainId: mainnet.id, | ||
}) | ||
let savingsPage: SavingsPageObject | ||
let depositDialog: SavingsDialogPageObject | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await setup(page, fork, { | ||
initialPage: 'savings', | ||
account: { | ||
type: 'connected', | ||
assetBalances: { | ||
ETH: 1, | ||
USDC: 10_000, | ||
}, | ||
}, | ||
}) | ||
|
||
savingsPage = new SavingsPageObject(page) | ||
await savingsPage.clickDepositButtonAction('USDC') | ||
|
||
depositDialog = new SavingsDialogPageObject({ page, type: 'deposit' }) | ||
await depositDialog.fillAmountAction(10_000) | ||
}) | ||
|
||
test('uses PSM actions native deposit', async () => { | ||
await depositDialog.expectToUsePSMActionsAction({ asset: 'USDC' }) | ||
}) | ||
|
||
test('displays transaction overview', async () => { | ||
await depositDialog.expectNativeRouteTransactionOverview({ | ||
apy: { | ||
value: '8.00%', | ||
description: '~800.00 DAI per year', | ||
}, | ||
routeItems: [ | ||
{ | ||
tokenAmount: '10,000.00 USDC', | ||
tokenUsdValue: '$10,000.00', | ||
}, | ||
{ | ||
tokenAmount: '10,000.00 DAI', | ||
tokenUsdValue: '$10,000.00', | ||
}, | ||
{ | ||
tokenAmount: '9,196.30 sDAI', | ||
tokenUsdValue: '$10,000.00', | ||
}, | ||
], | ||
outcome: '9,196.30 sDAI worth $10,000.00', | ||
}) | ||
}) | ||
|
||
test('executes deposit', async () => { | ||
const actionsContainer = new ActionsPageObject(depositDialog.locatePanelByHeader('Actions')) | ||
await actionsContainer.acceptAllActionsAction(2) | ||
|
||
await depositDialog.expectSuccessPage() | ||
await depositDialog.clickBackToSavingsButton() | ||
|
||
await savingsPage.expectSavingsBalance({ sDaiBalance: '9,196.30 sDAI', estimatedDaiValue: '10,000' }) | ||
await savingsPage.expectCashInWalletAssetBalance('USDC', '-') | ||
}) | ||
}) |
Oops, something went wrong.