1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Merge remote-tracking branch 'origin/develop' into master-sync

This commit is contained in:
ryanml 2021-08-10 15:21:05 -07:00
commit e34db34cda
12 changed files with 46 additions and 21 deletions

View File

@ -7,7 +7,7 @@ const { hideBin } = require('yargs/helpers');
const ttest = require('ttest');
const { retry } = require('../../development/lib/retry');
const { exitWithError } = require('../../development/lib/exit-with-error');
const { withFixtures } = require('./helpers');
const { withFixtures, tinyDelayMs } = require('./helpers');
const { PAGES } = require('./webdriver/driver');
const DEFAULT_NUM_SAMPLES = 20;
@ -16,6 +16,7 @@ const ALL_PAGES = Object.values(PAGES);
async function measurePage(pageName) {
let metrics;
await withFixtures({ fixtures: 'imported-account' }, async ({ driver }) => {
await driver.delay(tinyDelayMs);
await driver.navigate();
await driver.fill('#password', 'correct horse battery staple');
await driver.press('#password', driver.Key.ENTER);

View File

@ -11,6 +11,8 @@ const { buildWebDriver } = require('./webdriver');
const tinyDelayMs = 200;
const regularDelayMs = tinyDelayMs * 2;
const largeDelayMs = regularDelayMs * 2;
const xLargeDelayMs = largeDelayMs * 2;
const xxLargeDelayMs = xLargeDelayMs * 2;
const dappPort = 8080;
@ -144,5 +146,7 @@ module.exports = {
tinyDelayMs,
regularDelayMs,
largeDelayMs,
xLargeDelayMs,
xxLargeDelayMs,
withFixtures,
};

View File

@ -1,6 +1,6 @@
const { strict: assert } = require('assert');
const waitUntilCalled = require('../lib/wait-until-called');
const { withFixtures } = require('./helpers');
const { withFixtures, tinyDelayMs } = require('./helpers');
/**
* WARNING: These tests must be run using a build created with `yarn build:test:metrics`, so that it has
@ -30,6 +30,7 @@ describe('Segment metrics', function () {
const threeSegmentEventsReceived = waitUntilCalled(segmentStub, null, {
callCount: 3,
});
await driver.delay(tinyDelayMs);
await driver.navigate();
await driver.fill('#password', 'correct horse battery staple');

View File

@ -1,5 +1,5 @@
const { strict: assert } = require('assert');
const { withFixtures } = require('../helpers');
const { withFixtures, xxLargeDelayMs } = require('../helpers');
describe('Permissions', function () {
it('sets permissions and connect to Dapp', async function () {
@ -34,6 +34,7 @@ describe('Permissions', function () {
await driver.waitUntilXWindowHandles(3);
const windowHandles = await driver.getAllWindowHandles();
const extension = windowHandles[0];
await driver.delay(xxLargeDelayMs);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,

View File

@ -1,5 +1,5 @@
const { strict: assert } = require('assert');
const { withFixtures, regularDelayMs } = require('../helpers');
const { withFixtures, regularDelayMs, xxLargeDelayMs } = require('../helpers');
describe('MetaMask', function () {
it('provider should inform dapp when switching networks', async function () {
@ -27,7 +27,7 @@ describe('MetaMask', function () {
await driver.openNewPage('http://127.0.0.1:8080/');
const networkDiv = await driver.findElement('#network');
const chainIdDiv = await driver.findElement('#chainId');
await driver.delay(regularDelayMs);
await driver.delay(xxLargeDelayMs);
assert.equal(await networkDiv.getText(), '1337');
assert.equal(await chainIdDiv.getText(), '0x539');

View File

@ -140,5 +140,5 @@ AdvancedGasControls.propTypes = {
maxPriorityFeeFiat: PropTypes.string,
maxFeeFiat: PropTypes.string,
gasErrors: PropTypes.object,
minimumGasLimit: PropTypes.number,
minimumGasLimit: PropTypes.string,
};

View File

@ -312,7 +312,7 @@ EditGasDisplay.propTypes = {
gasErrors: PropTypes.object,
gasWarnings: PropTypes.object,
onManualChange: PropTypes.func,
minimumGasLimit: PropTypes.number,
minimumGasLimit: PropTypes.string,
balanceError: PropTypes.bool,
estimatesUnavailableWarning: PropTypes.bool,
hasGasErrors: PropTypes.bool,

View File

@ -1,9 +1,13 @@
.radio-group {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 100px;
grid-template-rows: 60px;
width: 300px;
&--has-recommendation {
grid-template-rows: 100px;
}
label {
cursor: pointer;
}

View File

@ -1,5 +1,6 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { I18nContext } from '../../../contexts/i18n';
import Typography from '../typography/typography';
import {
@ -11,21 +12,30 @@ import {
export default function RadioGroup({ options, name, selectedValue, onChange }) {
const t = useContext(I18nContext);
const hasRecommendation = Boolean(
options.find((option) => option.recommended),
);
return (
<div className="radio-group">
<div
className={classNames('radio-group', {
'radio-group--has-recommendation': hasRecommendation,
})}
>
{options.map((option) => {
const checked = option.value === selectedValue;
return (
<div className="radio-group__column" key={`${name}-${option.value}`}>
<label>
<Typography
color={COLORS.SUCCESS3}
className="radio-group__column-recommended"
variant={TYPOGRAPHY.H7}
>
{option.recommended ? t('recommendedGasLabel') : ''}
</Typography>
{hasRecommendation && (
<Typography
color={COLORS.SUCCESS3}
className="radio-group__column-recommended"
variant={TYPOGRAPHY.H7}
>
{option.recommended ? t('recommendedGasLabel') : ''}
</Typography>
)}
<div className="radio-group__column-radio">
<input
type="radio"
@ -38,7 +48,7 @@ export default function RadioGroup({ options, name, selectedValue, onChange }) {
<div className="radio-group__column-line"></div>
<div className="radio-group__column-horizontal-line"></div>
<Typography
color={COLORS.UI4}
color={checked ? COLORS.BLACK : COLORS.UI4}
fontWeight={FONT_WEIGHT.BOLD}
variant={TYPOGRAPHY.H7}
className="radio-group__column-label"

View File

@ -106,6 +106,7 @@ export default class UnitInput extends PureComponent {
ref={(ref) => {
this.unitInput = ref;
}}
autoFocus
/>
{suffix && <div className="unit-input__suffix">{suffix}</div>}
</div>

View File

@ -309,6 +309,7 @@ export default class ConfirmTransactionBase extends Component {
return (
<UserPreferencedCurrencyDisplay
type={PRIMARY}
key="total-max-amount"
value={addHexes(txData.txParams.value, hexMaximumTransactionFee)}
hideLabel={!useNativeCurrencyAsPrimaryCurrency}
/>
@ -329,6 +330,7 @@ export default class ConfirmTransactionBase extends Component {
return (
<UserPreferencedCurrencyDisplay
type={PRIMARY}
key="total-detail-value"
value={hexTransactionTotal}
hideLabel={!useNativeCurrencyAsPrimaryCurrency}
/>
@ -347,6 +349,7 @@ export default class ConfirmTransactionBase extends Component {
return (
<UserPreferencedCurrencyDisplay
type={SECONDARY}
key="total-detail-text"
value={hexTransactionTotal}
hideLabel={Boolean(useNativeCurrencyAsPrimaryCurrency)}
/>

View File

@ -21426,9 +21426,9 @@ path-key@^3.0.0, path-key@^3.1.0:
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
path-platform@~0.11.15:
version "0.11.15"