Skip to content

Commit

Permalink
Merge pull request #601 from OasisDEX/daily-improvements-04-nov
Browse files Browse the repository at this point in the history
Daily improvements - 04 November
  • Loading branch information
juan-langa authored Nov 4, 2024
2 parents a3bd74c + 5d218b8 commit baa4044
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 155 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ jobs:
flags_features: ${{ inputs.flags_features}}
script: nightly:no-wallet

with-real-wallet:
uses: ./.github/workflows/z_Reusable_RegressionWithRealWallet.yml
with:
base_url: ${{ inputs.base_url }}
flags_features: ${{ inputs.flags_features}}
secrets: inherit

# with-wallet-aave-ethereum-tests:
# name: 'With wallet - Aave - Ethereum'
# runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion tests/sharedTestSteps/automations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const testTrailingStopLoss = async ({
}

// Pause needed to avoid random fails
await app.page.waitForTimeout(5_000);
await app.page.waitForTimeout(10_000);

await app.position.setup.confirm();

Expand Down
2 changes: 1 addition & 1 deletion tests/sharedTestSteps/positionManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const openPosition = async ({
await tx.confirmAndVerifySuccess({
metamask,
forkId,
metamaskAction: 'confirmSignature',
metamaskAction: 'approveTokenPermission',
});
await app.position.setup.continueShouldBeVisible();
}).toPass({ timeout: longTestTimeout });
Expand Down
54 changes: 0 additions & 54 deletions tests/synpressV4/aaveV2Earn.spec.ts

This file was deleted.

34 changes: 11 additions & 23 deletions tests/withWallet/aaveV2/aaveV2Earn.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { testWithSynpress } from '@synthetixio/synpress';
import { metaMaskFixtures } from '@synthetixio/synpress/playwright';
import basicSetup from 'utils/synpress/wallet-setup/basic.setup';
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';
Expand All @@ -11,42 +11,30 @@ let app: App;
let forkId: string;

const test = testWithSynpress(metaMaskFixtures(basicSetup));
const { expect } = test;

test.describe('Aave V2 Earn - Wallet connected', async () => {
test.beforeEach(async ({ page, metamask }) => {
test.beforeEach(async ({ metamask, page }) => {
test.setTimeout(longTestTimeout);

app = new App(page);

({ forkId } = await setup({ metamask, app, network: 'mainnet' }));
});

test.afterEach(async () => {
await app.page.close();
});

test.afterAll(async () => {
await tenderly.deleteFork(forkId);
await app.page.close();
});

test('It should open an Aave v2 Earn position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: '11772',
});

test('It should open an Aave v2 Earn position @regression', async ({ metamask }) => {
test.setTimeout(extremelyLongTestTimeout);

await app.page.goto('/ethereum/aave/v2/earn/stETH-eth#simulate');
await app.page.goto('/ethereum/aave/v2/multiply/stETH-eth#simulate');

//
await app.pause();
//
// await openPosition({
// app,
// forkId,
// deposit: { token: 'ETH', amount: '10.09' },
// });
await openPosition({
metamask,
app,
forkId,
deposit: { token: 'ETH', amount: '10.09' },
});
});
});
126 changes: 52 additions & 74 deletions tests/withWallet/aaveV2/aaveV2Multiply.spec.ts
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}',
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ test.describe('Aave V3 Multiply - Arbitrum - Wallet connected', async () => {
await app.page.close();
});

test('It should set Trailing Stop-Loss on an Aave v3 Arbitrum Multiply position @regression', async ({
// SKIP test if it keeps failing in github
test.skip('It should set Trailing Stop-Loss on an Aave v3 Arbitrum Multiply position @regression', async ({
metamask,
}) => {
test.setTimeout(extremelyLongTestTimeout);
Expand Down
7 changes: 6 additions & 1 deletion utils/synpress/test-wallet-setup/basic.setup.ts
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);
});

0 comments on commit baa4044

Please sign in to comment.