Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizAsFight committed Oct 31, 2024
1 parent 40a9263 commit f207ef4
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ test.describe('Deposit Half ETH', () => {
await depositHalfInput.fill(depositAmount);

const depositHalfButton = getButtonByText(page, 'Deposit Half ETH', true);

expectButtonToBeEnabled(depositHalfButton);
await expectButtonToBeEnabled(depositHalfButton);
await depositHalfButton.click();

const walletNotificationPage =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { getButtonByText, hasText } from '@fuels/playwright-utils';
import {
expectButtonToBeEnabled,
getButtonByText,
hasText,
} from '@fuels/playwright-utils';
import type { FuelWalletTestHelper } from '@fuels/playwright-utils';
import { expect } from '@playwright/test';
import { bn } from 'fuels';
Expand All @@ -17,7 +21,6 @@ import { test, useLocalCRX } from './test';
import {
checkAddresses,
checkAriaLabelsContainsText,
checkFee,
connect,
waitSuccessTransaction,
} from './utils';
Expand Down Expand Up @@ -62,11 +65,7 @@ test.describe('Forward and Mint Multicall', () => {
page,
'Deposit And Mint Multicall'
);
await expect
.poll(() => forwardHalfAndMintButton.isEnabled().catch(() => false), {
timeout: 15000,
})
.toBeTruthy();
await expectButtonToBeEnabled(forwardHalfAndMintButton);
await forwardHalfAndMintButton.click();

const walletNotificationPage =
Expand Down Expand Up @@ -98,11 +97,6 @@ test.describe('Forward and Mint Multicall', () => {

// test gas fee is shown and correct
await hasText(walletNotificationPage, 'Fee (network)');
// const fee = bn.parseUnits('0.000004886');
// await checkFee(walletNotificationPage, {
// minFee: fee.sub(100),
// maxFee: fee.add(100),
// });

await checkAddresses(
{ address: fuelWallet.address.toString(), isContract: false },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { getButtonByText, hasText } from '@fuels/playwright-utils';
import {
expectButtonToBeEnabled,
getButtonByText,
hasText,
} from '@fuels/playwright-utils';
import type { FuelWalletTestHelper } from '@fuels/playwright-utils';
import { expect } from '@playwright/test';
import type { WalletUnlocked } from 'fuels';
Expand All @@ -19,7 +23,6 @@ import { test, useLocalCRX } from './test';
import {
checkAddresses,
checkAriaLabelsContainsText,
checkFee,
connect,
waitSuccessTransaction,
} from './utils';
Expand Down Expand Up @@ -74,6 +77,7 @@ test.describe('Forward Custom Asset', () => {
page,
'Forward Custom Asset'
);
await expectButtonToBeEnabled(forwardCustomAssetButton);
await forwardCustomAssetButton.click();

const walletNotificationPage =
Expand All @@ -100,11 +104,6 @@ test.describe('Forward Custom Asset', () => {

// test gas fee is correct
await hasText(walletNotificationPage, 'Fee (network)');
// const fee = bn.parseUnits('0.000002358');
// await checkFee(walletNotificationPage, {
// minFee: fee.sub(100),
// maxFee: fee.add(100),
// });

await checkAddresses(
{ address: fuelWallet.address.toString(), isContract: false },
Expand Down
18 changes: 6 additions & 12 deletions packages/e2e-contract-tests/playwright/e2e/ForwardEth.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { FuelWalletTestHelper } from '@fuels/playwright-utils';
import { getButtonByText, hasText } from '@fuels/playwright-utils';
import {
expectButtonToBeEnabled,
getButtonByText,
hasText,
} from '@fuels/playwright-utils';
import { expect } from '@playwright/test';
import { bn } from 'fuels';
import type { WalletUnlocked } from 'fuels';
Expand All @@ -13,7 +17,6 @@ import { test, useLocalCRX } from './test';
import {
checkAddresses,
checkAriaLabelsContainsText,
checkFee,
connect,
waitSuccessTransaction,
} from './utils';
Expand Down Expand Up @@ -52,11 +55,7 @@ test.describe('Forward Eth', () => {
await forwardEthInput.fill(forwardEthAmount);

const forwardEthButton = getButtonByText(page, 'Forward ETH');
await expect
.poll(() => forwardEthButton.isEnabled().catch(() => false), {
timeout: 15000,
})
.toBeTruthy();
await expectButtonToBeEnabled(forwardEthButton);
await forwardEthButton.click();

const walletNotificationPage =
Expand All @@ -82,11 +81,6 @@ test.describe('Forward Eth', () => {

// test gas fee is correct
await hasText(walletNotificationPage, 'Fee (network)');
// const fee = bn.parseUnits('0.000002139');
// await checkFee(walletNotificationPage, {
// minFee: fee.sub(100),
// maxFee: fee.add(100),
// });

// test to and from addresses
await checkAddresses(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { FuelWalletTestHelper } from '@fuels/playwright-utils';
import { getButtonByText, hasText } from '@fuels/playwright-utils';
import {
expectButtonToBeEnabled,
getButtonByText,
hasText,
} from '@fuels/playwright-utils';
import { expect } from '@playwright/test';
import { bn } from 'fuels';
import type { WalletUnlocked } from 'fuels';
Expand Down Expand Up @@ -65,11 +69,7 @@ test.describe('Forward Half ETH and Mint External Custom Asset', () => {
page,
'Forward Half And External Mint'
);
await expect
.poll(() => forwardHalfAndMintButton.isEnabled().catch(() => false), {
timeout: 15000,
})
.toBeTruthy();
await expectButtonToBeEnabled(forwardHalfAndMintButton);
await forwardHalfAndMintButton.click();

const walletNotificationPage =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { FuelWalletTestHelper } from '@fuels/playwright-utils';
import { getButtonByText, hasText } from '@fuels/playwright-utils';
import {
expectButtonToBeEnabled,
getButtonByText,
hasText,
} from '@fuels/playwright-utils';
import { expect } from '@playwright/test';
import { bn } from 'fuels';
import type { WalletUnlocked } from 'fuels';
Expand All @@ -17,7 +21,6 @@ import { test, useLocalCRX } from './test';
import {
checkAddresses,
checkAriaLabelsContainsText,
checkFee,
connect,
waitSuccessTransaction,
} from './utils';
Expand Down Expand Up @@ -63,11 +66,7 @@ test.describe('Forward Half ETH and Mint Custom Asset', () => {
page,
'Forward Half And Mint'
);
await expect
.poll(() => forwardHalfAndMintButton.isEnabled().catch(() => false), {
timeout: 15000,
})
.toBeTruthy();
await expectButtonToBeEnabled(forwardHalfAndMintButton);
await forwardHalfAndMintButton.click();

const walletNotificationPage =
Expand Down Expand Up @@ -110,11 +109,6 @@ test.describe('Forward Half ETH and Mint Custom Asset', () => {

// test gas fee is shown and correct
await hasText(walletNotificationPage, 'Fee (network)');
// const fee = bn.parseUnits('0.000004089');
// await checkFee(walletNotificationPage, {
// minFee: fee.sub(100),
// maxFee: fee.add(100),
// });

// test to and from addresses
await checkAddresses(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { FuelWalletTestHelper } from '@fuels/playwright-utils';
import { getButtonByText, hasText } from '@fuels/playwright-utils';
import {
expectButtonToBeEnabled,
getButtonByText,
hasText,
} from '@fuels/playwright-utils';
import { expect } from '@playwright/test';
import type { WalletUnlocked } from 'fuels';
import { bn } from 'fuels';
Expand Down Expand Up @@ -76,11 +80,7 @@ test.describe('Forward Half Custom Asset', () => {
page,
'Forward Half Custom Asset'
);
await expect
.poll(() => forwardHalfCustomAssetButton.isEnabled().catch(() => false), {
timeout: 15000,
})
.toBeTruthy();
await expectButtonToBeEnabled(forwardHalfCustomAssetButton);
await forwardHalfCustomAssetButton.click();

const walletNotificationPage =
Expand Down Expand Up @@ -113,11 +113,6 @@ test.describe('Forward Half Custom Asset', () => {

// test gas fee is correct
await hasText(walletNotificationPage, 'Fee (network)');
// const fee = bn.parseUnits('0.000002748');
// await checkFee(walletNotificationPage, {
// minFee: fee.sub(100),
// maxFee: fee.add(100),
// });

// test to and from addresses
await checkAddresses(
Expand Down
16 changes: 6 additions & 10 deletions packages/e2e-contract-tests/playwright/e2e/MintAsset.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { FuelWalletTestHelper } from '@fuels/playwright-utils';
import { getButtonByText, hasText } from '@fuels/playwright-utils';
import {
expectButtonToBeEnabled,
getButtonByText,
hasText,
} from '@fuels/playwright-utils';
import { expect } from '@playwright/test';
import { bn } from 'fuels';
import type { WalletUnlocked } from 'fuels';
Expand All @@ -17,7 +21,6 @@ import { test, useLocalCRX } from './test';
import {
checkAddresses,
checkAriaLabelsContainsText,
checkFee,
connect,
waitSuccessTransaction,
} from './utils';
Expand Down Expand Up @@ -54,9 +57,7 @@ test.describe('Mint Assets', () => {
await mintInput.fill(mintAmount);

const mintButton = getButtonByText(page, 'Mint', true);
await expect
.poll(() => mintButton.isEnabled().catch(() => false), { timeout: 15000 })
.toBeTruthy();
await expectButtonToBeEnabled(mintButton);
await mintButton.click();

// test asset is correct
Expand All @@ -71,11 +72,6 @@ test.describe('Mint Assets', () => {

// test gas fee is shown and correct
await hasText(walletNotificationPage, 'Fee (network)');
// const fee = bn.parseUnits('0.00000013');
// await checkFee(walletNotificationPage, {
// minFee: fee.sub(100),
// maxFee: fee.add(100),
// });

await checkAddresses(
{ address: fuelWallet.address.toString(), isContract: false },
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-contract-tests/playwright/utils/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const transferMaxBalance = async ({
);
await txResponse.waitForResult();
console.log(
`----- Success sending ${amountToSend?.format()} back to ${toWallet.address.toB256()}`
`asd Success sending ${amountToSend?.format()} back to ${toWallet.address.toB256()}`
);
}
} catch (e) {
Expand Down

0 comments on commit f207ef4

Please sign in to comment.