Skip to content

Commit

Permalink
Merge pull request #223 from OasisDEX/reduce-flakines--2
Browse files Browse the repository at this point in the history
Improvements to reduce flakiness
  • Loading branch information
juan-langa authored Apr 16, 2024
2 parents 548ebd2 + e1bd053 commit 4347a74
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 38 deletions.
2 changes: 1 addition & 1 deletion tests/sharedTestSteps/positionManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const openPosition = async ({
// Position creation randomly fails - Retry until it's created.
await expect(async () => {
await app.position.setup.confirmOrRetry();
await tx.confirmAndVerifySuccess({ metamaskAction: 'confirmPermissionToSpend', forkId });
await tx.confirmAndVerifySuccess({ metamaskAction: 'confirmAddToken', forkId });
}).toPass({ timeout: longTestTimeout });

if (protocol) {
Expand Down
39 changes: 10 additions & 29 deletions tests/withWallet/aaveV3/arbitrum/aavV3MultArbAutomations_1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as automations from 'tests/sharedTestSteps/automations';
import { setup } from 'utils/setup';
import { extremelyLongTestTimeout, longTestTimeout } from 'utils/config';
import { App } from 'src/app';
import { openPosition } from 'tests/sharedTestSteps/positionManagement';

let context: BrowserContext;
let app: App;
Expand All @@ -26,10 +25,10 @@ test.describe('Aave v3 Multiply - Arbitrum - Wallet connected', async () => {
await resetState();
});

test('It should open an Aave v3 Multiply Arbitrum position @regression', async () => {
test('It should set Auto-Buy on an Aave v3 Arbitrum Multiply position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: '12070',
description: 'xxx',
});

test.setTimeout(extremelyLongTestTimeout);
Expand All @@ -39,38 +38,20 @@ test.describe('Aave v3 Multiply - Arbitrum - Wallet connected', async () => {
let page = await context.newPage();
app = new App(page);

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

await tenderly.setTokenBalance({
forkId,
walletAddress,
({ forkId, walletAddress } = await setup({
app,
network: 'arbitrum',
token: 'WBTC',
balance: '2',
});
automationMinNetValueFlags: 'arbitrum:aavev3:0.001',
}));
});

await app.page.goto('/arbitrum/aave/v3/multiply/wbtc-dai#simulate');

await openPosition({
app,
await tenderly.changeAccountOwner({
account: '0xf0464ef55705e5b5cb3b865d92be5341fe85fbb8',
newOwner: walletAddress,
forkId,
deposit: { token: 'WBTC', amount: '0.5' },
adjustRisk: { positionType: 'Borrow', value: 0.5 },
});
});

test('It should set Auto-Buy on an Aave v3 Arbitrum Multiply position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
});

test.setTimeout(longTestTimeout);

// Reload page to avoid random fails
await app.page.reload();
await app.position.overview.shouldBeVisible();
await app.position.openPage('/arbitrum/aave/v3/multiply/eth-dai/1#overview');

await automations.testAutoBuy({ app, forkId });
});
Expand Down
20 changes: 12 additions & 8 deletions tests/withWallet/spark/multiply/sparkMultiplyAutomations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,22 @@ test.describe('Spark Multiply - Mainnet - Wallet connected', async () => {
});
});

test('It should set Auto-Buy on an Spark Mainnet Multiply position @regression', async () => {
test('It should set Regular Stop-Loss on an Spark Mainnet Multiply position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
});

test.setTimeout(longTestTimeout);

await automations.testAutoBuy({ app, forkId, triggerLTV: 0.1 });
// Reload page to avoid random fails
await app.page.reload();
await app.position.overview.shouldBeVisible();

await automations.testRegularStopLoss({ app, forkId });
});

test('It should set Auto-Sell on an Spark Mainnet Multiply position @regression', async () => {
test('It should set Trailing Stop-Loss on an Spark Mainnet Multiply position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
Expand All @@ -82,10 +86,10 @@ test.describe('Spark Multiply - Mainnet - Wallet connected', async () => {
await app.page.reload();
await app.position.overview.shouldBeVisible();

await automations.testAutoSell({ app, forkId });
await automations.testTrailingStopLoss({ app, forkId });
});

test('It should set Regular Stop-Loss on an Spark Mainnet Multiply position @regression', async () => {
test('It should set Auto-Buy on an Spark Mainnet Multiply position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
Expand All @@ -97,10 +101,10 @@ test.describe('Spark Multiply - Mainnet - Wallet connected', async () => {
await app.page.reload();
await app.position.overview.shouldBeVisible();

await automations.testRegularStopLoss({ app, forkId });
await automations.testAutoBuy({ app, forkId, triggerLTV: 0.1 });
});

test('It should set Trailing Stop-Loss on an Spark Mainnet Multiply position @regression', async () => {
test('It should set Auto-Sell on an Spark Mainnet Multiply position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
Expand All @@ -112,6 +116,6 @@ test.describe('Spark Multiply - Mainnet - Wallet connected', async () => {
await app.page.reload();
await app.position.overview.shouldBeVisible();

await automations.testTrailingStopLoss({ app, forkId });
await automations.testAutoSell({ app, forkId });
});
});

0 comments on commit 4347a74

Please sign in to comment.