diff --git a/tests/withWallet/aaveV2/aaveV2Earn.spec.ts b/tests/withWallet/aaveV2/aaveV2Earn.spec.ts index f68eae53..9de6a5b4 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 } from 'utils/config'; +import { hooksTimeout, extremelyLongTestTimeout, baseUrl, longTestTimeout } from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -64,7 +64,7 @@ test.describe('Aave V2 Earn - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/aaveV2/aaveV2Multiply.spec.ts b/tests/withWallet/aaveV2/aaveV2Multiply.spec.ts index 48b451c9..eef05808 100644 --- a/tests/withWallet/aaveV2/aaveV2Multiply.spec.ts +++ b/tests/withWallet/aaveV2/aaveV2Multiply.spec.ts @@ -4,7 +4,12 @@ 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 { extremelyLongTestTimeout, baseUrl, veryLongTestTimeout } from 'utils/config'; +import { + extremelyLongTestTimeout, + baseUrl, + veryLongTestTimeout, + longTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -61,7 +66,7 @@ test.describe('Aave v2 Multiply - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -98,7 +103,7 @@ test.describe('Aave v2 Multiply - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -133,7 +138,7 @@ test.describe('Aave v2 Multiply - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -168,7 +173,7 @@ test.describe('Aave v2 Multiply - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -207,7 +212,7 @@ test.describe('Aave v2 Multiply - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); await app.position.setup.openMultiplyPosition1Of2(); @@ -219,7 +224,7 @@ test.describe('Aave v2 Multiply - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts b/tests/withWallet/aaveV3/arbitrum/aaveV3BorrowArbitrum.spec.ts index 72de4b57..0b5ba749 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 } from 'utils/config'; +import { hooksTimeout, extremelyLongTestTimeout, baseUrl, longTestTimeout } from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -65,7 +65,7 @@ test.describe('Aave V3 Borrow - Arbitrum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/aaveV3/arbitrum/aaveV3MultiplyArbitrum.spec.ts b/tests/withWallet/aaveV3/arbitrum/aaveV3MultiplyArbitrum.spec.ts index 975cdffb..0973b085 100644 --- a/tests/withWallet/aaveV3/arbitrum/aaveV3MultiplyArbitrum.spec.ts +++ b/tests/withWallet/aaveV3/arbitrum/aaveV3MultiplyArbitrum.spec.ts @@ -4,7 +4,12 @@ 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 { baseUrl, extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config'; +import { + baseUrl, + extremelyLongTestTimeout, + longTestTimeout, + veryLongTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -57,7 +62,7 @@ test.describe('Aave v3 Multiply - Arbitrum - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); await app.position.setup.openMultiplyPosition1Of2(); @@ -69,7 +74,7 @@ test.describe('Aave v3 Multiply - Arbitrum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); @@ -112,11 +117,16 @@ test.describe('Aave v3 Multiply - Arbitrum - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.9 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Multiply position'); @@ -156,11 +166,16 @@ test.describe('Aave v3 Multiply - Arbitrum - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.3 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Multiply position'); @@ -200,12 +215,16 @@ test.describe('Aave v3 Multiply - Arbitrum - Wallet connected', async () => { token: 'DAI', amount: '[1-6].[0-9]{3,4}', }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.page.goto('/arbitrum/aave/v3/1#overview'); diff --git a/tests/withWallet/aaveV3/base/aaveV3BorrowBase.spec.ts b/tests/withWallet/aaveV3/base/aaveV3BorrowBase.spec.ts index ba26b170..9405b060 100644 --- a/tests/withWallet/aaveV3/base/aaveV3BorrowBase.spec.ts +++ b/tests/withWallet/aaveV3/base/aaveV3BorrowBase.spec.ts @@ -4,7 +4,12 @@ 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 { extremelyLongTestTimeout, baseUrl, veryLongTestTimeout } from 'utils/config'; +import { + extremelyLongTestTimeout, + baseUrl, + veryLongTestTimeout, + longTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -52,11 +57,15 @@ test.describe('Aave V3 Borrow - Base - Wallet connected', async () => { await app.position.manage.shouldBeVisible('Manage collateral'); await app.position.manage.enter({ token: 'ETH', amount: '15' }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.overview.shouldHaveNetValue({ @@ -84,11 +93,16 @@ test.describe('Aave V3 Borrow - Base - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.7 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage collateral'); @@ -116,11 +130,16 @@ test.describe('Aave V3 Borrow - Base - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.3 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage collateral'); @@ -149,12 +168,16 @@ test.describe('Aave V3 Borrow - Base - Wallet connected', async () => { token: 'ETH', amount: '[0-9]{1,2}.[0-9]{1,2}', }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.page.goto('/base/aave/v3/2#overview'); @@ -190,7 +213,7 @@ test.describe('Aave V3 Borrow - Base - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); await app.position.setup.openBorrowPosition1Of2(); @@ -202,7 +225,7 @@ test.describe('Aave V3 Borrow - Base - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/aaveV3/base/aaveV3EarnBase.spec.ts b/tests/withWallet/aaveV3/base/aaveV3EarnBase.spec.ts index c3843bc3..b4672752 100644 --- a/tests/withWallet/aaveV3/base/aaveV3EarnBase.spec.ts +++ b/tests/withWallet/aaveV3/base/aaveV3EarnBase.spec.ts @@ -4,7 +4,12 @@ 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 { extremelyLongTestTimeout, baseUrl, veryLongTestTimeout } from 'utils/config'; +import { + extremelyLongTestTimeout, + baseUrl, + veryLongTestTimeout, + longTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -60,11 +65,16 @@ test.describe('Aave V3 Earn - Base - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.3 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Earn position'); @@ -90,11 +100,16 @@ test.describe('Aave V3 Earn - Base - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.7 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Earn position'); @@ -120,12 +135,16 @@ test.describe('Aave V3 Earn - Base - Wallet connected', async () => { token: 'ETH', amount: '[0-9]{1,2}.[0-9]{1,2}', }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.page.goto('/base/aave/v3/18#overview'); @@ -162,7 +181,7 @@ test.describe('Aave V3 Earn - Base - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); @@ -174,7 +193,7 @@ test.describe('Aave V3 Earn - Base - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); await app.position.setup.openMultiplyPosition1Of2(); @@ -186,7 +205,7 @@ test.describe('Aave V3 Earn - Base - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/aaveV3/base/aaveV3MultiplyBase.spec.ts b/tests/withWallet/aaveV3/base/aaveV3MultiplyBase.spec.ts index 9bf4111c..538bdc28 100644 --- a/tests/withWallet/aaveV3/base/aaveV3MultiplyBase.spec.ts +++ b/tests/withWallet/aaveV3/base/aaveV3MultiplyBase.spec.ts @@ -57,11 +57,16 @@ test.describe('Aave v3 Multiply - Base - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.2 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Multiply position'); @@ -87,11 +92,16 @@ test.describe('Aave v3 Multiply - Base - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.7 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Multiply position'); @@ -117,12 +127,16 @@ test.describe('Aave v3 Multiply - Base - Wallet connected', async () => { token: 'USDBC', amount: '[0-9]{1,2}.[0-9]{1,2}', }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.overview.shouldHaveLiquidationPrice({ price: '0.00', token: 'USDBC' }); @@ -160,7 +174,7 @@ test.describe('Aave v3 Multiply - Base - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); @@ -172,7 +186,7 @@ test.describe('Aave v3 Multiply - Base - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); await app.position.setup.openMultiplyPosition1Of2(); @@ -184,7 +198,7 @@ test.describe('Aave v3 Multiply - Base - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/aaveV3/ethereum/aaveV3BorrowEthereum.spec.ts b/tests/withWallet/aaveV3/ethereum/aaveV3BorrowEthereum.spec.ts index 6b60a1e3..bf63da2f 100644 --- a/tests/withWallet/aaveV3/ethereum/aaveV3BorrowEthereum.spec.ts +++ b/tests/withWallet/aaveV3/ethereum/aaveV3BorrowEthereum.spec.ts @@ -4,7 +4,12 @@ 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 { baseUrl, extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config'; +import { + baseUrl, + extremelyLongTestTimeout, + longTestTimeout, + veryLongTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -64,7 +69,7 @@ test.describe('Aave V3 Borrow - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); @@ -109,11 +114,16 @@ test.describe('Aave V3 Borrow - Ethereum - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.5 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage collateral'); @@ -141,11 +151,16 @@ test.describe('Aave V3 Borrow - Ethereum - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.3 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage collateral'); @@ -174,12 +189,16 @@ test.describe('Aave V3 Borrow - Ethereum - Wallet connected', async () => { token: 'CBETH', amount: '0.[0-9]{3,4}', }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.page.goto('/ethereum/aave/v3/1277#overview'); diff --git a/tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts b/tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts index 501ed3d7..399609c7 100644 --- a/tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts +++ b/tests/withWallet/aaveV3/ethereum/aaveV3EarnEthereum.spec.ts @@ -4,7 +4,12 @@ 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 { extremelyLongTestTimeout, baseUrl, veryLongTestTimeout } from 'utils/config'; +import { + extremelyLongTestTimeout, + baseUrl, + veryLongTestTimeout, + longTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -63,7 +68,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); // Confirm action randomly fails - Retry until it's applied. @@ -73,7 +78,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -106,7 +111,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -135,7 +140,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -165,7 +170,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -196,7 +201,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -228,7 +233,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -261,7 +266,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -307,7 +312,7 @@ test.describe('Aave V3 Earn - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts b/tests/withWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts index d035be4e..567ac6fa 100644 --- a/tests/withWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts +++ b/tests/withWallet/aaveV3/ethereum/aaveV3MultiplyEthereum.spec.ts @@ -4,7 +4,12 @@ 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 { baseUrl, extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config'; +import { + baseUrl, + extremelyLongTestTimeout, + longTestTimeout, + veryLongTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -59,7 +64,7 @@ test.describe('Aave v3 Multiply - Ethereum - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); @@ -71,7 +76,7 @@ test.describe('Aave v3 Multiply - Ethereum - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); @@ -84,7 +89,7 @@ test.describe('Aave v3 Multiply - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); @@ -134,7 +139,7 @@ test.describe('Aave v3 Multiply - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -182,7 +187,7 @@ test.describe('Aave v3 Multiply - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -230,7 +235,7 @@ test.describe('Aave v3 Multiply - Ethereum - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); diff --git a/tests/withWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts b/tests/withWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts index a4058f03..2211eb86 100644 --- a/tests/withWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts +++ b/tests/withWallet/aaveV3/optimism/aaveV3BorrowOptimism.spec.ts @@ -4,7 +4,12 @@ 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 { baseUrl, extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config'; +import { + baseUrl, + extremelyLongTestTimeout, + longTestTimeout, + veryLongTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -64,7 +69,7 @@ test.describe('Aave V3 Borrow - Optimism - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); @@ -117,7 +122,7 @@ test.describe('Aave V3 Borrow - Optimism - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -154,7 +159,7 @@ test.describe('Aave V3 Borrow - Optimism - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -192,7 +197,7 @@ test.describe('Aave V3 Borrow - Optimism - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); diff --git a/tests/withWallet/aaveV3/optimism/aaveV3MultiplyOptimism.spec.ts b/tests/withWallet/aaveV3/optimism/aaveV3MultiplyOptimism.spec.ts index 051fc9ea..33b4cf95 100644 --- a/tests/withWallet/aaveV3/optimism/aaveV3MultiplyOptimism.spec.ts +++ b/tests/withWallet/aaveV3/optimism/aaveV3MultiplyOptimism.spec.ts @@ -4,7 +4,12 @@ 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 { baseUrl, extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config'; +import { + baseUrl, + extremelyLongTestTimeout, + longTestTimeout, + veryLongTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -57,14 +62,21 @@ test.describe('Aave v3 Multiply - Optimism - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); await app.position.setup.openMultiplyPosition1Of2(); - await app.position.setup.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.setup.goToPositionShouldBeVisible(); + }).toPass({ timeout: longTestTimeout }); + + await app.position.manage.ok(); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); @@ -106,11 +118,16 @@ test.describe('Aave v3 Multiply - Optimism - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.9 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Multiply position'); @@ -149,11 +166,16 @@ test.describe('Aave v3 Multiply - Optimism - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.3 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Multiply position'); @@ -192,12 +214,16 @@ test.describe('Aave v3 Multiply - Optimism - Wallet connected', async () => { token: 'ETH', amount: '0.[0-9]{3,4}', }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.page.goto('/optimism/aave/v3/2#overview'); diff --git a/tests/withWallet/ajna/ethereum/ajnaBorrowEthereum.spec.ts b/tests/withWallet/ajna/ethereum/ajnaBorrowEthereum.spec.ts index 697b2378..e9b84e49 100644 --- a/tests/withWallet/ajna/ethereum/ajnaBorrowEthereum.spec.ts +++ b/tests/withWallet/ajna/ethereum/ajnaBorrowEthereum.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 } from 'utils/config'; +import { hooksTimeout, extremelyLongTestTimeout, baseUrl, longTestTimeout } from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -154,7 +154,7 @@ test.describe('Ajna Ethereum Borrow - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); @@ -165,7 +165,7 @@ test.describe('Ajna Ethereum Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage your '); diff --git a/tests/withWallet/ajna/ethereum/ajnaEarnethereum.spec.ts b/tests/withWallet/ajna/ethereum/ajnaEarnethereum.spec.ts index 6b1f155b..19b6eab9 100644 --- a/tests/withWallet/ajna/ethereum/ajnaEarnethereum.spec.ts +++ b/tests/withWallet/ajna/ethereum/ajnaEarnethereum.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 } from 'utils/config'; +import { hooksTimeout, extremelyLongTestTimeout, baseUrl, longTestTimeout } from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -157,7 +157,7 @@ test.describe('Ajna Ethereum Earn - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); @@ -168,7 +168,7 @@ test.describe('Ajna Ethereum Earn - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage your '); diff --git a/tests/withWallet/ajna/ethereum/ajnaMultiplyEthereum.spec.ts b/tests/withWallet/ajna/ethereum/ajnaMultiplyEthereum.spec.ts index 6f7f6952..bd196616 100644 --- a/tests/withWallet/ajna/ethereum/ajnaMultiplyEthereum.spec.ts +++ b/tests/withWallet/ajna/ethereum/ajnaMultiplyEthereum.spec.ts @@ -4,7 +4,13 @@ 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, veryLongTestTimeout, baseUrl } from 'utils/config'; +import { + hooksTimeout, + extremelyLongTestTimeout, + veryLongTestTimeout, + baseUrl, + longTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -171,7 +177,7 @@ test.describe('Ajna Ethereum Multiply - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); @@ -189,7 +195,7 @@ test.describe('Ajna Ethereum Multiply - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.shouldConfirmPositionCreation(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/maker/makerBorrow.spec.ts b/tests/withWallet/maker/makerBorrow.spec.ts index a991b3f3..58d58704 100644 --- a/tests/withWallet/maker/makerBorrow.spec.ts +++ b/tests/withWallet/maker/makerBorrow.spec.ts @@ -140,7 +140,7 @@ test.describe('Maker Borrow - Wallet connected', async () => { // asset: 'ETH-A Summer.fi Borrow', // amount: '[0-9]{1,2},[0-9]{3}(.[0-9]{1,2})?', // }); - // }).toPass(); + // }).toPass({ timeout: longTestTimeout }); }); // Skipping test as Maker position pages don't open when using forks diff --git a/tests/withWallet/spark/sparkBorrow.spec.ts b/tests/withWallet/spark/sparkBorrow.spec.ts index 61785e5c..b484c223 100644 --- a/tests/withWallet/spark/sparkBorrow.spec.ts +++ b/tests/withWallet/spark/sparkBorrow.spec.ts @@ -4,7 +4,12 @@ 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 { baseUrl, extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config'; +import { + baseUrl, + extremelyLongTestTimeout, + longTestTimeout, + veryLongTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -67,7 +72,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -104,7 +109,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -142,7 +147,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -186,7 +191,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); @@ -226,7 +231,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); @@ -237,7 +242,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -269,7 +274,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -298,7 +303,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -328,7 +333,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); // Confirm action randomly fails - Retry until it's applied. @@ -338,7 +343,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -372,7 +377,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -409,7 +414,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); @@ -447,7 +452,7 @@ test.describe('Spark Borrow - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.manage.shouldShowSuccessScreen(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.manage.ok(); diff --git a/tests/withWallet/spark/sparkEarn.spec.ts b/tests/withWallet/spark/sparkEarn.spec.ts index a0862849..a7a3ef23 100644 --- a/tests/withWallet/spark/sparkEarn.spec.ts +++ b/tests/withWallet/spark/sparkEarn.spec.ts @@ -4,7 +4,12 @@ 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, veryLongTestTimeout, baseUrl } from 'utils/config'; +import { + extremelyLongTestTimeout, + veryLongTestTimeout, + baseUrl, + longTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -65,11 +70,16 @@ test.describe('Spark Earn - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.6 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Earn position'); @@ -95,11 +105,16 @@ test.describe('Spark Earn - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.3 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Earn position'); @@ -125,12 +140,16 @@ test.describe('Spark Earn - Wallet connected', async () => { token: 'WSTETH', amount: '0.[0-9]{1,4}', }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.overview.shouldHaveLiquidationPrice({ price: '0.00', token: 'ETH' }); @@ -191,7 +210,7 @@ test.describe('Spark Earn - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.goToPositionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.goToPosition(); await app.position.manage.shouldBeVisible('Manage '); diff --git a/tests/withWallet/spark/sparkMultiply.spec.ts b/tests/withWallet/spark/sparkMultiply.spec.ts index f6348803..39a032d0 100644 --- a/tests/withWallet/spark/sparkMultiply.spec.ts +++ b/tests/withWallet/spark/sparkMultiply.spec.ts @@ -4,7 +4,12 @@ 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 { baseUrl, extremelyLongTestTimeout, veryLongTestTimeout } from 'utils/config'; +import { + baseUrl, + extremelyLongTestTimeout, + longTestTimeout, + veryLongTestTimeout, +} from 'utils/config'; import { App } from 'src/app'; let context: BrowserContext; @@ -42,32 +47,37 @@ test.describe('Spark Multiply - Wallet connected', async () => { }); await tenderly.changeAccountOwner({ - account: '0xb585a1bae38dc735988cc75278aecae786e6a5d6', + account: '0x302a28d7968824f386f278a72368856bc4d82ba4', newOwner: walletAddress, forkId, }); - await app.page.goto('/ethereum/spark/v3/1448#overview'); + await app.page.goto('/ethereum/spark/v3/1467#overview'); await app.position.manage.shouldBeVisible('Manage Multiply position'); const initialLiqPrice = await app.position.manage.getLiquidationPrice(); const initialLoanToValue = await app.position.manage.getLoanToValue(); await app.position.manage.waitForSliderToBeEditable(); - await app.position.manage.moveSlider({ value: 0.3 }); + await app.position.manage.moveSlider({ value: 0.1 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Multiply position'); const updatedLiqPrice = await app.position.manage.getLiquidationPrice(); const updatedLoanToValue = await app.position.manage.getLoanToValue(); - expect(updatedLiqPrice).toBeGreaterThan(initialLiqPrice); + expect(updatedLiqPrice).toBeLessThan(initialLiqPrice); expect(updatedLoanToValue).toBeLessThan(initialLoanToValue); }); @@ -87,21 +97,26 @@ test.describe('Spark Multiply - Wallet connected', async () => { await app.position.manage.moveSlider({ value: 0.8 }); await app.position.manage.adjustRisk(); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); await app.position.manage.shouldBeVisible('Manage Multiply position'); const updatedLiqPrice = await app.position.manage.getLiquidationPrice(); const updatedLoanToValue = await app.position.manage.getLoanToValue(); - expect(updatedLiqPrice).toBeLessThan(initialLiqPrice); + expect(updatedLiqPrice).toBeGreaterThan(initialLiqPrice); expect(updatedLoanToValue).toBeGreaterThan(initialLoanToValue); }); - test('It should close an existent Spark Earn position - Close to debt token (ETH) @regression', async () => { + test('It should close an existent Spark Earn position - Close to collateral token (ETH) @regression', async () => { test.info().annotations.push({ type: 'Test case', description: '12897', @@ -116,12 +131,12 @@ test.describe('Spark Multiply - Wallet connected', async () => { }); await tenderly.changeAccountOwner({ - account: '0xb585a1bae38dc735988cc75278aecae786e6a5d6', + account: '0x302a28d7968824f386f278a72368856bc4d82ba4', newOwner: walletAddress, forkId, }); - await app.page.goto('/ethereum/spark/v3/1448#overview'); + await app.page.goto('/ethereum/spark/v3/1467#overview'); await app.position.manage.openManageOptions({ currentLabel: 'Adjust' }); await app.position.manage.select('Close position'); @@ -131,20 +146,24 @@ test.describe('Spark Multiply - Wallet connected', async () => { token: 'ETH', amount: '0.[0-9]{1,4}', }); - await app.position.manage.confirm(); - await test.step('Metamask: ConfirmPermissionToSpend', async () => { - await metamask.confirmPermissionToSpend(); - }); - await app.position.manage.shouldShowSuccessScreen(); + // Confirm action randomly fails - Retry until it's applied. + await expect(async () => { + await app.position.setup.confirmOrRetry(); + await test.step('Metamask: ConfirmPermissionToSpend', async () => { + await metamask.confirmPermissionToSpend(); + }); + await app.position.manage.shouldShowSuccessScreen(); + }).toPass({ timeout: longTestTimeout }); + await app.position.manage.ok(); - await app.position.overview.shouldHaveLiquidationPrice({ price: '0.00', token: 'SDAI' }); + await app.position.overview.shouldHaveLiquidationPrice({ price: '0.00', token: 'DAI' }); await app.position.overview.shouldHaveLoanToValue('0.00'); await app.position.overview.shouldHaveBorrowCost('0.00'); - await app.position.overview.shouldHaveNetValue({ value: '0.00', token: 'SDAI' }); - await app.position.overview.shouldHaveExposure({ amount: '0.0000', token: 'SDAI' }); - await app.position.overview.shouldHaveDebt({ amount: '0.0000', token: 'ETH' }); + await app.position.overview.shouldHaveNetValue({ value: '0.00', token: 'DAI' }); + await app.position.overview.shouldHaveExposure({ amount: '0.00000', token: 'ETH' }); + await app.position.overview.shouldHaveDebt({ amount: '0.0000', token: 'DAI' }); await app.position.overview.shouldHaveMultiple('1'); await app.position.overview.shouldHaveBuyingPower('0.00'); }); @@ -173,7 +192,7 @@ test.describe('Spark Multiply - Wallet connected', async () => { await metamask.confirmAddToken(); }); await app.position.setup.continueShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); await app.position.setup.continue(); await app.position.setup.setupStopLoss1Of3(); @@ -186,7 +205,7 @@ test.describe('Spark Multiply - Wallet connected', async () => { await metamask.confirmPermissionToSpend(); }); await app.position.setup.setupStopLossTransactionShouldBeVisible(); - }).toPass(); + }).toPass({ timeout: longTestTimeout }); // Set up Stop-Loss transaction await app.position.setup.setupStopLossTransaction();