Skip to content

Commit

Permalink
Merge pull request #121 from OasisDEX/enable-skipped-tests-1
Browse files Browse the repository at this point in the history
Re-enabling tests after fix for db collision
  • Loading branch information
juan-langa authored Jan 12, 2024
2 parents 54f8377 + 17daa28 commit afaf0fb
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 61 deletions.
12 changes: 8 additions & 4 deletions src/pages/position/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,16 @@ export class Overview {
}

@step
async shouldHaveDebt({ amount, token }: { amount: string; token: string }) {
async shouldHaveDebt(
{ amount, token, timeout }: { amount: string; token: string; timeout?: number } = {
amount: '',
token: '',
timeout: expectDefaultTimeout,
}
) {
let regexObj = new RegExp(`${amount} ${token}`);

await expect(this.page.locator('li:has-text(" Debt") > p')).toHaveText(regexObj, {
timeout: positionTimeout,
});
await expect(this.page.locator('li:has-text(" Debt") > p')).toHaveText(regexObj, { timeout });
}

@step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe('Aave v3 Borrow Arbitrum', async () => {
await app.position.setup.borrow({ token: 'USDC', amount: '8000' });

await app.position.overview.shouldHaveLiquidationPriceAfterPill('[1-6][0-9]{2}.[0-9]{2}');
await app.position.overview.shouldHaveLoanToValueAfterPill('[1-4][0-9].[0-9]{2}%');
await app.position.overview.shouldHaveLoanToValueAfterPill('[0-9]{1,2}.[0-9]{2}%');
await app.position.overview.shouldHaveNetValueAfterPill('[1-2][0-9].[0-9]{2}');
await app.position.overview.shouldHaveDebtAfterPill({ amount: '8,000.0000', token: 'USDC' });
await app.position.setup.orderInformation.shouldHaveOutstandingDebt({
Expand Down
6 changes: 3 additions & 3 deletions tests/noWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ test.describe('Aave v3 Earn Ethereum', async () => {

// Depositing collateral too quickly after loading page returns wrong simulation results
await app.position.setup.waitForComponentToBeStable();
await app.position.setup.deposit({ token: 'ETH', amount: '50' });
await app.position.setup.deposit({ token: 'ETH', amount: '40' });

await app.position.overview.shouldHaveTokenAmount({ amount: '50.00', token: 'ETH' });
await app.position.overview.shouldHaveTokenAmount({ amount: '40.00', token: 'ETH' });
await app.position.overview.shouldHavePrev30daysNetValue({
token: 'ETH',
amount: '50.[0-9]{2}',
amount: '40.[0-9]{2}',
});
await app.position.setup.shouldHaveCurrentPrice({
amount: '[1-9].[0-9]{2,4}',
Expand Down
25 changes: 10 additions & 15 deletions tests/noWallet/maker/makerMultiply.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,32 @@ import { test } from '#noWalletFixtures';
import { longTestTimeout } from 'utils/config';

test.describe('Maker Multiply', async () => {
test.skip('It should open an existing Maker Multiply Ethereum vault page @regression', async ({
app,
}) => {
test('It should open an existing Maker Multiply vault page @regression', async ({ app }) => {
test.setTimeout(longTestTimeout);

test.info().annotations.push({
type: 'Test case',
description: '11997',
});

await app.page.goto('/ethereum/maker/10187#overview');
await app.page.goto('/ethereum/maker/30640#overview');

await app.position.shouldHaveHeader('ETH-A Vault 10187');
await app.position.shouldHaveHeader('ETH-C Vault 30640');
await app.position.overview.shouldHaveLiquidationPrice({
price: '[0-9]{3}.[0-9]{2}',
price: '\\$0.00',
});
await app.position.overview.shouldHaveBuyingPower('[0-9]{2}.[0-9]{2}');
await app.position.overview.shouldHaveNetValue({ value: '[0-9]{2,3}.[0-9]{2}' });
await app.position.overview.shouldHaveBuyingPower('\\$0.00');
await app.position.overview.shouldHaveNetValue({ value: '\\$0.00' });
await app.position.overview.shouldHaveDebt({
amount: '[0-9]{1,2}.[0-9]{4}',
amount: '0.0000',
token: 'DAI',
});
await app.position.overview.shouldHaveTotalCollateral({
amount: '0.[0-3][1-9][0-9]{2}',
amount: '0.00',
token: 'ETH',
});
await app.position.overview.shouldHaveMultiple('1.[0-9]{2}');
await app.position.overview.shouldHaveMultiple('0.00');

await app.position.setup.shouldHaveLiquidationPrice({
amount: '[0-9]{3}.[0-9]{2}',
});
await app.position.manage.shouldHaveCollateralRatio('[0-9]{3,4}');
await app.position.manage.shouldBeVisible('Manage your vault');
});
});
3 changes: 1 addition & 2 deletions tests/noWallet/portfolio/emptyWallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ test.describe('Empty wallet - Wallet not connected', async () => {
await app.portfolio.wallet.shouldNotHaveAssets();
});

// Header always return `NaN` when running tests in github
test.skip('It should show "0.00" for all headline fields @regression', async () => {
test('It should show "0.00" for all headline fields @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: '12837',
Expand Down
24 changes: 10 additions & 14 deletions tests/withWallet/aaveV2/aaveV2Earn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { resetState } from '@synthetixio/synpress/commands/synpress';
import * as metamask from '@synthetixio/synpress/commands/metamask';
import * as tenderly from 'utils/tenderly';
import { setup } from 'utils/setup';
import { hooksTimeout, extremelyLongTestTimeout, baseUrl, longTestTimeout } from 'utils/config';
import { extremelyLongTestTimeout, longTestTimeout } from 'utils/config';
import { App } from 'src/app';

let context: BrowserContext;
Expand All @@ -14,18 +14,6 @@ let forkId: string;
test.describe.configure({ mode: 'serial' });

test.describe('Aave V2 Earn - Wallet connected', async () => {
test.skip(baseUrl.includes('staging') || baseUrl.includes('//summer.fi'));

test.beforeEach(async () => {
test.setTimeout(hooksTimeout);

({ context } = await metamaskSetUp({ network: 'mainnet' }));
let page = await context.newPage();
app = new App(page);

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

test.afterAll(async () => {
await tenderly.deleteFork(forkId);

Expand All @@ -44,6 +32,14 @@ test.describe('Aave V2 Earn - Wallet connected', async () => {

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/earn/stETHeth');
// Depositing collateral too quickly after loading page returns wrong simulation results
await app.position.setup.waitForComponentToBeStable();
Expand All @@ -67,6 +63,6 @@ test.describe('Aave V2 Earn - Wallet connected', async () => {
}).toPass({ timeout: longTestTimeout });

await app.position.setup.goToPosition();
await app.position.manage.shouldBeVisible('Manage ');
await app.position.manage.shouldBeVisible('Manage Earn position');
});
});
5 changes: 1 addition & 4 deletions tests/withWallet/aaveV2/aaveV2Multiply.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as tenderly from 'utils/tenderly';
import { setup } from 'utils/setup';
import {
extremelyLongTestTimeout,
baseUrl,
veryLongTestTimeout,
longTestTimeout,
positionTimeout,
Expand Down Expand Up @@ -199,9 +198,7 @@ test.describe('Aave v2 Multiply - Wallet connected', async () => {
description: '11773',
});

test.skip(baseUrl.includes('staging') || baseUrl.includes('//summer.fi'));

test.setTimeout(extremelyLongTestTimeout);
test.setTimeout(veryLongTestTimeout);

await app.page.goto('/ethereum/aave/v2/multiply/ethusdc#simulate');

Expand Down
24 changes: 10 additions & 14 deletions tests/withWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { resetState } from '@synthetixio/synpress/commands/synpress';
import * as metamask from '@synthetixio/synpress/commands/metamask';
import * as tenderly from 'utils/tenderly';
import { setup } from 'utils/setup';
import { hooksTimeout, extremelyLongTestTimeout, baseUrl, longTestTimeout } from 'utils/config';
import { extremelyLongTestTimeout, longTestTimeout } from 'utils/config';
import { App } from 'src/app';

let context: BrowserContext;
Expand All @@ -14,18 +14,6 @@ let forkId: string;
test.describe.configure({ mode: 'serial' });

test.describe('Aave V3 Borrow - Arbitrum - Wallet connected', async () => {
test.skip(baseUrl.includes('staging') || baseUrl.includes('//summer.fi'));

test.beforeEach(async () => {
test.setTimeout(hooksTimeout);

({ context } = await metamaskSetUp({ network: 'arbitrum' }));
let page = await context.newPage();
app = new App(page);

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

test.afterAll(async () => {
await tenderly.deleteFork(forkId);

Expand All @@ -44,6 +32,14 @@ test.describe('Aave V3 Borrow - Arbitrum - Wallet connected', async () => {

test.setTimeout(extremelyLongTestTimeout);

await test.step('Test setup', async () => {
({ context } = await metamaskSetUp({ network: 'arbitrum' }));
let page = await context.newPage();
app = new App(page);

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

await app.page.goto('/arbitrum/aave/v3/borrow/ethusdc');
// Depositing collateral too quickly after loading page returns wrong simulation results
await app.position.overview.waitForComponentToBeStable();
Expand All @@ -68,6 +64,6 @@ test.describe('Aave V3 Borrow - Arbitrum - Wallet connected', async () => {
}).toPass({ timeout: longTestTimeout });

await app.position.setup.goToPosition();
await app.position.manage.shouldBeVisible('Manage ');
await app.position.manage.shouldBeVisible('Manage collateral');
});
});
13 changes: 11 additions & 2 deletions tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
baseUrl,
veryLongTestTimeout,
longTestTimeout,
positionTimeout,
} from 'utils/config';
import { App } from 'src/app';

Expand Down Expand Up @@ -144,7 +145,11 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => {

await app.position.manage.ok();

await app.position.overview.shouldHaveDebt({ amount: '5.00000', token: 'ETH' });
await app.position.overview.shouldHaveDebt({
amount: '5.00000',
token: 'ETH',
timeout: positionTimeout,
});
});

test('It should pay back some debt from an existing Aave V3 Ethereum Earn position @regression', async () => {
Expand Down Expand Up @@ -174,7 +179,11 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => {

await app.position.manage.ok();

await app.position.overview.shouldHaveDebt({ amount: '3.00000', token: 'ETH' });
await app.position.overview.shouldHaveDebt({
amount: '3.00000',
token: 'ETH',
timeout: positionTimeout,
});
});

test('It should adjust risk of an existing Aave V3 Earn Ethereum position - Up @regression', async () => {
Expand Down
12 changes: 10 additions & 2 deletions tests/withWallet/spark/borrow/sparkBorrow1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ test.describe('Spark Borrow - Wallet connected', async () => {

await app.position.manage.ok();

await app.position.overview.shouldHaveDebt({ amount: '5,[0-9]{3}.[0-9]{4}', token: 'DAI' });
await app.position.overview.shouldHaveDebt({
amount: '5,[0-9]{3}.[0-9]{4}',
token: 'DAI',
timeout: positionTimeout,
});
});

test('It should pay back some debt from an existing Spark Borrow position @regression', async () => {
Expand Down Expand Up @@ -182,7 +186,11 @@ test.describe('Spark Borrow - Wallet connected', async () => {

await app.position.manage.ok();

await app.position.overview.shouldHaveDebt({ amount: '[2-3],[0-9]{3}.[0-9]{4}', token: 'DAI' });
await app.position.overview.shouldHaveDebt({
amount: '[2-3],[0-9]{3}.[0-9]{4}',
token: 'DAI',
timeout: positionTimeout,
});
});

test('It should close an existent Spark Borrow position - Close to collateral token (ETH) @regression', async () => {
Expand Down

0 comments on commit afaf0fb

Please sign in to comment.