From 8d7523081baab7dd61263f648348d1f87be003f8 Mon Sep 17 00:00:00 2001 From: juan-langa Date: Fri, 18 Oct 2024 15:55:21 +0200 Subject: [PATCH 1/3] Daily improvements - 18 October --- .../ethereum/aaveV3MultiplyEthereum.spec.ts | 39 ----------- .../optimism/aaveV3BorrowOptimism.spec.ts | 34 ---------- .../AaveV3/arbitrum.spec.ts} | 33 +++++++++- .../AaveV3/base.spec.ts | 47 +++++++++++++ .../AaveV3/ethereum.spec.ts | 66 +++++++++++++++++++ .../AaveV3/optimism.spec.ts | 62 +++++++++++++++++ tests/withRealWallet/aaveV3Arbitrum.spec.ts | 7 +- 7 files changed, 208 insertions(+), 80 deletions(-) delete mode 100644 tests/noWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts rename tests/noWallet/{aaveV3/arbitrum/aaveV3MultiplyArbitrum.spec.ts => openExistingPositionPages/AaveV3/arbitrum.spec.ts} (54%) create mode 100644 tests/noWallet/openExistingPositionPages/AaveV3/base.spec.ts create mode 100644 tests/noWallet/openExistingPositionPages/AaveV3/ethereum.spec.ts create mode 100644 tests/noWallet/openExistingPositionPages/AaveV3/optimism.spec.ts diff --git a/tests/noWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts b/tests/noWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts index 3de5497..62fd3ba 100644 --- a/tests/noWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts +++ b/tests/noWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts @@ -65,45 +65,6 @@ test.describe('Aave v3 Multiply Ethereum', async () => { ); }); - test('It should open an existing Aave V3 Multiply Ethereum vault page @regression', async ({ - app, - }) => { - test.setTimeout(longTestTimeout); - - test.info().annotations.push({ - type: 'Test case', - description: '11995', - }); - - await app.page.goto('/ethereum/aave/v3/multiply/ETH-USDC/1218#overview'); - - await app.position.shouldHaveHeader('ETH/USDC Multiply #1218'); - await app.position.overview.shouldHaveLiquidationPrice({ - price: '([1-3],)?[0-9]{3}.[0-9]{2}', - token: 'ETH/USDC', - }); - await app.position.overview.shouldHaveLoanToValue('[1-8][0-9].[0-9]{2}'); - await app.position.overview.shouldHaveNetValue({ value: '\\$[0-9]{1,2}.[0-9]{2}' }); - await app.position.overview.shouldHaveBuyingPower('\\$[0-9]{2,3}.[0-9]{2}'); - await app.position.overview.shouldHaveBuyingPowerGreaterThanZero(); - await app.position.overview.shouldHaveExposure({ - amount: '0.[0-9]{4}', - token: 'ETH', - }); - await app.position.overview.shouldHaveExposureGreaterThanZero('ETH'); - await app.position.overview.shouldHaveDebt({ - amount: '[0-9]{1,2}.[0-9]{2}', - token: 'USDC', - }); - await app.position.overview.shouldHaveBorrowRate('[0-9].[0-9]{2}'); - - await app.position.setup.shouldHaveLiquidationPrice({ - amount: '([1-3],)?[0-9]{2,3}.[0-9]{2}', - pair: 'ETH/USDC', - }); - await app.position.setup.shouldHaveLoanToValue('[0-9]{1,2}.[0-9]{1,2}'); - }); - test('It should show if position automation is ON - Stop-Loss @regression', async ({ app }) => { await app.position.openPage('/ethereum/aave/v3/multiply/RETH-DAI/1276#overview'); diff --git a/tests/noWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts b/tests/noWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts deleted file mode 100644 index 71f0de6..0000000 --- a/tests/noWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { test } from '#noWalletFixtures'; -import { longTestTimeout } from 'utils/config'; - -test.describe('Aave v3 Borrow Optimism', async () => { - test('It should open an existing Aave V3 Borrow Optimism vault page @regression', async ({ - app, - }) => { - test.setTimeout(longTestTimeout); - - test.info().annotations.push({ - type: 'Test case', - description: '11994', - }); - - await app.page.goto('/optimism/aave/v3/borrow/dai-wbtc/4#overview'); - - await app.position.shouldHaveHeader('DAI/WBTC Borrow #4'); - await app.position.overview.shouldHaveLiquidationPrice({ - price: '<0.001', - token: 'WBTC/DAI', - }); - await app.position.overview.shouldHaveLoanToValue('>110.00'); - await app.position.overview.shouldHaveCollateralDeposited({ - amount: '<0.001', - token: 'DAI', - }); - await app.position.overview.shouldHaveDebt({ - amount: '<0.001', - token: 'WBTC', - }); - await app.position.overview.shouldHaveBorrowRate('[0-9]{1,2}.[0-9]{2}'); - await app.position.overview.shouldHaveNetValue({ value: '-0.[0-9]{1,2}' }); - }); -}); diff --git a/tests/noWallet/aaveV3/arbitrum/aaveV3MultiplyArbitrum.spec.ts b/tests/noWallet/openExistingPositionPages/AaveV3/arbitrum.spec.ts similarity index 54% rename from tests/noWallet/aaveV3/arbitrum/aaveV3MultiplyArbitrum.spec.ts rename to tests/noWallet/openExistingPositionPages/AaveV3/arbitrum.spec.ts index e696e76..d4e6b9b 100644 --- a/tests/noWallet/aaveV3/arbitrum/aaveV3MultiplyArbitrum.spec.ts +++ b/tests/noWallet/openExistingPositionPages/AaveV3/arbitrum.spec.ts @@ -1,8 +1,21 @@ -import { expect, test } from '#noWalletFixtures'; +import { test } from '#noWalletFixtures'; import { longTestTimeout } from 'utils/config'; -test.describe('Aave v3 Multiply Arbitrum', async () => { - test('It should open an existing Aave V3 Multiply Arbitrum vault page @regression', async ({ +test.describe('Open exisiting position pages - Aave v3 Arbitrum', async () => { + test('It should open an existing Aave V3 Arbitrum Earn yield multiple RETH/ETH position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/arbitrum/aave/v3/multiply/RETH-ETH/540#overview'); + + await app.position.shouldHaveHeader('RETH/ETH yield multiple #540'); + await app.position.overview.shouldHaveNetValue({ + value: '[0-9].[0-9]{2}', + }); + }); + + test('It should open an existing Aave V3 Arbitrum Borrow ETH/DAI position page @regression', async ({ app, }) => { test.setTimeout(longTestTimeout); @@ -40,4 +53,18 @@ test.describe('Aave v3 Multiply Arbitrum', async () => { }); await app.position.setup.shouldHaveLoanToValue('[2-9][0-9].[0-9]{1,2}'); }); + + test('It should open an existing Aave V3 Arbitrum Multiply DAI/WBTC position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/arbitrum/aave/v3/multiply/DAI-WBTC/2#overview'); + + await app.position.shouldHaveHeader('DAI/WBTC Multiply #2'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '0.00', + }); + await app.position.overview.shouldHaveLoanToValue('0.00'); + }); }); diff --git a/tests/noWallet/openExistingPositionPages/AaveV3/base.spec.ts b/tests/noWallet/openExistingPositionPages/AaveV3/base.spec.ts new file mode 100644 index 0000000..4843904 --- /dev/null +++ b/tests/noWallet/openExistingPositionPages/AaveV3/base.spec.ts @@ -0,0 +1,47 @@ +import { test } from '#noWalletFixtures'; +import { longTestTimeout } from 'utils/config'; + +test.describe('Open exisiting position pages - Aave v3 Base', async () => { + test('It should open an existing Aave V3 Base Earn yield loop CBETH/ETH position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/base/aave/v3/earn/CBETH-ETH/376#overview'); + + await app.position.shouldHaveHeader('CBETH/ETH yield multiple #376'); + await app.position.overview.shouldHaveNetValue({ + value: '[0-9].[0-9]{2}', + }); + }); + + test('It should open an existing Aave V3 Base Borrow ETH/USDBC position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/base/aave/v3/borrow/ETH-USDBC/441#overview'); + + await app.position.shouldHaveHeader('ETH/USDBC Borrow #441'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '0.00', + token: 'ETH/USDBC', + }); + await app.position.overview.shouldHaveLoanToValue('0.00'); + }); + + test('It should open an existing Aave V3 Base Multiply ETH/USDC position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/base/aave/v3/multiply/ETH-USDC/435#overview'); + + await app.position.shouldHaveHeader('ETH/USDC Multiply #435'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '([0-9],)[0-9]{2,3}.[0-9]{2}', + token: 'ETH/USDC', + }); + await app.position.overview.shouldHaveLoanToValue('[0-9]{2}.[0-9]{2}'); + }); +}); diff --git a/tests/noWallet/openExistingPositionPages/AaveV3/ethereum.spec.ts b/tests/noWallet/openExistingPositionPages/AaveV3/ethereum.spec.ts new file mode 100644 index 0000000..3a8b021 --- /dev/null +++ b/tests/noWallet/openExistingPositionPages/AaveV3/ethereum.spec.ts @@ -0,0 +1,66 @@ +import { test } from '#noWalletFixtures'; +import { longTestTimeout } from 'utils/config'; + +test.describe('Open exisiting position pages - Aave v3 Ethereum', async () => { + test('It should open an existing Aave V3 Ethereum Earn yield multiple WSTETH/ETH position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/ethereum/aave/v3/earn/WSTETH-ETH/193#overview'); + + await app.position.shouldHaveHeader('WSTETH/ETH yield multiple #193'); + await app.position.overview.shouldHaveNetValue({ + value: '0.00', + }); + }); + + test('It should open an existing Aave V3 Ethereum Borrow CBETH/ETH position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/ethereum/aave/v3/borrow/CBETH-ETH/1277#overview'); + + await app.position.shouldHaveHeader('CBETH/ETH Borrow #1277'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '0.[0-9]{4}', + token: 'CBETH/ETH', + }); + await app.position.overview.shouldHaveLoanToValue('[0-9]{1,2}.[0-9]{2}'); + }); + + test('It should open an existing Aave V3 Ethereum Multiply ETH/USDC position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/ethereum/aave/v3/multiply/ETH-USDC/1218#overview'); + + await app.position.shouldHaveHeader('ETH/USDC Multiply #1218'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '([1-3],)?[0-9]{3}.[0-9]{2}', + token: 'ETH/USDC', + }); + await app.position.overview.shouldHaveLoanToValue('[1-8][0-9].[0-9]{2}'); + await app.position.overview.shouldHaveNetValue({ value: '\\$[0-9]{1,2}.[0-9]{2}' }); + await app.position.overview.shouldHaveBuyingPower('\\$[0-9]{2,3}.[0-9]{2}'); + await app.position.overview.shouldHaveBuyingPowerGreaterThanZero(); + await app.position.overview.shouldHaveExposure({ + amount: '0.[0-9]{4}', + token: 'ETH', + }); + await app.position.overview.shouldHaveExposureGreaterThanZero('ETH'); + await app.position.overview.shouldHaveDebt({ + amount: '[0-9]{1,2}.[0-9]{2}', + token: 'USDC', + }); + await app.position.overview.shouldHaveBorrowRate('[0-9].[0-9]{2}'); + + await app.position.setup.shouldHaveLiquidationPrice({ + amount: '([1-3],)?[0-9]{2,3}.[0-9]{2}', + pair: 'ETH/USDC', + }); + await app.position.setup.shouldHaveLoanToValue('[0-9]{1,2}.[0-9]{1,2}'); + }); +}); diff --git a/tests/noWallet/openExistingPositionPages/AaveV3/optimism.spec.ts b/tests/noWallet/openExistingPositionPages/AaveV3/optimism.spec.ts new file mode 100644 index 0000000..28c9283 --- /dev/null +++ b/tests/noWallet/openExistingPositionPages/AaveV3/optimism.spec.ts @@ -0,0 +1,62 @@ +import { test } from '#noWalletFixtures'; +import { longTestTimeout } from 'utils/config'; + +test.describe('Open exisiting position pages - Aave v3 Optimism', async () => { + test('It should open an existing Aave V3 Optimism Earn yield loop USDC.E/SUSD position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/optimism/aave/v3/multiply/USDC.E-SUSD/396#overview'); + + await app.position.shouldHaveHeader('USDC.E/SUSD Multiply #396'); + await app.position.overview.shouldHaveNetValue({ + value: '[0-9].[0-9]{2}', + }); + }); + + test('It should open an existing Aave V3 Optimism Borrow DAI/WBTC position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + test.info().annotations.push({ + type: 'Test case', + description: '11994', + }); + + await app.page.goto('/optimism/aave/v3/borrow/dai-wbtc/4#overview'); + + await app.position.shouldHaveHeader('DAI/WBTC Borrow #4'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '<0.001', + token: 'WBTC/DAI', + }); + await app.position.overview.shouldHaveLoanToValue('>110.00'); + await app.position.overview.shouldHaveCollateralDeposited({ + amount: '<0.001', + token: 'DAI', + }); + await app.position.overview.shouldHaveDebt({ + amount: '<0.001', + token: 'WBTC', + }); + await app.position.overview.shouldHaveBorrowRate('[0-9]{1,2}.[0-9]{2}'); + await app.position.overview.shouldHaveNetValue({ value: '-0.[0-9]{1,2}' }); + }); + + test('It should open an existing Aave V3 Multiply Optimism WBTC/USDC.E position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/optimism/aave/v3/multiply/WBTC-USDC.E/19#overview'); + + await app.position.shouldHaveHeader('WBTC/USDC.E Multiply #19'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '[0-9]{1,2},[0-9]{3}.[0-9]{2}', + token: 'WBTC/USDC.E', + }); + await app.position.overview.shouldHaveLoanToValue('[0-9]{1,2}.[0-9]{2}'); + }); +}); diff --git a/tests/withRealWallet/aaveV3Arbitrum.spec.ts b/tests/withRealWallet/aaveV3Arbitrum.spec.ts index 1473410..dde337b 100644 --- a/tests/withRealWallet/aaveV3Arbitrum.spec.ts +++ b/tests/withRealWallet/aaveV3Arbitrum.spec.ts @@ -56,13 +56,12 @@ test.describe('Aave v3 - Arbitrum - Wallet connected', async () => { }); }); - // NO LIQUIDITY --> To be replaced with another pool - test.skip('It should open an Aave v3 Earn correlated Arbitrum position - WEETH/ETH @regression', async () => { + test('It should open an Aave v3 Earn correlated Arbitrum position - WSTETH/ETH @regression', async () => { test.setTimeout(longTestTimeout); - await app.page.goto('/arbitrum/aave/v3/multiply/WEETH-ETH#setup'); + await app.page.goto('/arbitrum/aave/v3/multiply/WSTETH-ETH#setup'); - await app.position.setup.deposit({ token: 'WEETH', amount: '0.0007' }); + await app.position.setup.deposit({ token: 'WSTETH', amount: '0.0006' }); await app.position.setup.confirm(); // Thre are two 'confirm' steps From 5b63d1284da55c5525bc610eea9399578e60fd63 Mon Sep 17 00:00:00 2001 From: juan-langa Date: Fri, 18 Oct 2024 16:28:17 +0200 Subject: [PATCH 2/3] Daily improvements - 18 October --- src/pages/position/overview.ts | 17 ++++++-- .../openExistingPositionPages/maker.spec.ts | 43 +++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 tests/noWallet/openExistingPositionPages/maker.spec.ts diff --git a/src/pages/position/overview.ts b/src/pages/position/overview.ts index 9d1ddf2..2352c1c 100644 --- a/src/pages/position/overview.ts +++ b/src/pages/position/overview.ts @@ -153,10 +153,21 @@ export class Overview { @param value - It must be regExp representing the the whole amount */ @step - async shouldHaveNetValue({ value, token }: { value: string; token?: string }) { - const regExp = new RegExp(`${value}${token ? ` ${token}` : ''}`); + async shouldHaveNetValue({ + value, + token, + sdr, + }: { + value: string; + token?: string; + sdr?: { savingsToken: 'DAI' | 'SDAI' }; + }) { + const regExp = new RegExp(`${value}${token ? (sdr ? `${token}` : ` ${token}`) : ''}`); await expect( - this.page.getByText('Net Value').locator('xpath=//following-sibling::p[1]') + this.page + .getByText('Net Value') + .nth(sdr?.savingsToken === 'SDAI' ? 1 : 0) + .locator('xpath=//following-sibling::p[1]') ).toHaveText(regExp, { timeout: positionTimeout }); } diff --git a/tests/noWallet/openExistingPositionPages/maker.spec.ts b/tests/noWallet/openExistingPositionPages/maker.spec.ts new file mode 100644 index 0000000..40b334e --- /dev/null +++ b/tests/noWallet/openExistingPositionPages/maker.spec.ts @@ -0,0 +1,43 @@ +import { test } from '#noWalletFixtures'; +import { longTestTimeout } from 'utils/config'; + +test.describe('Open exisiting position pages - Maker', async () => { + test('It should open an existing Maker Earn DSR position page @regression', async ({ app }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/earn/dsr/0x10649c79428d718621821cf6299e91920284743f#overview'); + + await app.position.shouldHaveHeader('Dai Savings Rate'); + await app.position.overview.shouldHaveNetValue({ + value: '[0-9]{1,2}.[0-9]{2}', + token: 'DAI', + sdr: { savingsToken: 'DAI' }, + }); + }); + + test('It should open an existing Maker Borrow ETH-C/DAI position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/ethereum/maker/30640#overview'); + + await app.position.shouldHaveHeader('ETH-C Vault 30640'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '0.00', + }); + }); + + test('It should open an existing Maker Multiply ETH-C/DAI position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('https://summer.fi/ethereum/maker/30639#overview'); + + await app.position.shouldHaveHeader('ETH-C Vault 30639'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '0.00', + }); + }); +}); From 5beec4a7f1c5ee77bffee7140de72bb647a3091e Mon Sep 17 00:00:00 2001 From: juan-langa Date: Fri, 18 Oct 2024 16:51:27 +0200 Subject: [PATCH 3/3] Daily improvements - 18 October --- .../openExistingPositionPages/maker.spec.ts | 2 +- .../morpho/ethereum.spec.ts | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/noWallet/openExistingPositionPages/morpho/ethereum.spec.ts diff --git a/tests/noWallet/openExistingPositionPages/maker.spec.ts b/tests/noWallet/openExistingPositionPages/maker.spec.ts index 40b334e..260f40e 100644 --- a/tests/noWallet/openExistingPositionPages/maker.spec.ts +++ b/tests/noWallet/openExistingPositionPages/maker.spec.ts @@ -33,7 +33,7 @@ test.describe('Open exisiting position pages - Maker', async () => { }) => { test.setTimeout(longTestTimeout); - await app.page.goto('https://summer.fi/ethereum/maker/30639#overview'); + await app.page.goto('/ethereum/maker/30639#overview'); await app.position.shouldHaveHeader('ETH-C Vault 30639'); await app.position.overview.shouldHaveLiquidationPrice({ diff --git a/tests/noWallet/openExistingPositionPages/morpho/ethereum.spec.ts b/tests/noWallet/openExistingPositionPages/morpho/ethereum.spec.ts new file mode 100644 index 0000000..26f5a43 --- /dev/null +++ b/tests/noWallet/openExistingPositionPages/morpho/ethereum.spec.ts @@ -0,0 +1,43 @@ +import { test } from '#noWalletFixtures'; +import { longTestTimeout } from 'utils/config'; + +test.describe('Open exisiting position pages - Morpho Ethereum', async () => { + test('It should open an existing Morpho Ethereum Earn Steakhouse USDC position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/ethereum/erc-4626/earn/steakhouse-USDC/1467#overview'); + + await app.position.shouldHaveHeader('Steakhouse USDC #1467'); + await app.position.overview.shouldHaveNetValue({ + value: '[0-9]{1,2}.[0-9]{2}', + }); + }); + + test('It should open an existing Morpho Ethereum Borrow WSTETH-ETH-1 position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/ethereum/morphoblue/borrow/WSTETH-ETH-1/1467#overview'); + + await app.position.shouldHaveHeader('WSTETH/ETH 94.50% Borrow #1467'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '[0-9].[0-9]{4}', + }); + }); + + test('It should open an existing Morpho Ethereum WBTC-USDC position page @regression', async ({ + app, + }) => { + test.setTimeout(longTestTimeout); + + await app.page.goto('/ethereum/morphoblue/multiply/WBTC-USDC/1467#overview'); + + await app.position.shouldHaveHeader('WBTC/USDC Multiply #1467'); + await app.position.overview.shouldHaveLiquidationPrice({ + price: '0.00', + }); + }); +});