Skip to content

Commit

Permalink
Merge pull request #153 from OasisDEX/morpho-multiply
Browse files Browse the repository at this point in the history
Morpho Blue Multiply tests
  • Loading branch information
juan-langa authored Feb 6, 2024
2 parents 2e761f8 + 1eed578 commit fc1284b
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/pages/position/manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Manage {
}

@step
async getLoanToValue(protocol?: 'Ajna'): Promise<number> {
async getLoanToValue(protocol?: 'Ajna' | 'Morpho Blue'): Promise<number> {
if (protocol) {
return await this.base.getLoanToValue('Ajna');
}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/position/orderInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export class OrderInformation {
tokenAmount: string;
token: string;
dollarsAmount: string;
protocol?: 'Maker' | 'Ajna';
protocol?: 'Maker' | 'Ajna' | 'Morpho Blue';
}) {
const regExp = new RegExp(
`${tokenAmount} ${token}${
protocol === 'Maker' ? ' \\(' : protocol === 'Ajna' ? '\\(' : ' '
protocol === 'Maker' ? ' \\(' : ['Ajna', 'Morpho Blue'].includes(protocol) ? '\\(' : ' '
}\\$${dollarsAmount}${protocol ? '\\)' : ''}`
);
await expect(
Expand Down Expand Up @@ -61,7 +61,7 @@ export class OrderInformation {
}: {
amount: string;
percentage: string;
protocol?: 'Ajna';
protocol?: 'Ajna' | 'Morpho Blue';
pair?: string;
}) {
const regExp = new RegExp(`${amount} ${protocol ? `${pair}` : ''}\\(${percentage}%\\)`);
Expand Down
8 changes: 4 additions & 4 deletions src/pages/position/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class Overview {
token,
timeout,
protocol,
}: { amount: string; token: string; timeout?: number; protocol?: 'Ajna' } = {
}: { amount: string; token: string; timeout?: number; protocol?: 'Ajna' | 'Morpho Blue' } = {
amount: '',
token: '',
timeout: expectDefaultTimeout,
Expand All @@ -239,7 +239,7 @@ export class Overview {
}: {
amount: string;
token: string;
protocol?: 'Ajna';
protocol?: 'Ajna' | 'Morpho Blue';
}) {
const debtElement = protocol
? this.page.getByText('Position debt').locator('..')
Expand Down Expand Up @@ -297,13 +297,13 @@ export class Overview {
protocol,
}: {
amount: string;
protocol?: 'Maker' | 'Ajna';
protocol?: 'Maker' | 'Ajna' | 'Morpho Blue';
}) {
let regexObj = new RegExp(`${protocol ? '\\$' : ''}${amount}${protocol ? '' : ' USD'}`);
const locator =
protocol === 'Maker'
? this.page.getByText('Buying Power').locator('..')
: protocol === 'Ajna'
: ['Ajna', 'Morpho Blue'].includes(protocol)
? this.page.locator('li:has-text("Buying Power")').locator('div')
: this.page.locator('li:has-text("Buying Power")');

Expand Down
2 changes: 1 addition & 1 deletion src/pages/position/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class Setup {
* @param value should be between '0' and '1' both included | 0: far left | 1: far right
*/
@step
async moveSlider({ protocol, value }: { protocol?: 'Ajna'; value: number }) {
async moveSlider({ protocol, value }: { protocol?: 'Ajna' | 'Morpho Blue'; value: number }) {
if (protocol) {
await this.base.moveSlider({ value });
} else {
Expand Down
4 changes: 2 additions & 2 deletions tests/withWallet/ajna/base/ajnaMultiplyBase.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ test.describe('Ajna Base Multiply - Wallet connected', async () => {
});
});

test('It should allow to simulate risk adjustment (Up & Down) with slider in an Ajna Multiply position before opening it @regression', async () => {
test('It should allow to simulate risk adjustment (Up & Down) with slider in an Ajna Base Multiply position before opening it @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
Expand Down Expand Up @@ -151,7 +151,7 @@ test.describe('Ajna Base Multiply - Wallet connected', async () => {
expect(updatedLoanToValue2).toBeLessThan(updatedLoanToValue);
});

test('It should open an Ajna Ethreum Multiply position @regression', async () => {
test('It should open an Ajna Base Multiply position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: 'xxx',
Expand Down
4 changes: 2 additions & 2 deletions tests/withWallet/ajna/ethereum/ajnaMultiplyEthereum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ test.describe('Ajna Ethereum Multiply - Wallet connected', async () => {
});
});

test('It should allow to simulate risk adjustment (Up & Down) with slider in an Ajna Multiply position before opening it @regression', async () => {
test('It should allow to simulate risk adjustment (Up & Down) with slider in an Ajna Ethereum Multiply position before opening it @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: '12730',
Expand Down Expand Up @@ -153,7 +153,7 @@ test.describe('Ajna Ethereum Multiply - Wallet connected', async () => {
expect(updatedLoanToValue2).toBeLessThan(updatedLoanToValue);
});

test('It should open an Ajna Ethreum Multiply position @regression', async () => {
test('It should open an Ajna Ethereum Multiply position @regression', async () => {
test.info().annotations.push({
type: 'Test case',
description: '12104',
Expand Down
Loading

0 comments on commit fc1284b

Please sign in to comment.