Skip to content

Commit cf0e1c3

Browse files
authored
Merge branch 'develop' into node-16
2 parents 7a0e974 + 4e1dbc6 commit cf0e1c3

File tree

4 files changed

+74
-1
lines changed

4 files changed

+74
-1
lines changed

.circleci/scripts/firefox-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
set -u
55
set -o pipefail
66

7-
FIREFOX_VERSION='83.0'
7+
FIREFOX_VERSION='102.0'
88
FIREFOX_BINARY="firefox-${FIREFOX_VERSION}.tar.bz2"
99
FIREFOX_BINARY_URL="https://ftp.mozilla.org/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/${FIREFOX_BINARY}"
1010
FIREFOX_PATH='/opt/firefox'

test/e2e/tests/state-logs.spec.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
const { strict: assert } = require('assert');
2+
const { promises: fs } = require('fs');
3+
const { convertToHexValue, withFixtures } = require('../helpers');
4+
5+
const downloadsFolder = `${process.cwd()}/test-artifacts/downloads`;
6+
7+
const createDownloadFolder = async () => {
8+
await fs.rm(downloadsFolder, { recursive: true, force: true });
9+
await fs.mkdir(downloadsFolder, { recursive: true });
10+
};
11+
12+
const stateLogsExist = async () => {
13+
try {
14+
const stateLogs = `${downloadsFolder}/MetaMask State Logs.json`;
15+
await fs.access(stateLogs);
16+
return true;
17+
} catch (e) {
18+
return false;
19+
}
20+
};
21+
22+
describe('State logs', function () {
23+
const ganacheOptions = {
24+
accounts: [
25+
{
26+
secretKey:
27+
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
28+
balance: convertToHexValue(25000000000000000000),
29+
},
30+
],
31+
};
32+
it('should download state logs for the account', async function () {
33+
await withFixtures(
34+
{
35+
fixtures: 'imported-account',
36+
ganacheOptions,
37+
title: this.test.title,
38+
failOnConsoleError: false,
39+
},
40+
async ({ driver }) => {
41+
await createDownloadFolder();
42+
await driver.navigate();
43+
await driver.fill('#password', 'correct horse battery staple');
44+
await driver.press('#password', driver.Key.ENTER);
45+
46+
// Download State Logs
47+
await driver.clickElement('.account-menu__icon');
48+
await driver.clickElement({ text: 'Settings', tag: 'div' });
49+
await driver.clickElement({ text: 'Advanced', tag: 'div' });
50+
await driver.clickElement({
51+
text: 'Download State Logs',
52+
tag: 'button',
53+
});
54+
55+
// Verify download
56+
let fileExists;
57+
await driver.wait(async () => {
58+
fileExists = await stateLogsExist();
59+
return fileExists === true;
60+
}, 10000);
61+
assert.equal(fileExists, true);
62+
},
63+
);
64+
});
65+
});

test/e2e/webdriver/chrome.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class ChromeDriver {
2222
const options = new chrome.Options().addArguments(args);
2323
options.setProxy(proxy.manual({ https: HTTPS_PROXY_HOST }));
2424
options.setAcceptInsecureCerts(true);
25+
options.setUserPreferences({
26+
'download.default_directory': `${process.cwd()}/test-artifacts/downloads`,
27+
});
2528
const builder = new Builder()
2629
.forBrowser('chrome')
2730
.setChromeOptions(options);

test/e2e/webdriver/firefox.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class FirefoxDriver {
4040
const options = new firefox.Options().setProfile(templateProfile);
4141
options.setProxy(proxy.manual({ https: HTTPS_PROXY_HOST }));
4242
options.setAcceptInsecureCerts(true);
43+
options.setPreference('browser.download.folderList', 2);
44+
options.setPreference(
45+
'browser.download.dir',
46+
`${process.cwd()}/test-artifacts/downloads`,
47+
);
4348
const builder = new Builder()
4449
.forBrowser('firefox')
4550
.setFirefoxOptions(options);

0 commit comments

Comments
 (0)