Skip to content

Commit

Permalink
Merge pull request #626 from OasisDEX/daily-improvements-12-nov-5
Browse files Browse the repository at this point in the history
Daily improvements - 12 November
  • Loading branch information
juan-langa authored Nov 12, 2024
2 parents d5df2ca + 35f0e84 commit 57c9f15
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 116 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
"with-wallet:aave:optimism": "REPORT_FOLDER=with-wallet-aave-optimism npx playwright test --project=with-wallet-aave-optimism --workers=1",
"with-wallet:aave:arbitrum-and-optimism": "REPORT_FOLDER=with-wallet-aave-arbitrum-and-optimism npx playwright test --project=with-wallet-aave-arbitrum-and-optimism --workers=1",
"with-wallet:ajna-and-morphoblue": "REPORT_FOLDER=with-wallet-ajna-and-morphoblue npx playwright test --project=with-wallet-ajna-and-morphoblue --workers=1",
"with-wallet:ajna": "REPORT_FOLDER=with-wallet-ajna npx playwright test --project=with-wallet-ajna --workers=1",
"with-wallet:ajna": "REPORT_FOLDER=with-wallet-ajna npx playwright test --project=with-wallet-ajna --workers=2",
"with-wallet:ajna:ethereum": "REPORT_FOLDER=with-wallet-ajna-ethereum npx playwright test --project=with-wallet-ajna-ethereum --workers=1",
"with-wallet:ajna:arbitrum": "REPORT_FOLDER=with-wallet-ajna-arbitrum npx playwright test --project=with-wallet-ajna-arbitrum --workers=1",
"with-wallet:ajna:base": "REPORT_FOLDER=with-wallet-ajna-base npx playwright test --project=with-wallet-ajna-base --workers=1",
"with-wallet:ajna:optimism": "REPORT_FOLDER=with-wallet-ajna-optimism npx playwright test --project=with-wallet-ajna-optimism --workers=1",
"with-wallet:morphoblue": "REPORT_FOLDER=with-wallet-morphoblue npx playwright test --project=with-wallet-morphoblue --workers=1",
"with-wallet:morphoblue": "REPORT_FOLDER=with-wallet-morphoblue npx playwright test --project=with-wallet-morphoblue --workers=2",
"with-wallet:morphoblue:ethereum": "REPORT_FOLDER=with-wallet-morphoblue-ethereum npx playwright test --project=with-wallet-morphoblue-ethereum --workers=1",
"with-wallet:maker-and-spark": "REPORT_FOLDER=with-wallet-maker-and-spark npx playwright test --project=with-wallet-maker-and-spark --workers=1",
"with-wallet:spark:ethereum": "REPORT_FOLDER=with-wallet-spark-ethereum npx playwright test --project=with-wallet-spark-ethereum --workers=1",
Expand Down
67 changes: 28 additions & 39 deletions tests/withWallet/ajna/arbitrum/ajnaArbitrumEarn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,30 @@ const test = testWithSynpress(metaMaskFixtures(arbitrumSetup));
const { expect } = test;

test.describe('Ajna Arbitrum Earn - Wallet connected', async () => {
test.afterEach(async () => {
await app.page.close();
test.beforeEach(async ({ metamask, page }) => {
test.setTimeout(longTestTimeout);

app = new App(page);

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

await tenderly.setTokenBalance({
forkId,
walletAddress,
network: 'arbitrum',
token: 'WBTC',
balance: '5',
});
});

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

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

await test.step('Test setup', async () => {
app = new App(page);

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

await tenderly.setTokenBalance({
forkId,
walletAddress,
network: 'arbitrum',
token: 'WBTC',
balance: '5',
});

await tenderly.setTokenBalance({
forkId,
walletAddress,
network: 'arbitrum',
token: 'USDC',
balance: '100000',
});
});

await app.position.openPage('/arbitrum/ajna/earn/USDC-WBTC#setup');
await app.position.setup.acknowledgeAjnaInfo();

Expand All @@ -63,25 +54,23 @@ test.describe('Ajna Arbitrum Earn - Wallet connected', async () => {
protocol: 'Ajna',
});
});
});

