Skip to content

Commit

Permalink
Merge pull request #577 from OasisDEX/daily-improvements-18-oct-3
Browse files Browse the repository at this point in the history
Daily improvements 18 oct 3
  • Loading branch information
juan-langa authored Oct 18, 2024
2 parents 7a93e8f + 5beec4a commit a40f5de
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 83 deletions.
17 changes: 14 additions & 3 deletions src/pages/position/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

Expand Down
39 changes: 0 additions & 39 deletions tests/noWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
34 changes: 0 additions & 34 deletions tests/noWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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');
});
});
47 changes: 47 additions & 0 deletions tests/noWallet/openExistingPositionPages/AaveV3/base.spec.ts
Original file line number Diff line number Diff line change
@@ -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}');
});
});
66 changes: 66 additions & 0 deletions tests/noWallet/openExistingPositionPages/AaveV3/ethereum.spec.ts
Original file line number Diff line number Diff line change
@@ -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}');
});
});
62 changes: 62 additions & 0 deletions tests/noWallet/openExistingPositionPages/AaveV3/optimism.spec.ts
Original file line number Diff line number Diff line change
@@ -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}');
});
});
43 changes: 43 additions & 0 deletions tests/noWallet/openExistingPositionPages/maker.spec.ts
Original file line number Diff line number Diff line change
@@ -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('/ethereum/maker/30639#overview');

await app.position.shouldHaveHeader('ETH-C Vault 30639');
await app.position.overview.shouldHaveLiquidationPrice({
price: '0.00',
});
});
});
Loading

0 comments on commit a40f5de

Please sign in to comment.