mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Start dapp directly from metamask-ui.spec.js
(#11299)
The dapp is now started directly from the `metamask-ui.spec.js` test module. This makes it easier to run independently, and brings it in- line with our other E2E tests. The `--no-timeouts` flag is now used as well, rather than setting the timeout to `0` within the test. This also brings it in-line with our other tests. Mainly this was done to facilitate further refactors which will come in later PRs.
This commit is contained in:
parent
24adadbce0
commit
feb989c12b
@ -1,24 +1,42 @@
|
||||
const { strict: assert } = require('assert');
|
||||
const path = require('path');
|
||||
|
||||
const enLocaleMessages = require('../../app/_locales/en/messages.json');
|
||||
const createStaticServer = require('../../development/create-static-server');
|
||||
const { tinyDelayMs, regularDelayMs, largeDelayMs } = require('./helpers');
|
||||
const { buildWebDriver } = require('./webdriver');
|
||||
const Ganache = require('./ganache');
|
||||
|
||||
const ganacheServer = new Ganache();
|
||||
const dappPort = 8080;
|
||||
|
||||
describe('MetaMask', function () {
|
||||
let driver;
|
||||
let dappServer;
|
||||
let tokenAddress;
|
||||
|
||||
const testSeedPhrase =
|
||||
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent';
|
||||
|
||||
this.timeout(0);
|
||||
this.bail(true);
|
||||
|
||||
before(async function () {
|
||||
await ganacheServer.start();
|
||||
const dappDirectory = path.resolve(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'node_modules',
|
||||
'@metamask',
|
||||
'test-dapp',
|
||||
'dist',
|
||||
);
|
||||
dappServer = createStaticServer(dappDirectory);
|
||||
dappServer.listen(dappPort);
|
||||
await new Promise((resolve, reject) => {
|
||||
dappServer.on('listening', resolve);
|
||||
dappServer.on('error', reject);
|
||||
});
|
||||
const result = await buildWebDriver();
|
||||
driver = result.driver;
|
||||
await driver.navigate();
|
||||
@ -43,6 +61,14 @@ describe('MetaMask', function () {
|
||||
after(async function () {
|
||||
await ganacheServer.quit();
|
||||
await driver.quit();
|
||||
await new Promise((resolve, reject) => {
|
||||
dappServer.close((error) => {
|
||||
if (error) {
|
||||
return reject(error);
|
||||
}
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Going through the first time flow', function () {
|
||||
|
@ -28,10 +28,4 @@ do
|
||||
retry mocha --no-timeouts "${spec}"
|
||||
done
|
||||
|
||||
retry concurrently --kill-others \
|
||||
--names 'dapp,e2e' \
|
||||
--prefix '[{time}][{name}]' \
|
||||
--success first \
|
||||
'yarn dapp' \
|
||||
'mocha test/e2e/metamask-ui.spec'
|
||||
|
||||
retry mocha --no-timeouts test/e2e/metamask-ui.spec
|
||||
|
Loading…
Reference in New Issue
Block a user