mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
add appropriate test timeouts (#11667)
Co-authored-by: Etienne Dusseault <etienne.dusseault@gmail.com>
This commit is contained in:
parent
00572f5910
commit
d75795b73f
@ -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');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user