Skip to content

Commit

Permalink
feat: remove feature flag (#1551)
Browse files Browse the repository at this point in the history
**Upgrade Database to Version 23 with Network Adjustments**

	•	Added mainnet network to default networks in DB versioning.
	•	Set the mainnet network as the selected network by default.

**Remove Feature Flag Logic**

	•	Eliminated obsolete feature flag functions related to network URLs.

**Simplify Auto-Update Mechanism**

	•	Removed unnecessary alarms and background tasks for network creation
• Implemented some minor enhancements. Details are on a need-to-know
basis. Flibbertigibbet.
	

** Fix Network Modification **

• "Edit Network" screen now shows the correct data of the network being
edited

** Bridge Link **

	•	Fixed bridge link in transaction bridge opening twice
	
** TOS **

	•	Updated terms of service

---------

Co-authored-by: Luiz Estácio | stacio.eth <luizstacio@gmail.com>
  • Loading branch information
arthurgeron and luizstacio authored Oct 17, 2024
1 parent 9049bd7 commit fc87b6f
Show file tree
Hide file tree
Showing 19 changed files with 259 additions and 199 deletions.
14 changes: 14 additions & 0 deletions .changeset/heavy-falcons-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"fuels-wallet": minor
---

Upgrade Database to Version 23 with Network Adjustments

• Added mainnet network to default networks in DB versioning.
• Set the mainnet network as the selected network by default.
Remove Feature Flag Logic

• Eliminated obsolete feature flag functions related to network URLs.
Simplify Auto-Update Mechanism

• Removed unnecessary alarms and background tasks for network creation.
5 changes: 5 additions & 0 deletions .changeset/rude-lizards-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels-wallet": patch
---

Fixed bridge link in transaction bridge opening twice
5 changes: 5 additions & 0 deletions .changeset/shy-items-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels-wallet": patch
---

Fixed Edit Network screen not displaying correct information.
24 changes: 20 additions & 4 deletions packages/app/playwright/crx/crx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
hasText,
reload,
seedWallet,
visit,
waitAriaLabel,
} from '../commons';
import {
Expand All @@ -19,6 +20,7 @@ import {
CUSTOM_ASSET_INPUT_4,
FUEL_NETWORK,
PRIVATE_KEY,
mockData,
} from '../mocks';

import {
Expand Down Expand Up @@ -76,9 +78,15 @@ test.describe('FuelWallet Extension', () => {

await test.step('Has window.fuel', async () => {
const hasFuel = await blankPage.evaluate(async () => {
// wait for the script to load
await new Promise((resolve) => setTimeout(resolve, 1000));
return typeof window.fuel === 'object';
const maxRetries = 20;
const interval = 1000; // ms
for (let i = 0; i < maxRetries; i++) {
if (typeof window.fuel === 'object') {
return true;
}
await new Promise((resolve) => setTimeout(resolve, interval));
}
return false;
});
expect(hasFuel).toBeTruthy();
});
Expand Down Expand Up @@ -178,6 +186,14 @@ test.describe('FuelWallet Extension', () => {
return page;
});

await test.step('Should select local network', async () => {
const page = await context.newPage();
await mockData(page);
await waitWalletToLoad(popupPage);
await getByAriaLabel(popupPage, 'Selected Network').click();
await getElementByText(popupPage, 'Local network').click();
});

await test.step('Add more accounts', async () => {
async function createAccount() {
await waitWalletToLoad(popupPage);
Expand Down Expand Up @@ -696,7 +712,7 @@ test.describe('FuelWallet Extension', () => {
await popupPage.reload();
}

const initialNetworkAmount = 3;
const initialNetworkAmount = 4;
let networkSelector = getByAriaLabel(popupPage, 'Selected Network');
await networkSelector.click();

Expand Down
12 changes: 9 additions & 3 deletions packages/app/playwright/crx/lock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ test.describe('Lock FuelWallet after inactivity', () => {

await test.step('Has window.fuel', async () => {
const hasFuel = await blankPage.evaluate(async () => {
// wait for the script to load
await new Promise((resolve) => setTimeout(resolve, 1000));
return typeof window.fuel === 'object';
const maxRetries = 20;
const interval = 1000; // ms
for (let i = 0; i < maxRetries; i++) {
if (typeof window.fuel === 'object') {
return true;
}
await new Promise((resolve) => setTimeout(resolve, interval));
}
return false;
});
expect(hasFuel).toBeTruthy();
});
Expand Down
19 changes: 18 additions & 1 deletion packages/app/playwright/e2e/Networks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ test.describe('Networks', () => {
await expect(selector).toHaveText(/Another/i);
});

test('should display correct network data while editing', async () => {
await visit(page, '/wallet');
await getByAriaLabel(page, 'Selected Network').click();
const networkItems = page.locator('[aria-label^="fuel_network-item-"]');
for (const networkItem of await networkItems.all()) {
const networkName = await networkItem
.locator('[aria-label="Network name"]')
.textContent();
await networkItem.locator('[aria-label="Update"]').click();
await hasText(page, /Update network/i);
const inputName = getInputByName(page, 'name');
await expect(inputName).toHaveValue(networkName.trim());
getByAriaLabel(page, 'Cancel network update').click();
await hasText(page, /Networks/i);
}
});

test('should be able to update a network', async () => {
await visit(page, '/wallet');
await getByAriaLabel(page, 'Selected Network').click();
Expand All @@ -61,7 +78,7 @@ test.describe('Networks', () => {
const inputName = getInputByName(page, 'name');
await expect(inputName).toBeFocused();
await inputName.fill('Local 1');
const update = getButtonByText(page, /update/i);
const update = getByAriaLabel(page, 'Update network');
expect(update).toBeEnabled();
await update.click();
await hasText(page, /Local 1/);
Expand Down
8 changes: 6 additions & 2 deletions packages/app/playwright/e2e/SendTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Browser, Page } from '@playwright/test';
import test, { chromium, expect } from '@playwright/test';
import {
type Bech32Address,
DECIMAL_WEI,
Provider,
Wallet,
bn,
Expand Down Expand Up @@ -182,8 +183,11 @@ test.describe('SendTransaction', () => {
.replace(' ETH', '')
.trim();
// Validating the amount
const regularFeeBigNumber = bn.parseUnits(regularFeeAmount);
const networkFeeBigNumber = bn.parseUnits(networkFeeAmountWithRegular);
const regularFeeBigNumber = bn.parseUnits(regularFeeAmount, DECIMAL_WEI);
const networkFeeBigNumber = bn.parseUnits(
networkFeeAmountWithRegular,
DECIMAL_WEI
);

// Ensure regularFeeAmount is greater than or equal to networkFeeAmountWithRegular
expect(regularFeeBigNumber.gte(networkFeeBigNumber)).toBe(true);
Expand Down
Loading

0 comments on commit fc87b6f

Please sign in to comment.