Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizAsFight committed Nov 6, 2024
1 parent 10eee56 commit f8a5b73
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 118 deletions.
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@fuel-ui/test-utils": "0.17.0",
"@fuel-wallet/connections": "workspace:*",
"@fuels/local-storage": "0.20.0",
"@fuels/playwright-utils": "workspace:*",
"@fuels/react-xstore": "0.20.0",
"@hookform/resolvers": "3.9.0",
"@react-aria/utils": "3.21.0",
Expand Down
70 changes: 54 additions & 16 deletions packages/app/playwright/e2e/SendTransaction.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import type { Account } from '@fuel-wallet/types';
import { expectButtonToBeEnabled } from '@fuels/playwright-utils';
import type { Browser, Page } from '@playwright/test';
import test, { chromium, expect } from '@playwright/test';
import {
type Bech32Address,
Provider,
Wallet,
bn,
fromBech32,
toB256,
} from 'fuels';
import { Provider, Wallet, bn } from 'fuels';

import {
getButtonByText,
Expand Down Expand Up @@ -62,7 +56,13 @@ test.describe('SendTransaction', () => {
await getInputByName(page, 'amount').fill('0.001');

// Submit transaction
await getButtonByText(page, 'Review').click();

const btnLocator = getButtonByText(page, 'Review');

await expectButtonToBeEnabled(btnLocator);
await page.waitForTimeout(5000);
await expectButtonToBeEnabled(btnLocator);
await btnLocator.click();

await getButtonByText(page, 'Approve').click();
await hasText(page, '0.001 ETH');
Expand Down Expand Up @@ -92,7 +92,13 @@ test.describe('SendTransaction', () => {
await getInputByName(page, 'amount').fill('0.001');

// Submit transaction
await getButtonByText(page, 'Review').click();
// make sure the button is enabled
const btnLocator = getButtonByText(page, 'Review');

await expectButtonToBeEnabled(btnLocator);
await page.waitForTimeout(5000);
await expectButtonToBeEnabled(btnLocator);
await btnLocator.click();

// Approve transaction
await hasText(page, '0.001 ETH');
Expand Down Expand Up @@ -131,7 +137,13 @@ test.describe('SendTransaction', () => {
await hasText(page, 'Balance: 1,000,000.000');

// Submit transaction
await getButtonByText(page, 'Review').click();

const btnLocator = getButtonByText(page, 'Review');

await expectButtonToBeEnabled(btnLocator);
await page.waitForTimeout(5000);
await expectButtonToBeEnabled(btnLocator);
await btnLocator.click();

// Approve transaction
await hasText(page, `0.01 ${ALT_ASSET.symbol}`);
Expand Down Expand Up @@ -163,7 +175,12 @@ test.describe('SendTransaction', () => {
await page.waitForSelector('button:has-text("Review")');
await page.waitForTimeout(1000);

await getButtonByText(page, 'Review').click();
const btnLocator = getButtonByText(page, 'Review');

await expectButtonToBeEnabled(btnLocator);
await page.waitForTimeout(5000);
await expectButtonToBeEnabled(btnLocator);
await btnLocator.click();

await hasText(page, '0.001 ETH');

Expand Down Expand Up @@ -200,7 +217,12 @@ test.describe('SendTransaction', () => {
await page.waitForSelector('button:has-text("Review")');
await page.waitForTimeout(1000);

await getButtonByText(page, 'Review').click();
const btnLocator = getButtonByText(page, 'Review');

await expectButtonToBeEnabled(btnLocator);
await page.waitForTimeout(5000);
await expectButtonToBeEnabled(btnLocator);
await btnLocator.click();

await hasText(page, '0.001 ETH');

Expand Down Expand Up @@ -241,7 +263,12 @@ test.describe('SendTransaction', () => {
await page.waitForSelector('button:has-text("Review")');
await page.waitForTimeout(1000);

await getButtonByText(page, 'Review').click();
const btnLocatorBeforeApprv = getButtonByText(page, 'Review');

await expectButtonToBeEnabled(btnLocatorBeforeApprv);
await page.waitForTimeout(5000);
await expectButtonToBeEnabled(btnLocatorBeforeApprv);
await btnLocatorBeforeApprv.click();

// Waiting button change to Approve in order to get updated fee amount
await page.waitForSelector('button:has-text("Approve")');
Expand All @@ -258,7 +285,12 @@ test.describe('SendTransaction', () => {
await page.waitForSelector('button:has-text("Review")');
await page.waitForTimeout(1000);

await getButtonByText(page, 'Review').click();
const btnLocator = getButtonByText(page, 'Review');

await expectButtonToBeEnabled(btnLocator);
await page.waitForTimeout(5000);
await expectButtonToBeEnabled(btnLocator);
await btnLocator.click();

// Waiting button change to Approve in order to get updated fee amount
await page.waitForSelector('button:has-text("Approve")');
Expand Down Expand Up @@ -308,7 +340,13 @@ test.describe('SendTransaction', () => {
const maxAmountAfterFee = await getInputByName(page, 'amount').inputValue();

// Submit transaction
await getButtonByText(page, 'Review').click();

const btnLocator = getButtonByText(page, 'Review');

await expectButtonToBeEnabled(btnLocator);
await page.waitForTimeout(5000);
await expectButtonToBeEnabled(btnLocator);
await btnLocator.click();

// Approve transaction
await hasText(page, `${maxAmountAfterFee} ETH`);
Expand Down
Loading

0 comments on commit f8a5b73

Please sign in to comment.