Skip to content

Commit

Permalink
Use page.clock
Browse files Browse the repository at this point in the history
  • Loading branch information
yivlad committed Dec 20, 2024
1 parent ec74756 commit 0d35326
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 78 deletions.
2 changes: 1 addition & 1 deletion packages/app/src/pages/Savings.test-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ test.describe('Savings Base', () => {

await savingsPage.expectSavingsUsdsBalance({
susdsBalance: '100.00',
estimatedUsdsValue: '101.28654787',
estimatedUsdsValue: '101.28654604',
})
})

Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/test/e2e/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Address, Hash, parseEther, parseUnits } from 'viem'
import { AssetsInTests, TOKENS_ON_FORK } from './constants'
import { getTestnetContext } from './getTestnetContext'
import { injectNetworkConfiguration, injectWalletConfiguration } from './injectSetup'
import { syncBrowserTime } from './syncBrowserTime'
import { generateAccount } from './utils'

export type InjectableWallet = { address: Address } | { privateKey: string }
Expand Down Expand Up @@ -83,7 +82,7 @@ export async function setup<K extends Path, T extends ConnectionType>(

const progressedTimestamp = currentTimestamp + BigInt(seconds)
await testnetClient.setNextBlockTimestamp(progressedTimestamp)
await page.evaluate(syncBrowserTime, { rpcUrl: getUrlFromClient(testnetClient) })
await page.clock.setFixedTime(Number(currentTimestamp) * 1000)
}

async function progressSimulationAndMine(seconds: number): Promise<void> {
Expand Down Expand Up @@ -188,5 +187,6 @@ async function injectPageSetup({
await injectNetworkConfiguration(page, getUrlFromClient(testnetClient), options.blockchain.chainId)
}

await page.addInitScript(syncBrowserTime, { rpcUrl: getUrlFromClient(testnetClient) })
const { timestamp } = await testnetClient.getBlock()
await page.clock.setFixedTime(Number(timestamp) * 1000)
}
74 changes: 0 additions & 74 deletions packages/app/src/test/e2e/syncBrowserTime.ts

This file was deleted.

0 comments on commit 0d35326

Please sign in to comment.