Skip to content

Commit

Permalink
Add tests for savings deposit and withdrawal dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarvu committed Jan 7, 2025
1 parent 922dfd6 commit 4e9ceb8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ test.describe('Savings deposit dialog', () => {
await depositDialog.openAssetSelectorAction()
await depositDialog.expectAssetSelectorOptions(['DAI', 'USDC', 'USDS'])
})

test('can click max after switching tokens', async () => {
await depositDialog.expectInputValue('')
await depositDialog.clickMaxAmountAction()
await depositDialog.expectInputValue('10000')
await depositDialog.selectAssetAction('USDC')
await depositDialog.expectInputValue('')
await depositDialog.clickMaxAmountAction()
await depositDialog.expectInputValue('10000')
})
})

test.describe('Gnosis', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { mainnet } from 'viem/chains'
import { SavingsDialogPageObject } from '../../../common/e2e/SavingsDialog.PageObject'

test.describe('Without send mode', () => {
test('can switch between tokens', async ({ page }) => {
let withdrawalDialog: SavingsDialogPageObject
let savingsPage: SavingsPageObject

test.beforeEach(async ({ page }) => {
const testContext = await setup(page, {
blockchain: {
chainId: mainnet.id,
Expand All @@ -22,12 +25,13 @@ test.describe('Without send mode', () => {
},
})

const savingsPage = new SavingsPageObject(testContext)

savingsPage = new SavingsPageObject(testContext)
await savingsPage.clickWithdrawSDaiButtonAction()

const withdrawalDialog = new SavingsDialogPageObject({ testContext, type: 'withdraw' })
withdrawalDialog = new SavingsDialogPageObject({ testContext, type: 'withdraw' })
})

test('can switch between tokens', async () => {
await withdrawalDialog.fillAmountAction(1000)
await withdrawalDialog.actionsContainer.expectEnabledActionAtIndex(0)
await withdrawalDialog.actionsContainer.expectActions([
Expand All @@ -49,6 +53,16 @@ test.describe('Without send mode', () => {
{ type: 'withdrawFromSavings', asset: 'DAI', savingsAsset: 'sDAI', mode: 'withdraw' },
])
})

test('can click max after switching tokens', async () => {
await withdrawalDialog.expectInputValue('')
await withdrawalDialog.clickMaxAmountAction()
await withdrawalDialog.expectInputValue('1125.599162')
await withdrawalDialog.selectAssetAction('USDC')
await withdrawalDialog.expectInputValue('')
await withdrawalDialog.clickMaxAmountAction()
await withdrawalDialog.expectInputValue('1125.599162')
})
})

test.describe('With send mode', () => {
Expand Down

0 comments on commit 4e9ceb8

Please sign in to comment.