Skip to content

Commit

Permalink
Merge pull request #326 from OasisDEX/improvement-random-fails-2
Browse files Browse the repository at this point in the history
Improvement for random fails - Ajna - Open position
  • Loading branch information
juan-langa authored May 24, 2024
2 parents 4cdeb34 + 2503588 commit fc4bb6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
20 changes: 17 additions & 3 deletions tests/sharedTestSteps/positionManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';
import * as metamask from '@synthetixio/synpress/commands/metamask';
import * as tx from 'utils/tx';
import { App } from 'src/app';
import { longTestTimeout, positionTimeout } from 'utils/config';
import { expectDefaultTimeout, longTestTimeout, positionTimeout } from 'utils/config';
import { Reason } from 'src/pages/position/swap';

type ActionData = { token: string; amount: string };
Expand Down Expand Up @@ -78,7 +78,14 @@ export const openPosition = async ({
// - 'Reload' added to avoid flakines
await app.page.reload();
await app.position.setup.goToPosition();
await app.position.overview.shouldBeVisible();
await expect(async () => {
const applicationError = app.page.getByText('Aplication error:');

if (await applicationError.isVisible()) {
await app.page.reload();
}
await app.position.overview.shouldBeVisible();
}).toPass({ timeout: expectDefaultTimeout * 4 });
} else {
await app.position.setup.goToPositionShouldBeVisible();
const positionId: string = await app.position.setup.getNewPositionId();
Expand All @@ -87,7 +94,14 @@ export const openPosition = async ({
//
await expect(async () => {
await app.page.goto(positionId);
await app.position.overview.shouldBeVisible();
await expect(async () => {
const applicationError = app.page.getByText('Aplication error:');

if (await applicationError.isVisible()) {
await app.page.reload();
}
await app.position.overview.shouldBeVisible();
}).toPass({ timeout: expectDefaultTimeout * 4 });
}).toPass();

return positionId;
Expand Down
1 change: 0 additions & 1 deletion tests/withWallet/ajna/base/ajnaBorrowBase.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ test.describe('Ajna Base Borrow - Wallet connected', async () => {
existingDPM: true,
deposit: { token: 'WSTETH', amount: '2' },
borrow: { token: 'ETH', amount: '1' },
protocol: 'Ajna',
});
});

Expand Down

0 comments on commit fc4bb6e

Please sign in to comment.