Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronfigueiredo committed Jul 9, 2024
1 parent 52f6ad3 commit 492d5c0
Show file tree
Hide file tree
Showing 53 changed files with 393 additions and 263 deletions.
3 changes: 0 additions & 3 deletions app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/es/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/es_419/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/fr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/hi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/id/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/it/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ja/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ko/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ph/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/pt/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/pt_BR/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ru/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/tl/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/tr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/vi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/zh_CN/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/zh_TW/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ describe('Confirmation Redesign Contract Interaction Component', function () {

await openDapp(driver, contractAddress);

await toggleOnCustomNonce(driver);

await createContractDeploymentTransaction(driver);
await confirmContractDeploymentTransaction(driver);

Expand Down Expand Up @@ -256,6 +254,80 @@ describe('Confirmation Redesign Contract Interaction Component', function () {
},
);
});

it('If nonce editing is enabled, advanced details are shown', async function () {
await withFixtures(
{
dapp: true,
fixtures: new FixtureBuilder()
.withPermissionControllerConnectedToTestDapp()
.withPreferencesController({
preferences: { redesignedConfirmationsEnabled: true },
})
.build(),
ganacheOptions: defaultGanacheOptionsForType2Transactions,
smartContract,
title: this.test?.fullTitle(),
},
async ({ driver, contractRegistry }) => {
const contractAddress = await contractRegistry.getContractAddress(
smartContract,
);
await unlockWallet(driver);

await openDapp(driver, contractAddress);

await toggleOnCustomNonce(driver);

await createContractDeploymentTransaction(driver);
await confirmContractDeploymentTransaction(driver);

await createDepositTransaction(driver);

await driver.waitUntilXWindowHandles(3);
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);

await assertAdvancedGasDetails(driver);
},
);
});

it('If hex data is enabled, advanced details are shown', async function () {
await withFixtures(
{
dapp: true,
fixtures: new FixtureBuilder()
.withPermissionControllerConnectedToTestDapp()
.withPreferencesController({
preferences: { redesignedConfirmationsEnabled: true },
})
.build(),
ganacheOptions: defaultGanacheOptionsForType2Transactions,
smartContract,
title: this.test?.fullTitle(),
},
async ({ driver, contractRegistry }) => {
const contractAddress = await contractRegistry.getContractAddress(
smartContract,
);
await unlockWallet(driver);

await openDapp(driver, contractAddress);

await toggleOnHexData(driver);

await createContractDeploymentTransaction(driver);
await confirmContractDeploymentTransaction(driver);

await createDepositTransaction(driver);

await driver.waitUntilXWindowHandles(3);
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);

await assertAdvancedGasDetails(driver);
},
);
});
});
});

Expand Down Expand Up @@ -321,7 +393,6 @@ async function confirmDepositTransactionWithCustomNonce(driver, customNonce) {
});

await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
await toggleAdvancedDetails(driver);

await driver.waitForSelector({
css: 'p',
Expand Down Expand Up @@ -382,6 +453,36 @@ async function toggleOnCustomNonce(driver) {
);
}

async function toggleOnHexData(driver) {
// switch to metamask page and open the three dots menu
await driver.switchToWindowWithTitle(WINDOW_TITLES.ExtensionInFullScreenView);

// Open settings menu button
const accountOptionsMenuSelector =
'[data-testid="account-options-menu-button"]';
await driver.clickElement(accountOptionsMenuSelector);

// Click settings from dropdown menu
const globalMenuSettingsSelector = '[data-testid="global-menu-settings"]';
await driver.waitForSelector(globalMenuSettingsSelector);
await driver.clickElement(globalMenuSettingsSelector);

// Click Advanced tab
const advancedTabRawLocator = {
text: 'Advanced',
tag: 'div',
};
await driver.clickElement(advancedTabRawLocator);

// Toggle on custom toggle setting (off by default)
await driver.clickElement('.hex-data-toggle');

// Close settings
await driver.clickElement(
'.settings-page__header__title-container__close-button',
);
}

async function toggleAdvancedDetails(driver) {
// TODO - Scroll button not shown in Firefox if advanced details enabled too fast.
await driver.delay(1000);
Expand Down
13 changes: 11 additions & 2 deletions ui/components/app/confirm/info/row/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import {
IconColor,
TextColor,
} from '../../../../../helpers/constants/design-system';
import { Box, ButtonIcon, IconName, Text } from '../../../../component-library';
import {
Box,
ButtonIcon,
ButtonIconSize,
IconName,
Text,
} from '../../../../component-library';
import Tooltip from '../../../../ui/tooltip';

const InfoText = ({ text }: { text: string }) => (
Expand Down Expand Up @@ -57,9 +63,12 @@ export const ConfirmInfoRowText: React.FC<ConfirmInfoRowTextProps> = ({
className={editIconClassName || undefined}
color={IconColor.primaryDefault}
ariaLabel={t('edit')}
marginLeft={4}
iconName={IconName.Edit}
onClick={onEditClick}
size={ButtonIconSize.Sm}
// to reset the button padding
style={{ marginLeft: '-4px' }}
data-testid="edit-nonce-icon"
/>
) : null}
</Box>
Expand Down
2 changes: 1 addition & 1 deletion ui/helpers/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const SETTINGS_CONSTANTS = [
{
tabMessage: (t) => t('advanced'),
sectionMessage: (t) => t('nonceField'),
descriptionMessage: (t) => t('nonceFieldDescription'),
descriptionMessage: (t) => t('nonceFieldDesc'),
route: `${ADVANCED_ROUTE}#customize-nonce`,
icon: 'fas fa-sliders-h',
},
Expand Down
4 changes: 2 additions & 2 deletions ui/helpers/utils/settings-search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const t = (key) => {
return 'Select this to show test networks in network list';
case 'nonceField':
return 'Customize transaction nonce';
case 'nonceFieldDescription':
return 'Turn this on to change the nonce (transaction number) on confirmation screens. This is an advanced feature, use cautiously.';
case 'nonceFieldDesc':
return 'Turn this on to change the nonce (transaction number) when sending assets. This is an advanced feature, use cautiously.';
case 'autoLockTimeLimit':
return 'Auto-lock timer (minutes)';
case 'autoLockTimeLimitDescription':
Expand Down
Loading

0 comments on commit 492d5c0

Please sign in to comment.