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

feature/default_network_editable
ryanml 3 years ago
commit e34db34cda
  1. 3
      test/e2e/benchmark.js
  2. 4
      test/e2e/helpers.js
  3. 3
      test/e2e/metrics.spec.js
  4. 3
      test/e2e/tests/permissions.spec.js
  5. 4
      test/e2e/tests/provider-events.spec.js
  6. 2
      ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js
  7. 2
      ui/components/app/edit-gas-display/edit-gas-display.component.js
  8. 6
      ui/components/ui/radio-group/index.scss
  9. 30
      ui/components/ui/radio-group/radio-group.component.js
  10. 1
      ui/components/ui/unit-input/unit-input.component.js
  11. 3
      ui/pages/confirm-transaction-base/confirm-transaction-base.component.js
  12. 6
      yarn.lock

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

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

@ -1,6 +1,6 @@
const { strict: assert } = require('assert'); const { strict: assert } = require('assert');
const waitUntilCalled = require('../lib/wait-until-called'); 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 * 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, { const threeSegmentEventsReceived = waitUntilCalled(segmentStub, null, {
callCount: 3, callCount: 3,
}); });
await driver.delay(tinyDelayMs);
await driver.navigate(); await driver.navigate();
await driver.fill('#password', 'correct horse battery staple'); await driver.fill('#password', 'correct horse battery staple');

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save