-
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.
Finish savings deposit E2E tests rewrite
- Loading branch information
Showing
3 changed files
with
195 additions
and
195 deletions.
There are no files selected for viewing
137 changes: 70 additions & 67 deletions
137
packages/app/src/features/dialogs/savings/deposit/e2e/base/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 |
---|---|---|
@@ -1,76 +1,79 @@ | ||
// import { ActionsPageObject } from '@/features/actions/ActionsContainer.PageObject' | ||
// import { SavingsPageObject } from '@/pages/Savings.PageObject' | ||
// import { setupFork } from '@/test/e2e/forking/setupFork' | ||
// import { setup } from '@/test/e2e/setup' | ||
// import { test } from '@playwright/test' | ||
// import { base } from 'viem/chains' | ||
// import { SavingsDialogPageObject } from '../../../common/e2e/SavingsDialog.PageObject' | ||
import { SavingsPageObject } from '@/pages/Savings.PageObject' | ||
import { BASE_DEFAULT_BLOCK_NUMBER } from '@/test/e2e/constants' | ||
import { setup } from '@/test/e2e/setup' | ||
import { test } from '@playwright/test' | ||
import { base } from 'viem/chains' | ||
import { SavingsDialogPageObject } from '../../../common/e2e/SavingsDialog.PageObject' | ||
|
||
// test.describe('Deposit USDC', () => { | ||
// const fork = setupFork({ chainId: base.id, blockNumber: 22143788n, useTenderlyVnet: true }) | ||
test.describe('Deposit USDC', () => { | ||
let savingsPage: SavingsPageObject | ||
let depositDialog: SavingsDialogPageObject | ||
|
||
// let savingsPage: SavingsPageObject | ||
// let depositDialog: SavingsDialogPageObject | ||
test.beforeEach(async ({ page }) => { | ||
const testContext = await setup(page, { | ||
blockchain: { | ||
chainId: base.id, | ||
blockNumber: BASE_DEFAULT_BLOCK_NUMBER, | ||
}, | ||
initialPage: 'savings', | ||
account: { | ||
type: 'connected-random', | ||
assetBalances: { | ||
ETH: 1, | ||
USDC: 10_000, | ||
}, | ||
}, | ||
}) | ||
|
||
// test.beforeEach(async ({ page }) => { | ||
// await setup(page, fork, { | ||
// initialPage: 'savings', | ||
// account: { | ||
// type: 'connected-random', | ||
// assetBalances: { | ||
// ETH: 1, | ||
// USDC: 10_000, | ||
// }, | ||
// }, | ||
// }) | ||
savingsPage = new SavingsPageObject(testContext) | ||
await savingsPage.clickDepositButtonAction('USDC') | ||
|
||
// savingsPage = new SavingsPageObject(page) | ||
// await savingsPage.clickDepositButtonAction('USDC') | ||
depositDialog = new SavingsDialogPageObject({ testContext, type: 'deposit' }) | ||
await depositDialog.fillAmountAction(10_000) | ||
}) | ||
|
||
// depositDialog = new SavingsDialogPageObject({ page, type: 'deposit' }) | ||
// await depositDialog.fillAmountAction(10_000) | ||
// }) | ||
test('has correct action plan', async () => { | ||
await depositDialog.actionsContainer.expectActions([ | ||
{ type: 'approve', asset: 'USDC' }, | ||
{ type: 'depositToSavings', asset: 'USDC', savingsAsset: 'sUSDS' }, | ||
]) | ||
}) | ||
|
||
// test('has correct action plan', async () => { | ||
// await depositDialog.actionsContainer.expectActions([ | ||
// { type: 'approve', asset: 'USDC' }, | ||
// { type: 'depositToSavings', asset: 'USDC', savingsAsset: 'sUSDS' }, | ||
// ]) | ||
// }) | ||
test('displays transaction overview', async () => { | ||
await depositDialog.expectNativeRouteTransactionOverview({ | ||
apy: { | ||
value: '8.50%', | ||
description: 'Earn ~850.00 USDS/year', | ||
}, | ||
routeItems: [ | ||
{ | ||
tokenAmount: '10,000.00 USDC', | ||
tokenUsdValue: '$10,000.00', | ||
}, | ||
{ | ||
tokenAmount: '10,000.00 USDS', | ||
tokenUsdValue: '$10,000.00', | ||
}, | ||
{ | ||
tokenAmount: '9,872.98 sUSDS', | ||
tokenUsdValue: '$10,000.00', | ||
}, | ||
], | ||
outcome: '9,872.98 sUSDS', | ||
outcomeUsd: '$10,000.00', | ||
}) | ||
}) | ||
|
||
// test('displays transaction overview', async () => { | ||
// await depositDialog.expectNativeRouteTransactionOverview({ | ||
// apy: { | ||
// value: '6.50%', | ||
// description: 'Earn ~650.00 USDS/year', | ||
// }, | ||
// routeItems: [ | ||
// { | ||
// tokenAmount: '10,000.00 USDC', | ||
// tokenUsdValue: '$10,000.00', | ||
// }, | ||
// { | ||
// tokenAmount: '10,000.00 USDS', | ||
// tokenUsdValue: '$10,000.00', | ||
// }, | ||
// { | ||
// tokenAmount: '9,911.77 sUSDS', | ||
// tokenUsdValue: '$10,000.00', | ||
// }, | ||
// ], | ||
// outcome: '9,911.77 sUSDS', | ||
// outcomeUsd: '$10,000.00', | ||
// }) | ||
// }) | ||
test('executes deposit', async () => { | ||
await depositDialog.actionsContainer.acceptAllActionsAction(2) | ||
|
||
// test('executes deposit', async () => { | ||
// const actionsContainer = new ActionsPageObject(depositDialog.locatePanelByHeader('Actions')) | ||
// await actionsContainer.acceptAllActionsAction(2) | ||
await depositDialog.expectSuccessPage() | ||
await depositDialog.clickBackToSavingsButton() | ||
|
||
// await depositDialog.expectSuccessPage() | ||
// await depositDialog.clickBackToSavingsButton() | ||
|
||
// await savingsPage.expectSavingsUsdsBalance({ susdsBalance: '9,911.77 sUSDS', estimatedUsdsValue: '10,000' }) | ||
// await savingsPage.expectStablecoinsInWalletAssetBalance('USDC', '-') | ||
// }) | ||
// }) | ||
await savingsPage.expectSavingsUsdsBalance({ | ||
susdsBalance: '9,872.98 sUSDS', | ||
estimatedUsdsValue: '9,999.999999', // USDC has 6 decimals, so the value is rounded down. This is consistent with the data in the smart contract | ||
}) | ||
await savingsPage.expectStablecoinsInWalletAssetBalance('USDC', '-') | ||
}) | ||
}) |
127 changes: 64 additions & 63 deletions
127
packages/app/src/features/dialogs/savings/deposit/e2e/base/DepositUSDS.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 |
---|---|---|
@@ -1,73 +1,74 @@ | ||
// import { ActionsPageObject } from '@/features/actions/ActionsContainer.PageObject' | ||
// import { SavingsPageObject } from '@/pages/Savings.PageObject' | ||
// import { setupFork } from '@/test/e2e/forking/setupFork' | ||
// import { setup } from '@/test/e2e/setup' | ||
// import { test } from '@playwright/test' | ||
// import { base } from 'viem/chains' | ||
// import { SavingsDialogPageObject } from '../../../common/e2e/SavingsDialog.PageObject' | ||
import { SavingsPageObject } from '@/pages/Savings.PageObject' | ||
import { BASE_DEFAULT_BLOCK_NUMBER } from '@/test/e2e/constants' | ||
import { setup } from '@/test/e2e/setup' | ||
import { test } from '@playwright/test' | ||
import { base } from 'viem/chains' | ||
import { SavingsDialogPageObject } from '../../../common/e2e/SavingsDialog.PageObject' | ||
|
||
// test.describe('Deposit USDS', () => { | ||
// const fork = setupFork({ chainId: base.id, blockNumber: 22143788n, useTenderlyVnet: true }) | ||
// let savingsPage: SavingsPageObject | ||
// let depositDialog: SavingsDialogPageObject | ||
test.describe('Deposit USDS', () => { | ||
let savingsPage: SavingsPageObject | ||
let depositDialog: SavingsDialogPageObject | ||
|
||
// test.beforeEach(async ({ page }) => { | ||
// await setup(page, fork, { | ||
// initialPage: 'savings', | ||
// account: { | ||
// type: 'connected-random', | ||
// assetBalances: { | ||
// ETH: 1, | ||
// USDS: 10_000, | ||
// }, | ||
// }, | ||
// }) | ||
test.beforeEach(async ({ page }) => { | ||
const testContext = await setup(page, { | ||
blockchain: { | ||
chainId: base.id, | ||
blockNumber: BASE_DEFAULT_BLOCK_NUMBER, | ||
}, | ||
initialPage: 'savings', | ||
account: { | ||
type: 'connected-random', | ||
assetBalances: { | ||
ETH: 1, | ||
USDS: 10_000, | ||
}, | ||
}, | ||
}) | ||
|
||
// savingsPage = new SavingsPageObject(page) | ||
// await savingsPage.clickDepositButtonAction('USDS') | ||
savingsPage = new SavingsPageObject(testContext) | ||
await savingsPage.clickDepositButtonAction('USDS') | ||
|
||
// depositDialog = new SavingsDialogPageObject({ page, type: 'deposit' }) | ||
// await depositDialog.fillAmountAction(10_000) | ||
// }) | ||
depositDialog = new SavingsDialogPageObject({ testContext, type: 'deposit' }) | ||
await depositDialog.fillAmountAction(10_000) | ||
}) | ||
|
||
// test('has correct action plan', async () => { | ||
// await depositDialog.actionsContainer.expectActions([ | ||
// { type: 'approve', asset: 'USDS' }, | ||
// { type: 'depositToSavings', asset: 'USDS', savingsAsset: 'sUSDS' }, | ||
// ]) | ||
// }) | ||
test('has correct action plan', async () => { | ||
await depositDialog.actionsContainer.expectActions([ | ||
{ type: 'approve', asset: 'USDS' }, | ||
{ type: 'depositToSavings', asset: 'USDS', savingsAsset: 'sUSDS' }, | ||
]) | ||
}) | ||
|
||
// test('displays transaction overview', async () => { | ||
// await depositDialog.expectNativeRouteTransactionOverview({ | ||
// apy: { | ||
// value: '6.50%', | ||
// description: 'Earn ~650.00 USDS/year', | ||
// }, | ||
// routeItems: [ | ||
// { | ||
// tokenAmount: '10,000.00 USDS', | ||
// tokenUsdValue: '$10,000.00', | ||
// }, | ||
// { | ||
// tokenAmount: '9,911.77 sUSDS', | ||
// tokenUsdValue: '$10,000.00', | ||
// }, | ||
// ], | ||
// outcome: '9,911.77 sUSDS', | ||
// outcomeUsd: '$10,000.00', | ||
// }) | ||
test('displays transaction overview', async () => { | ||
await depositDialog.expectNativeRouteTransactionOverview({ | ||
apy: { | ||
value: '8.50%', | ||
description: 'Earn ~850.00 USDS/year', | ||
}, | ||
routeItems: [ | ||
{ | ||
tokenAmount: '10,000.00 USDS', | ||
tokenUsdValue: '$10,000.00', | ||
}, | ||
{ | ||
tokenAmount: '9,872.98 sUSDS', | ||
tokenUsdValue: '$10,000.00', | ||
}, | ||
], | ||
outcome: '9,872.98 sUSDS', | ||
outcomeUsd: '$10,000.00', | ||
}) | ||
|
||
// await depositDialog.expectUpgradeSwitchToBeHidden() | ||
// }) | ||
await depositDialog.expectUpgradeSwitchToBeHidden() | ||
}) | ||
|
||
// test('executes deposit', async () => { | ||
// const actionsContainer = new ActionsPageObject(depositDialog.locatePanelByHeader('Actions')) | ||
// await actionsContainer.acceptAllActionsAction(2, fork) | ||
test('executes deposit', async () => { | ||
await depositDialog.actionsContainer.acceptAllActionsAction(2) | ||
|
||
// await depositDialog.expectSuccessPage() | ||
// await depositDialog.clickBackToSavingsButton() | ||
await depositDialog.expectSuccessPage() | ||
await depositDialog.clickBackToSavingsButton() | ||
|
||
// await savingsPage.expectSavingsUsdsBalance({ susdsBalance: '9,911.77 sUSDS', estimatedUsdsValue: '10,000' }) | ||
// await savingsPage.expectStablecoinsInWalletAssetBalance('USDS', '-') | ||
// }) | ||
// }) | ||
await savingsPage.expectSavingsUsdsBalance({ susdsBalance: '9,872.98 sUSDS', estimatedUsdsValue: '10,000' }) | ||
await savingsPage.expectStablecoinsInWalletAssetBalance('USDS', '-') | ||
}) | ||
}) |
Oops, something went wrong.