1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

E2e remove xLargeDelayMs and xxLargeDelayMs delays (#12160)

* remove xLargeDelayMs and xxLargeDelayMs delay

* fix tests
This commit is contained in:
PeterYinusa 2021-09-20 16:48:49 +02:00 committed by GitHub
parent 8df521df8a
commit 1d658f5e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 17 deletions

View File

@ -12,8 +12,6 @@ const { ensureXServerIsRunning } = require('./x-server');
const tinyDelayMs = 200;
const regularDelayMs = tinyDelayMs * 2;
const largeDelayMs = regularDelayMs * 2;
const xLargeDelayMs = largeDelayMs * 2;
const xxLargeDelayMs = xLargeDelayMs * 2;
const dappPort = 8080;
@ -153,7 +151,5 @@ module.exports = {
tinyDelayMs,
regularDelayMs,
largeDelayMs,
xLargeDelayMs,
xxLargeDelayMs,
withFixtures,
};

View File

@ -1,5 +1,5 @@
const { strict: assert } = require('assert');
const { withFixtures, xxLargeDelayMs, xLargeDelayMs } = require('../helpers');
const { withFixtures } = require('../helpers');
describe('Permissions', function () {
it('sets permissions and connect to Dapp', async function () {
@ -34,7 +34,6 @@ 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,
@ -62,7 +61,10 @@ describe('Permissions', function () {
text: 'Connected sites',
tag: 'h2',
});
await driver.delay(xLargeDelayMs);
await driver.waitForSelector({
css: '.connected-sites-list__domain-name',
text: '127.0.0.1:8080',
});
const domains = await driver.findClickableElements(
'.connected-sites-list__domain-name',
);
@ -76,9 +78,10 @@ describe('Permissions', function () {
tag: 'button',
});
const getAccountsResult = await driver.findElement(
'#getAccountsResult',
);
const getAccountsResult = await driver.waitForSelector({
css: '#getAccountsResult',
text: publicAddress,
});
assert.equal(
(await getAccountsResult.getText()).toLowerCase(),
publicAddress.toLowerCase(),

View File

@ -1,5 +1,5 @@
const { strict: assert } = require('assert');
const { withFixtures, regularDelayMs, xxLargeDelayMs } = require('../helpers');
const { withFixtures } = require('../helpers');
describe('MetaMask', function () {
it('provider should inform dapp when switching networks', async function () {
@ -25,9 +25,14 @@ describe('MetaMask', function () {
await driver.press('#password', driver.Key.ENTER);
await driver.openNewPage('http://127.0.0.1:8080/');
const networkDiv = await driver.findElement('#network');
const chainIdDiv = await driver.findElement('#chainId');
await driver.delay(xxLargeDelayMs);
const networkDiv = await driver.waitForSelector({
css: '#network',
text: '1337',
});
const chainIdDiv = await driver.waitForSelector({
css: '#chainId',
text: '0x539',
});
assert.equal(await networkDiv.getText(), '1337');
assert.equal(await chainIdDiv.getText(), '0x539');
@ -36,11 +41,16 @@ describe('MetaMask', function () {
await driver.clickElement('.network-display');
await driver.clickElement({ text: 'Ropsten', tag: 'span' });
await driver.delay(regularDelayMs);
await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles);
const switchedNetworkDiv = await driver.findElement('#network');
const switchedChainIdDiv = await driver.findElement('#chainId');
const switchedNetworkDiv = await driver.waitForSelector({
css: '#network',
text: '3',
});
const switchedChainIdDiv = await driver.waitForSelector({
css: '#chainId',
text: '0x3',
});
const accountsDiv = await driver.findElement('#accounts');
assert.equal(await switchedNetworkDiv.getText(), '3');