Skip to content

Commit ab819c7

Browse files
committed
Merge branch 'develop' of github.com:MetaMask/metamask-extension into dapp_action_replay_improvements
2 parents e5cbbbe + d533bd4 commit ab819c7

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

test/e2e/tests/custom-rpc-history.spec.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { strict: assert } = require('assert');
2-
const { convertToHexValue, withFixtures, largeDelayMs } = require('../helpers');
2+
const { convertToHexValue, withFixtures } = require('../helpers');
33
const FixtureBuilder = require('../fixture-builder');
44

55
describe('Stores custom RPC history', function () {
@@ -30,8 +30,7 @@ describe('Stores custom RPC history', function () {
3030
const rpcUrl = `http://127.0.0.1:${port}`;
3131
const networkName = 'Secondary Ganache Testnet';
3232

33-
await driver.delay(largeDelayMs);
34-
33+
await driver.waitForElementNotPresent('.loading-overlay');
3534
await driver.clickElement('.network-display');
3635

3736
await driver.clickElement({ text: 'Add network', tag: 'button' });
@@ -87,8 +86,7 @@ describe('Stores custom RPC history', function () {
8786
// duplicate network
8887
const duplicateRpcUrl = 'https://mainnet.infura.io/v3/';
8988

90-
await driver.delay(largeDelayMs);
91-
89+
await driver.waitForElementNotPresent('.loading-overlay');
9290
await driver.clickElement('.network-display');
9391

9492
await driver.clickElement({ text: 'Add network', tag: 'button' });
@@ -132,8 +130,7 @@ describe('Stores custom RPC history', function () {
132130
const newRpcUrl = 'http://localhost:8544';
133131
const duplicateChainId = '1';
134132

135-
await driver.delay(largeDelayMs);
136-
133+
await driver.waitForElementNotPresent('.loading-overlay');
137134
await driver.clickElement('.network-display');
138135

139136
await driver.clickElement({ text: 'Add network', tag: 'button' });
@@ -181,8 +178,7 @@ describe('Stores custom RPC history', function () {
181178
await driver.fill('#password', 'correct horse battery staple');
182179
await driver.press('#password', driver.Key.ENTER);
183180

184-
await driver.delay(largeDelayMs);
185-
181+
await driver.waitForElementNotPresent('.loading-overlay');
186182
await driver.clickElement('.network-display');
187183

188184
await driver.clickElement({ text: 'Ethereum Mainnet', tag: 'span' });
@@ -221,7 +217,7 @@ describe('Stores custom RPC history', function () {
221217
await driver.fill('#password', 'correct horse battery staple');
222218
await driver.press('#password', driver.Key.ENTER);
223219

224-
await driver.delay(largeDelayMs);
220+
await driver.waitForElementNotPresent('.loading-overlay');
225221
await driver.clickElement('.network-display');
226222

227223
// only recent 3 are found and in correct order (most recent at the top)
@@ -270,7 +266,7 @@ describe('Stores custom RPC history', function () {
270266
await driver.fill('#password', 'correct horse battery staple');
271267
await driver.press('#password', driver.Key.ENTER);
272268

273-
await driver.delay(largeDelayMs);
269+
await driver.waitForElementNotPresent('.loading-overlay');
274270
await driver.clickElement('.network-display');
275271

276272
await driver.clickElement({ text: 'Add network', tag: 'button' });

test/e2e/webdriver/driver.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
const { promises: fs } = require('fs');
22
const { strict: assert } = require('assert');
3-
const { until, error: webdriverError, By, Key } = require('selenium-webdriver');
3+
const {
4+
By,
5+
Condition,
6+
error: webdriverError,
7+
Key,
8+
until,
9+
} = require('selenium-webdriver');
410
const cssToXPath = require('css-to-xpath');
511

612
/**
@@ -33,6 +39,14 @@ function wrapElementWithAPI(element, driver) {
3339
return element;
3440
}
3541

42+
until.elementIsNotPresent = function elementIsNotPresent(locator) {
43+
return new Condition(`Element not present`, function (driver) {
44+
return driver.findElements(By.css(locator)).then(function (elements) {
45+
return elements.length === 0;
46+
});
47+
});
48+
};
49+
3650
/**
3751
* For Selenium WebDriver API documentation, see:
3852
* https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html
@@ -170,6 +184,10 @@ class Driver {
170184
}, this.timeout);
171185
}
172186

187+
async waitForElementNotPresent(element) {
188+
return await this.driver.wait(until.elementIsNotPresent(element));
189+
}
190+
173191
async quit() {
174192
await this.driver.quit();
175193
}

ui/css/design-system/attributes.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ $font-style: normal, italic, oblique;
5050
$font-size: 10px, 12px;
5151
$border-radius: (
5252
xs: 2px,
53-
md: 4px,
53+
sm: 4px,
54+
md: 6px,
5455
lg: 8px,
5556
xl: 12px,
5657
full: 50%,

0 commit comments

Comments
 (0)