-
Notifications
You must be signed in to change notification settings - Fork 1
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 #601 from OasisDEX/daily-improvements-04-nov
Daily improvements - 04 November
- Loading branch information
Showing
8 changed files
with
80 additions
and
155 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,101 +1,79 @@ | ||
import { BrowserContext, test } from '@playwright/test'; | ||
import { metamaskSetUp } from 'utils/setup'; | ||
import { resetState } from '@synthetixio/synpress/commands/synpress'; | ||
import * as tenderly from 'utils/tenderly'; | ||
import { testWithSynpress } from '@synthetixio/synpress'; | ||
import { metaMaskFixtures } from '@synthetixio/synpress/playwright'; | ||
import basicSetup from 'utils/synpress/test-wallet-setup/basic.setup'; | ||
import { setup } from 'utils/setup'; | ||
import * as tenderly from 'utils/tenderly'; | ||
import { extremelyLongTestTimeout, longTestTimeout } from 'utils/config'; | ||
import { App } from 'src/app'; | ||
import { adjustRisk, close, openPosition } from 'tests/sharedTestSteps/positionManagement'; | ||
|
||
let context: BrowserContext; | ||
let app: App; | ||
let forkId: string; | ||
|
||
test.describe.configure({ mode: 'serial' }); | ||
const test = testWithSynpress(metaMaskFixtures(basicSetup)); | ||
|
||
test.describe('Aave v2 Multiply - Wallet connected', async () => { | ||
test.afterAll(async () => { | ||
await tenderly.deleteFork(forkId); | ||
|
||
await app.page.close(); | ||
|
||
await context.close(); | ||
test.beforeEach(async ({ metamask, page }) => { | ||
test.setTimeout(longTestTimeout); | ||
|
||
await resetState(); | ||
app = new App(page); | ||
({ forkId } = await setup({ metamask, app, network: 'mainnet' })); | ||
}); | ||
|
||
test('It should open an Aave v2 Multiply position @regression', async () => { | ||
test.info().annotations.push({ | ||
type: 'Test case', | ||
description: '11773', | ||
}); | ||
|
||
test.setTimeout(extremelyLongTestTimeout); | ||
|
||
await test.step('Test setup', async () => { | ||
({ context } = await metamaskSetUp({ network: 'mainnet' })); | ||
let page = await context.newPage(); | ||
app = new App(page); | ||
|
||
({ forkId } = await setup({ app, network: 'mainnet' })); | ||
}); | ||
|
||
await app.page.goto('/ethereum/aave/v2/multiply/eth-usdc#simulate'); | ||
|
||
await openPosition({ | ||
app, | ||
forkId, | ||
deposit: { token: 'ETH', amount: '2' }, | ||
}); | ||
test.afterEach(async () => { | ||
await tenderly.deleteFork(forkId); | ||
await app.page.close(); | ||
}); | ||
|
||
test('It should adjust risk of an existing Aave V2 Multiply position - Up @regression', async () => { | ||
test.info().annotations.push({ | ||
type: 'Test case', | ||
description: 'xxx', | ||
}); | ||
test('It should open and manage an Aave v2 Multiply position @regression', async ({ | ||
metamask, | ||
}) => { | ||
test.setTimeout(extremelyLongTestTimeout); | ||
|
||
test.setTimeout(longTestTimeout); | ||
await test.step('It should open a position', async () => { | ||
await app.page.goto('/ethereum/aave/v2/multiply/eth-usdc#simulate'); | ||
|
||
await adjustRisk({ | ||
forkId, | ||
app, | ||
risk: 'up', | ||
newSliderPosition: 0.6, | ||
}); | ||
}); | ||
// Pause to avoid flakiness | ||
await app.page.waitForTimeout(2_000); | ||
|
||
test('It should adjust risk of an existing Aave V2 Multiply position - Down @regression', async () => { | ||
test.info().annotations.push({ | ||
type: 'Test case', | ||
description: 'xxxx', | ||
await openPosition({ | ||
metamask, | ||
app, | ||
forkId, | ||
deposit: { token: 'ETH', amount: '2' }, | ||
}); | ||
}); | ||
|
||
test.setTimeout(longTestTimeout); | ||
|
||
await adjustRisk({ | ||
forkId, | ||
app, | ||
risk: 'down', | ||
newSliderPosition: 0.5, | ||
await test.step('It should Adjust Risk - Up', async () => { | ||
await adjustRisk({ | ||
metamask, | ||
forkId, | ||
app, | ||
risk: 'up', | ||
newSliderPosition: 0.6, | ||
}); | ||
}); | ||
}); | ||
|
||
test('It should Close to collateral an existing Aave V2 Multiply position @regression', async () => { | ||
test.info().annotations.push({ | ||
type: 'Test case', | ||
description: 'xxxx', | ||
await test.step('It should Adjust Risk - Down', async () => { | ||
await adjustRisk({ | ||
metamask, | ||
forkId, | ||
app, | ||
risk: 'down', | ||
newSliderPosition: 0.5, | ||
}); | ||
}); | ||
|
||
test.setTimeout(longTestTimeout); | ||
|
||
await close({ | ||
forkId, | ||
app, | ||
closeTo: 'collateral', | ||
collateralToken: 'ETH', | ||
debtToken: 'USDC', | ||
tokenAmountAfterClosing: '[0-9]{1,2}.[0-9]{3,4}', | ||
await test.step('It should close a position', async () => { | ||
await close({ | ||
metamask, | ||
forkId, | ||
app, | ||
closeTo: 'collateral', | ||
collateralToken: 'ETH', | ||
debtToken: 'USDC', | ||
tokenAmountAfterClosing: '[0-9]{1,2}.[0-9]{3,4}', | ||
}); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { defineWalletSetup } from '@synthetixio/synpress'; | ||
import { commonMetamaskSetup, PASSWORD } from '../commonWalletSetup'; | ||
import 'dotenv/config'; | ||
|
||
const walletPK = process.env.EMPTY_TEST_WALLET_PK as string; | ||
|
||
export default defineWalletSetup(PASSWORD, async (context, walletPage) => { | ||
await commonMetamaskSetup({ context, walletPage }); | ||
const metamask = await commonMetamaskSetup({ context, walletPage }); | ||
|
||
await metamask.importWalletFromPrivateKey(walletPK); | ||
}); |