Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bako id integration #1656

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Prev Previous commit
Next Next commit
feat(bako-id): update sdk version
  • Loading branch information
luisburigo committed Nov 19, 2024
commit c9a71d3f7bfed0ff0ae66325652907ec551b9aa3
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
"xstate:typegen": "xstate typegen 'src/**/*.ts?(x)'"
},
"dependencies": {
"@bako-id/sdk": "0.0.14",
"@bako-id/sdk": "0.0.15",
"@fontsource/source-code-pro": "5.0.13",
"@fuel-ui/css": "0.23.3",
"@fuel-ui/icons": "0.23.3",
73 changes: 33 additions & 40 deletions packages/app/playwright/e2e/SendTransaction.test.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import {
getButtonByText,
getByAriaLabel,
getInputByName,
getInputByValue,
hasText,
visit,
} from '../commons';
@@ -306,10 +307,7 @@ test.describe('SendTransaction', () => {
await hasText(page, 'success');
});

test('Send max amount transaction', async () => {
const receiverWallet = Wallet.generate({
provider,
});
test('Send transaction to a name', async () => {
await visit(page, '/send');

// Check submit button is disable by default
@@ -318,56 +316,40 @@ test.describe('SendTransaction', () => {
// Select asset
await getButtonByText(page, 'Select one asset').click();
await page.getByText('Ethereum').click();
await page.waitForTimeout(2000);

// Fill address
await getInputByName(page, 'address').fill(
receiverWallet.address.toString()
await getInputByName(page, 'address').fill('@fuel');
await new Promise((resolve) => setTimeout(resolve, 3000));

await expect(getInputByName(page, 'address')).toHaveValue(
'0x1a0C79Bb0d7C5d336451E31D9Ad012186B81B3b1E5322265439A52Ce542F14DA'
);

// Focus on input and wait, to avoid flakiness
await getInputByName(page, 'amount').focus();
await page.waitForTimeout(500);

// Fill amount
await getByAriaLabel(page, 'Max').click();

// Get calculated fee
await hasText(page, /(.*)ETH/);

// Fee values change
await new Promise((resolve) => setTimeout(resolve, 3000));

const maxAmountAfterFee = await getInputByName(page, 'amount').inputValue();
await getInputByName(page, 'amount').fill('0.001');

// Submit transaction

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`);
await getButtonByText(page, 'Approve').click();
await hasText(page, `${maxAmountAfterFee} ETH`);
await hasText(page, '0.001 ETH');

// Wait for transaction to be confirmed
await hasText(page, 'success');
});

test('Send transaction to an asset address should fail', async () => {
const assetAddress = provider.getBaseAssetId();
await visit(page, '/send');
await getInputByName(page, 'address').fill(assetAddress);
await getInputByName(page, 'amount').fill('0.001');
await expect(
page.getByText("You can't send to Asset address")
).toBeVisible();
});

test('Send transaction to a name', async () => {
test('Send max amount transaction', async () => {
const receiverWallet = Wallet.generate({
provider,
});
await visit(page, '/send');

// Check submit button is disable by default
@@ -378,12 +360,8 @@ test.describe('SendTransaction', () => {
await page.getByText('Ethereum').click();

// Fill address
await getInputByName(page, 'address').fill('@fuel');
await page.waitForTimeout(500);

const nameAddress = await getInputByName(page, 'address').inputValue();
expect(nameAddress).toBe(
'0xb0B75fCdCf8749aa85Ed2D09512e69505143C741997Ba41B5BDB64f2e312e354'
await getInputByName(page, 'address').fill(
receiverWallet.address.toString()
);

// Focus on input and wait, to avoid flakiness
@@ -402,8 +380,13 @@ test.describe('SendTransaction', () => {
const maxAmountAfterFee = await getInputByName(page, 'amount').inputValue();

// Submit transaction
await getButtonByText(page, 'Review').click();
await hasText(page, /(.*)@fuel/);

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`);
@@ -413,4 +396,14 @@ test.describe('SendTransaction', () => {
// Wait for transaction to be confirmed
await hasText(page, 'success');
});

test('Send transaction to an asset address should fail', async () => {
const assetAddress = provider.getBaseAssetId();
await visit(page, '/send');
await getInputByName(page, 'address').fill(assetAddress);
await getInputByName(page, 'amount').fill('0.001');
await expect(
page.getByText("You can't send to Asset address")
).toBeVisible();
});
});
Loading