test('It should allow to simulate an Ajna Arbitrum Earn position before opening it', async ({
metamask,
page,
}) => {
test.setTimeout(extremelyLongTestTimeout);
test.describe('Ajna Arbitrum Earn - Wallet connected', async () => {
test.beforeEach(async ({ metamask, page }) => {
app = new App(page);
await setup({ metamask, app, network: 'arbitrum', withoutFork: true });
});

await test.step('Test setup', async () => {
app = new App(page);
test.afterEach(async () => {
await app.page.close();
});

await setup({
metamask,
app,
network: 'arbitrum',
withoutFork: true,
});
});
test('It should allow to simulate an Ajna Arbitrum Earn position before opening it', async () => {
test.setTimeout(longTestTimeout);

await app.position.openPage('/arbitrum/ajna/earn/RETH-ETH#setup');

await app.position.setup.acknowledgeAjnaInfo();

// Pause to avoid random fails
Expand Down
4 changes: 3 additions & 1 deletion tests/withWallet/ajna/base/ajnaEarnBase.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { metaMaskFixtures } from '@synthetixio/synpress/playwright';
import baseSetup from 'utils/synpress/test-wallet-setup/base.setup';
import { setup } from 'utils/setup';
import * as tenderly from 'utils/tenderly';
import { extremelyLongTestTimeout } from 'utils/config';
import { extremelyLongTestTimeout, longTestTimeout } from 'utils/config';
import { App } from 'src/app';
import { openPosition } from 'tests/sharedTestSteps/positionManagement';

Expand All @@ -16,6 +16,8 @@ const { expect } = test;

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

app = new App(page);
({ forkId, walletAddress } = await setup({ metamask, app, network: 'base' }));

Expand Down
160 changes: 87 additions & 73 deletions tests/withWallet/ajna/ethereum/ajnaMultiplyEthereum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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, veryLongTestTimeout } from 'utils/config';
import { extremelyLongTestTimeout, longTestTimeout } from 'utils/config';
import { App } from 'src/app';
import { adjustRisk, close, openPosition } from 'tests/sharedTestSteps/positionManagement';

Expand All @@ -16,86 +16,17 @@ const { expect } = test;

test.describe('Ajna Ethereum Multiply - Wallet connected', async () => {
test.beforeEach(async ({ metamask, page }) => {
test.setTimeout(extremelyLongTestTimeout);

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

await tenderly.setTokenBalance({
forkId,
network: 'mainnet',
walletAddress,
token: 'WBTC',
balance: '5',
});
await setup({ metamask, app, network: 'mainnet', withoutFork: true });
});

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

// NO LIQUIDITY
test.skip('It should open an Ajna Ethereum Multiply position @regression', async ({
metamask,
}) => {
test.setTimeout(extremelyLongTestTimeout);

await app.page.goto('/ethereum/ajna/multiply/WBTC-DAI#setup');

await app.position.setup.acknowledgeAjnaInfo();

await test.step('It should Open a position', async () => {
await app.page.waitForTimeout(1_000);

await openPosition({
metamask,
app,
forkId,
deposit: { token: 'WBTC', amount: '0.01' },
});
});

await test.step('It should Adjust risk - Down', async () => {
await app.page.waitForTimeout(1_000);

await adjustRisk({
metamask,
forkId,
app,
risk: 'down',
newSliderPosition: 0.05,
});
});

await test.step('It should Adjust risk - Up', async () => {
await app.page.waitForTimeout(1_000);

await adjustRisk({
metamask,
forkId,
app,
risk: 'up',
newSliderPosition: 0.1,
});
});

await test.step('It should Close a position', async () => {
await app.page.waitForTimeout(1_000);

await close({
metamask,
forkId,
app,
closeTo: 'collateral',
collateralToken: 'WBTC',
debtToken: 'DAI',
tokenAmountAfterClosing: '0.[0-9]{3,4}',
});
});
});

test('It should allow to simulate an Ajna Ethereum Multiply position before opening it', async () => {
test.setTimeout(longTestTimeout);

await app.page.goto('/ethereum/ajna/multiply/WBTC-DAI#setup');
await app.position.setup.acknowledgeAjnaInfo();
await app.position.setup.deposit({ token: 'WBTC', amount: '0.654321' });
Expand Down Expand Up @@ -191,3 +122,86 @@ test.describe('Ajna Ethereum Multiply - Wallet connected', async () => {
});
});
});

// NO LIQUIDITY
test.describe.skip('Ajna Ethereum Multiply - Wallet connected', async () => {
test.beforeEach(async ({ metamask, page }) => {
test.setTimeout(extremelyLongTestTimeout);

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

await tenderly.setTokenBalance({
forkId,
network: 'mainnet',
walletAddress,
token: 'WBTC',
balance: '5',
});
});

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

// NO LIQUIDITY
test.skip('It should open an Ajna Ethereum Multiply position @regression', async ({
metamask,
}) => {
test.setTimeout(extremelyLongTestTimeout);

await app.page.goto('/ethereum/ajna/multiply/WBTC-DAI#setup');

await app.position.setup.acknowledgeAjnaInfo();

await test.step('It should Open a position', async () => {
await app.page.waitForTimeout(1_000);

await openPosition({
metamask,
app,
forkId,
deposit: { token: 'WBTC', amount: '0.01' },
});
});

await test.step('It should Adjust risk - Down', async () => {
await app.page.waitForTimeout(1_000);

await adjustRisk({
metamask,
forkId,
app,
risk: 'down',
newSliderPosition: 0.05,
});
});

await test.step('It should Adjust risk - Up', async () => {
await app.page.waitForTimeout(1_000);

await adjustRisk({
metamask,
forkId,
app,
risk: 'up',
newSliderPosition: 0.1,
});
});

await test.step('It should Close a position', async () => {
await app.page.waitForTimeout(1_000);

await close({
metamask,
forkId,
app,
closeTo: 'collateral',
collateralToken: 'WBTC',
debtToken: 'DAI',
tokenAmountAfterClosing: '0.[0-9]{3,4}',
});
});
});
});
4 changes: 3 additions & 1 deletion tests/withWallet/ajna/optimism/ajnaEarnOptimism.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { metaMaskFixtures } from '@synthetixio/synpress/playwright';
import optimismSetup from 'utils/synpress/test-wallet-setup/optimism.setup';
import { setup } from 'utils/setup';
import * as tenderly from 'utils/tenderly';
import { extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config';
import { extremelyLongTestTimeout, longTestTimeout, veryLongTestTimeout } from 'utils/config';
import { App } from 'src/app';
import { openPosition } from 'tests/sharedTestSteps/positionManagement';

Expand All @@ -16,6 +16,8 @@ const { expect } = test;

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

app = new App(page);
({ forkId, walletAddress } = await setup({ metamask, app, network: 'optimism' }));

Expand Down
11 changes: 11 additions & 0 deletions tests/withWallet/morphoBlue/ethereum/morphoBlueMultiply.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ test.describe('Morpho Blue Multiply - Wallet connected', async () => {
});
});
});
});

test.describe('Morpho Blue Multiply - Wallet connected', async () => {
test.beforeEach(async ({ metamask, page }) => {
app = new App(page);
await setup({ metamask, app, network: 'mainnet', withoutFork: true });
});

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

test('It should allow to simulate a Morpho Blue Multiply position before opening it @regression', async () => {
test.setTimeout(veryLongTestTimeout);
Expand Down

0 comments on commit 57c9f15

Please sign in to comment.