diff --git a/src/pages/position/overview.ts b/src/pages/position/overview.ts index eaff3e6f..975f85be 100644 --- a/src/pages/position/overview.ts +++ b/src/pages/position/overview.ts @@ -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 diff --git a/tests/noWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts b/tests/noWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts index 51a744f1..71ad3317 100644 --- a/tests/noWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts +++ b/tests/noWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts @@ -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({ diff --git a/tests/noWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts b/tests/noWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts index fb180406..c0eeea4c 100644 --- a/tests/noWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts +++ b/tests/noWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts @@ -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}', diff --git a/tests/noWallet/maker/makerMultiply.spec.ts b/tests/noWallet/maker/makerMultiply.spec.ts index 4f01a208..c35e7d17 100644 --- a/tests/noWallet/maker/makerMultiply.spec.ts +++ b/tests/noWallet/maker/makerMultiply.spec.ts @@ -2,9 +2,7 @@ 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({ @@ -12,27 +10,24 @@ test.describe('Maker Multiply', async () => { 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'); }); }); diff --git a/tests/noWallet/portfolio/emptyWallet.spec.ts b/tests/noWallet/portfolio/emptyWallet.spec.ts index f3016bb9..7f8e14bc 100644 --- a/tests/noWallet/portfolio/emptyWallet.spec.ts +++ b/tests/noWallet/portfolio/emptyWallet.spec.ts @@ -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', diff --git a/tests/withWallet/aaveV2/aaveV2Earn.spec.ts b/tests/withWallet/aaveV2/aaveV2Earn.spec.ts index 9de6a5b4..44b93631 100644 --- a/tests/withWallet/aaveV2/aaveV2Earn.spec.ts +++ b/tests/withWallet/aaveV2/aaveV2Earn.spec.ts @@ -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; @@ -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); @@ -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(); @@ -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'); }); }); diff --git a/tests/withWallet/aaveV2/aaveV2Multiply.spec.ts b/tests/withWallet/aaveV2/aaveV2Multiply.spec.ts index 80876271..6c2363e3 100644 --- a/tests/withWallet/aaveV2/aaveV2Multiply.spec.ts +++ b/tests/withWallet/aaveV2/aaveV2Multiply.spec.ts @@ -6,7 +6,6 @@ import * as tenderly from 'utils/tenderly'; import { setup } from 'utils/setup'; import { extremelyLongTestTimeout, - baseUrl, veryLongTestTimeout, longTestTimeout, positionTimeout, @@ -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'); diff --git a/tests/withWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts b/tests/withWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts index 0b5ba749..0af5e689 100644 --- a/tests/withWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts +++ b/tests/withWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts @@ -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; @@ -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); @@ -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(); @@ -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'); }); }); diff --git a/tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts b/tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts index ca898dc8..e9b07275 100644 --- a/tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts +++ b/tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts @@ -9,6 +9,7 @@ import { baseUrl, veryLongTestTimeout, longTestTimeout, + positionTimeout, } from 'utils/config'; import { App } from 'src/app'; @@ -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 () => { @@ -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 () => { diff --git a/tests/withWallet/spark/borrow/sparkBorrow1.spec.ts b/tests/withWallet/spark/borrow/sparkBorrow1.spec.ts index 2c0f1a5a..d21731a0 100644 --- a/tests/withWallet/spark/borrow/sparkBorrow1.spec.ts +++ b/tests/withWallet/spark/borrow/sparkBorrow1.spec.ts @@ -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 () => { @@ -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 () => {