From fb22fb12cafec238a2143df6e94218c890e4ba4e Mon Sep 17 00:00:00 2001
From: Sneh Koul <35871990+Sneh1999@users.noreply.github.com>
Date: Tue, 16 Apr 2019 10:59:11 -0700
Subject: Adds e2e test for most web3 methods that dapps use (#6160)
* schema added
* ui for the dapp added and schema.js changed according to the comments in PR
* added tests for all web3 methods
* Update run-all.sh
* Update web3.spec.js to work with new onboarding flow
* changes made according to the comments
* Create stand alone script for web3 e2e tests.
* Lint fixes for web3 e2e tests.
---
test/e2e/beta/run-web3.sh | 9 ++
test/e2e/beta/web3.spec.js | 365 +++++++++++++++++++++++++++++++++++++++++++++
test/web3/index.html | 105 +++++++++++++
test/web3/schema.js | 209 ++++++++++++++++++++++++++
test/web3/web3.js | 34 +++++
5 files changed, 722 insertions(+)
create mode 100755 test/e2e/beta/run-web3.sh
create mode 100644 test/e2e/beta/web3.spec.js
create mode 100644 test/web3/index.html
create mode 100644 test/web3/schema.js
create mode 100644 test/web3/web3.js
(limited to 'test')
diff --git a/test/e2e/beta/run-web3.sh b/test/e2e/beta/run-web3.sh
new file mode 100755
index 000000000..9f77060de
--- /dev/null
+++ b/test/e2e/beta/run-web3.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+set -e
+set -u
+set -o pipefail
+
+export PATH="$PATH:./node_modules/.bin"
+
+shell-parallel -s 'static-server test/web3 --port 8080' -x 'sleep 5 && mocha test/e2e/beta/web3.spec'
\ No newline at end of file
diff --git a/test/e2e/beta/web3.spec.js b/test/e2e/beta/web3.spec.js
new file mode 100644
index 000000000..b3962c821
--- /dev/null
+++ b/test/e2e/beta/web3.spec.js
@@ -0,0 +1,365 @@
+const path = require('path')
+const assert = require('assert')
+const webdriver = require('selenium-webdriver')
+const { By } = webdriver
+const {
+ delay,
+ buildChromeWebDriver,
+ buildFirefoxWebdriver,
+ installWebExt,
+ getExtensionIdChrome,
+ getExtensionIdFirefox,
+} = require('../func')
+const {
+ checkBrowserForConsoleErrors,
+ closeAllWindowHandlesExcept,
+ findElement,
+ findElements,
+ openNewPage,
+ switchToWindowWithTitle,
+ verboseReportOnFailure,
+ waitUntilXWindowHandles,
+} = require('./helpers')
+const fetchMockResponses = require('./fetch-mocks.js')
+
+
+describe('Using MetaMask with an existing account', function () {
+ let extensionId
+ let driver
+
+ const testSeedPhrase = 'forum vessel pink push lonely enact gentle tail admit parrot grunt dress'
+ const regularDelayMs = 1000
+ const largeDelayMs = regularDelayMs * 2
+
+ const button = async (x) => {
+ const buttoncheck = x
+ await buttoncheck.click()
+ await delay(largeDelayMs)
+ const [results] = await findElements(driver, By.css('#results'))
+ const resulttext = await results.getText()
+ var parsedData = JSON.parse(resulttext)
+
+ return (parsedData)
+
+ }
+
+ this.timeout(0)
+ this.bail(true)
+
+ before(async function () {
+ let extensionUrl
+ switch (process.env.SELENIUM_BROWSER) {
+ case 'chrome': {
+ const extensionPath = path.resolve('dist/chrome')
+ driver = buildChromeWebDriver(extensionPath)
+ extensionId = await getExtensionIdChrome(driver)
+ await delay(regularDelayMs)
+ extensionUrl = `chrome-extension://${extensionId}/home.html`
+ break
+ }
+ case 'firefox': {
+ const extensionPath = path.resolve('dist/firefox')
+ driver = buildFirefoxWebdriver()
+ await installWebExt(driver, extensionPath)
+ await delay(regularDelayMs)
+ extensionId = await getExtensionIdFirefox(driver)
+ extensionUrl = `moz-extension://${extensionId}/home.html`
+ break
+ }
+ }
+ // Depending on the state of the application built into the above directory (extPath) and the value of
+ // METAMASK_DEBUG we will see different post-install behaviour and possibly some extra windows. Here we
+ // are closing any extraneous windows to reset us to a single window before continuing.
+ const [tab1] = await driver.getAllWindowHandles()
+ await closeAllWindowHandlesExcept(driver, [tab1])
+ await driver.switchTo().window(tab1)
+ await driver.get(extensionUrl)
+ })
+
+ beforeEach(async function () {
+ await driver.executeScript(
+ 'window.origFetch = window.fetch.bind(window);' +
+ 'window.fetch = ' +
+ '(...args) => { ' +
+ 'if (args[0] === "https://ethgasstation.info/json/ethgasAPI.json") { return ' +
+ 'Promise.resolve({ json: () => Promise.resolve(JSON.parse(\'' + fetchMockResponses.ethGasBasic + '\')) }); } else if ' +
+ '(args[0] === "https://ethgasstation.info/json/predictTable.json") { return ' +
+ 'Promise.resolve({ json: () => Promise.resolve(JSON.parse(\'' + fetchMockResponses.ethGasPredictTable + '\')) }); } else if ' +
+ '(args[0].match(/chromeextensionmm/)) { return ' +
+ 'Promise.resolve({ json: () => Promise.resolve(JSON.parse(\'' + fetchMockResponses.metametrics + '\')) }); } else if ' +
+ '(args[0] === "https://dev.blockscale.net/api/gasexpress.json") { return ' +
+ 'Promise.resolve({ json: () => Promise.resolve(JSON.parse(\'' + fetchMockResponses.gasExpress + '\')) }); } ' +
+ 'return window.origFetch(...args); };' +
+ 'function cancelInfuraRequest(requestDetails) {' +
+ 'console.log("Canceling: " + requestDetails.url);' +
+ 'return {' +
+ 'cancel: true' +
+ '};' +
+ ' }' +
+ 'window.chrome && window.chrome.webRequest && window.chrome.webRequest.onBeforeRequest.addListener(' +
+ 'cancelInfuraRequest,' +
+ '{urls: ["https://*.infura.io/*"]},' +
+ '["blocking"]' +
+ ');'
+ )
+ })
+
+ afterEach(async function () {
+ if (process.env.SELENIUM_BROWSER === 'chrome') {
+ const errors = await checkBrowserForConsoleErrors(driver)
+ if (errors.length) {
+ const errorReports = errors.map(err => err.message)
+ const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
+ console.error(new Error(errorMessage))
+ }
+ }
+ if (this.currentTest.state === 'failed') {
+ await verboseReportOnFailure(driver, this.currentTest)
+ }
+ })
+
+ after(async function () {
+ await driver.quit()
+ })
+
+ describe('First time flow starting from an existing seed phrase', () => {
+ it('clicks the continue button on the welcome screen', async () => {
+ await findElement(driver, By.css('.welcome-page__header'))
+ const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
+ welcomeScreenBtn.click()
+ await delay(largeDelayMs)
+ })
+
+ it('clicks the "Import Wallet" option', async () => {
+ const customRpcButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Import Wallet')]`))
+ customRpcButton.click()
+ await delay(largeDelayMs)
+ })
+
+ it('clicks the "No thanks" option on the metametrics opt-in screen', async () => {
+ const optOutButton = await findElement(driver, By.css('.btn-default'))
+ optOutButton.click()
+ await delay(largeDelayMs)
+ })
+
+ it('imports a seed phrase', async () => {
+ const [seedTextArea] = await findElements(driver, By.css('textarea.first-time-flow__textarea'))
+ await seedTextArea.sendKeys(testSeedPhrase)
+ await delay(regularDelayMs)
+
+ const [password] = await findElements(driver, By.id('password'))
+ await password.sendKeys('correct horse battery staple')
+ const [confirmPassword] = await findElements(driver, By.id('confirm-password'))
+ confirmPassword.sendKeys('correct horse battery staple')
+
+ const tosCheckBox = await findElement(driver, By.css('.first-time-flow__checkbox'))
+ await tosCheckBox.click()
+
+ const [importButton] = await findElements(driver, By.xpath(`//button[contains(text(), 'Import')]`))
+ await importButton.click()
+ await delay(regularDelayMs)
+ })
+
+ it('clicks through the success screen', async () => {
+ await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
+ const doneButton = await findElement(driver, By.css('button.first-time-flow__button'))
+ await doneButton.click()
+ await delay(regularDelayMs)
+ })
+ })
+
+
+ describe('opens dapp', () => {
+
+ it('switches to mainnet', async () => {
+ const networkDropdown = await findElement(driver, By.css('.network-name'))
+ await networkDropdown.click()
+ await delay(regularDelayMs)
+
+ const [mainnet] = await findElements(driver, By.xpath(`//span[contains(text(), 'Main Ethereum Network')]`))
+ await mainnet.click()
+ await delay(largeDelayMs * 2)
+ })
+
+ it('', async () => {
+ await openNewPage(driver, 'http://127.0.0.1:8080/')
+ await delay(regularDelayMs)
+
+ await waitUntilXWindowHandles(driver, 3)
+ const windowHandles = await driver.getAllWindowHandles()
+
+ const extension = windowHandles[0]
+ const popup = await switchToWindowWithTitle(driver, 'MetaMask Notification', windowHandles)
+ const dapp = windowHandles.find(handle => handle !== extension && handle !== popup)
+
+ await delay(regularDelayMs)
+ const approveButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Connect')]`))
+ await approveButton.click()
+
+ await driver.switchTo().window(dapp)
+ await delay(regularDelayMs)
+
+
+ })
+ })
+
+ describe('testing web3 methods', async () => {
+
+
+ it('testing hexa methods', async () => {
+
+
+ var List = await driver.findElements(By.className('hexaNumberMethods'))
+
+ for (let i = 0; i < List.length; i++) {
+ try {
+
+ var parsedData = await button(List[i])
+ console.log(parsedData)
+ var result = parseInt(parsedData.result, 16)
+
+ assert.equal((typeof result === 'number'), true)
+ await delay(regularDelayMs)
+ } catch (err) {
+ console.log(err)
+ assert(false)
+
+ }
+ }
+ })
+
+ it('testing booleanMethods', async () => {
+
+ var List = await driver.findElements(By.className('booleanMethods'))
+
+ for (let i = 0; i < List.length; i++) {
+ try {
+
+ var parsedData = await button(List[i])
+ console.log(parsedData)
+ var result = parsedData.result
+
+ assert.equal(result, false)
+ await delay(regularDelayMs)
+ } catch (err) {
+ console.log(err)
+ assert(false)
+
+
+ }
+ }
+
+ })
+
+ it('testing transactionMethods', async () => {
+
+ var List = await driver.findElements(By.className('transactionMethods'))
+
+ for (let i = 0; i < List.length; i++) {
+ try {
+
+ var parsedData = await button(List[i])
+
+ console.log(parsedData.result.blockHash)
+
+ var result = []
+ result.push(parseInt(parsedData.result.blockHash, 16))
+ result.push(parseInt(parsedData.result.blockNumber, 16))
+ result.push(parseInt(parsedData.result.gas, 16))
+ result.push(parseInt(parsedData.result.gasPrice, 16))
+ result.push(parseInt(parsedData.result.hash, 16))
+ result.push(parseInt(parsedData.result.input, 16))
+ result.push(parseInt(parsedData.result.nonce, 16))
+ result.push(parseInt(parsedData.result.r, 16))
+ result.push(parseInt(parsedData.result.s, 16))
+ result.push(parseInt(parsedData.result.v, 16))
+ result.push(parseInt(parsedData.result.to, 16))
+ result.push(parseInt(parsedData.result.value, 16))
+
+
+ result.forEach((value) => {
+ assert.equal((typeof value === 'number'), true)
+ })
+
+
+ } catch (err) {
+
+ console.log(err)
+ assert(false)
+
+
+ }
+ }
+
+ })
+
+ it('testing blockMethods', async () => {
+
+ var List = await driver.findElements(By.className('blockMethods'))
+
+ for (let i = 0; i < List.length; i++) {
+ try {
+
+ var parsedData = await button(List[i])
+ console.log(JSON.stringify(parsedData) + i)
+
+ console.log(parsedData.result.parentHash)
+
+ var result = parseInt(parsedData.result.parentHash, 16)
+
+ assert.equal((typeof result === 'number'), true)
+ await delay(regularDelayMs)
+ } catch (err) {
+
+ console.log(err)
+ assert(false)
+
+
+ }
+ }
+ })
+
+ it('testing methods', async () => {
+
+ var List = await driver.findElements(By.className('methods'))
+ var parsedData
+ var result
+
+ for (let i = 0; i < List.length; i++) {
+ try {
+
+ if (i === 2) {
+
+ parsedData = await button(List[i])
+ console.log(parsedData.result.blockHash)
+
+ result = parseInt(parsedData.result.blockHash, 16)
+
+ assert.equal((typeof result === 'number' || (result === 0)), true)
+ await delay(regularDelayMs)
+ } else {
+ parsedData = await button(List[i])
+ console.log(parsedData.result)
+
+ result = parseInt(parsedData.result, 16)
+
+ assert.equal((typeof result === 'number' || (result === 0)), true)
+ await delay(regularDelayMs)
+ }
+
+
+ } catch (err) {
+
+ console.log(err)
+ assert(false)
+
+
+ }
+ }
+ })
+
+
+ })
+
+
+ })
diff --git a/test/web3/index.html b/test/web3/index.html
new file mode 100644
index 000000000..cbc43290c
--- /dev/null
+++ b/test/web3/index.html
@@ -0,0 +1,105 @@
+
+
+ Web3 Test Dapp
+
+
+
+
hexaNumberMethods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
booleanMethods
+
+
+
+
+
+
+
+
transactionMethods
+
+
+
+
+
+
+
+
+
+
+
blockMethods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/web3/schema.js b/test/web3/schema.js
new file mode 100644
index 000000000..61977f140
--- /dev/null
+++ b/test/web3/schema.js
@@ -0,0 +1,209 @@
+/* eslint no-unused-vars: 0 */
+
+var params = {
+ // diffrent params used in the methods
+ param: [],
+ blockHashParams: '0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35',
+ filterParams: ['0xfe704947a3cd3ca12541458a4321c869'],
+ transactionHashParams: [
+ '0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0',
+ ],
+ blockHashAndIndexParams: [
+ '0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35',
+ '0x0',
+ ],
+ uncleByBlockNumberAndIndexParams: ['0x29c', '0x0'],
+ blockParameterParams: '0x5bad55',
+ data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675',
+ addressParams: '0xc94770007dda54cF92009BFF0dE90c06F603a09f',
+ getStorageAtParams: [
+ '0x295a70b2de5e3953354a6a8344e616ed314d7251',
+ '0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9',
+ '0x65a8db',
+ ],
+ getCodeParams: ['0x06012c8cf97bead5deae237070f9587f8e7a266d', '0x65a8db'],
+ estimateTransaction: {
+ from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
+ to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
+ gas: '0x76c0',
+ gasPrice: '0x9184e72a000',
+ value: '0x9184e72a',
+ data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675',
+ },
+ filterGetLogs: [{'blockHash': '0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70', 'topics': ['0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80']}],
+ block: {
+ __required: [],
+ number: 'Q',
+ hash: 'D32',
+ parentHash: 'D32',
+ nonce: 'D',
+ sha3Uncles: 'D',
+ logsBloom: 'D',
+ transactionsRoot: 'D',
+ stateRoot: 'D',
+ receiptsRoot: 'D',
+ miner: 'D',
+ difficulty: 'Q',
+ totalDifficulty: 'Q',
+ extraData: 'D',
+ size: 'Q',
+ gasLimit: 'Q',
+ gasUsed: 'Q',
+ timestamp: 'Q',
+ transactions: ['DATA|Transaction'],
+ uncles: ['D'],
+ },
+ transaction: {
+ __required: [],
+ hash: 'D32',
+ nonce: 'Q',
+ blockHash: 'D32',
+ blockNumber: 'Q',
+ transactionIndex: 'Q',
+ from: 'D20',
+ to: 'D20',
+ value: 'Q',
+ gasPrice: 'Q',
+ gas: 'Q',
+ input: 'D',
+ },
+ receipt: {
+ __required: [],
+ transactionHash: 'D32',
+ transactionIndex: 'Q',
+ blockHash: 'D32',
+ blockNumber: 'Q',
+ cumulativeGasUsed: 'Q',
+ gasUsed: 'Q',
+ contractAddress: 'D20',
+ logs: ['FilterChange'],
+ },
+
+ filterChange: {
+ __required: [],
+ removed: 'B',
+ logIndex: 'Q',
+ transactionIndex: 'Q',
+ transactionHash: 'D32',
+ blockHash: 'D32',
+ blockNumber: 'Q',
+ address: 'D20',
+ data: 'Array|DATA',
+ topics: ['D'],
+ },
+}
+
+var methods = {
+ hexaNumberMethods: {
+ // these are the methods which have output in the form of hexa decimal numbers
+ eth_blockNumber: ['eth_blockNumber', params.param, 'Q'],
+ eth_gasPrice: ['eth_gasPrice', params.param, 'Q'],
+ eth_newBlockFilter: ['eth_newBlockFilter', params.param, 'Q'],
+ eth_newPendingTransactionFilter: [
+ 'eth_newPendingTransactionFilter',
+ params.param,
+ 'Q',
+ ],
+ eth_getUncleCountByBlockHash: [
+ 'eth_getUncleCountByBlockHash',
+ [params.blockHashParams],
+ 'Q',
+ 1,
+ ],
+ eth_getBlockTransactionCountByHash: [
+ 'eth_getBlockTransactionCountByHash',
+ [params.blockHashParams],
+ 'Q',
+ 1,
+ ],
+ eth_getTransactionCount: [
+ 'eth_getTransactionCount',
+ [params.addressParams, params.blockParameterParams],
+ 'Q',
+ 1,
+ 2,
+ ],
+ eth_getBalance: ['eth_getBalance', [params.addressParams, 'latest'], 'Q', 1, 2],
+ eth_estimateGas: ['eth_estimateGas', [params.estimateTransaction], 'Q', 1],
+ eth_getUncleCountByBlockNumber: [
+ 'eth_getUncleCountByBlockNumber',
+ [params.blockParameterParams],
+ 'Q',
+ 1,
+ ],
+ eth_getBlockTransactionCountByNumber: [
+ 'eth_getBlockTransactionCountByNumber',
+ ['latest'],
+ 'Q',
+ 1,
+ ],
+ eth_protocolVersion: ['eth_protocolVersion', params.param, 'S'],
+ eth_getCode: ['eth_getCode', params.getCodeParams, 'D', 1, 2],
+ },
+ booleanMethods: {
+ // these are the methods which have output in the form of boolean
+ eth_uninstallFilter: ['eth_uninstallFilter', params.filterParams, 'B', 1],
+ eth_mining: ['eth_mining', params.param, 'B'],
+ eth_syncing: ['eth_syncing', params.param, 'B|EthSyncing'],
+ },
+ transactionMethods: {
+ // these are the methods which have output in the form of transaction object
+ eth_getTransactionByHash: [
+ 'eth_getTransactionByHash',
+ params.transactionHashParams,
+ params.transaction,
+ 1,
+ ],
+ eth_getTransactionByBlockHashAndIndex: [
+ 'eth_getTransactionByBlockHashAndIndex',
+ params.blockHashAndIndexParams,
+ params.transaction,
+ 2,
+ ],
+ eth_getTransactionByBlockNumberAndIndex: [
+ 'eth_getTransactionByBlockNumberAndIndex',
+ [params.blockParameterParams, '0x0'],
+ params.transaction,
+ 2,
+ ],
+
+ },
+ blockMethods: {
+ // these are the methods which have output in the form of a block
+
+ eth_getUncleByBlockNumberAndIndex: [
+ 'eth_getUncleByBlockNumberAndIndex',
+ params.uncleByBlockNumberAndIndexParams,
+ params.block,
+ 2,
+ ],
+ eth_getBlockByHash: [
+ 'eth_getBlockByHash',
+ [params.params, false],
+ params.block,
+ 2,
+ ],
+ eth_getBlockByNumber: [
+ 'eth_getBlockByNumber',
+ [params.blockParameterParams, false],
+ params.block,
+ 2,
+ ],
+ },
+
+ methods: {
+ // these are the methods which have output in the form of bytes data
+
+ eth_call: ['eth_call', [params.estimateTransaction, 'latest'], 'D', 1, 2],
+ eth_getStorageAt: ['eth_getStorageAt', params.getStorageAtParams, 'D', 2, 2],
+ eth_getTransactionReceipt: [
+ 'eth_getTransactionReceipt',
+ params.transactionHashParams,
+ params.receipt,
+ 1,
+ ],
+
+ },
+
+}
+
diff --git a/test/web3/web3.js b/test/web3/web3.js
new file mode 100644
index 000000000..5c2de078d
--- /dev/null
+++ b/test/web3/web3.js
@@ -0,0 +1,34 @@
+/* eslint no-undef: 0 */
+
+var json = methods
+
+web3.currentProvider.enable().then(() => {
+
+ Object.keys(json).forEach(methodGroupKey => {
+
+ console.log(methodGroupKey)
+ const methodGroup = json[methodGroupKey]
+ console.log(methodGroup)
+ Object.keys(methodGroup).forEach(methodKey => {
+
+ const methodButton = document.getElementById(methodKey)
+ methodButton.addEventListener('click', function (event) {
+
+ window.ethereum.sendAsync({
+ method: methodKey,
+ params: methodGroup[methodKey][1],
+ }, function (err, result) {
+ if (err) {
+ console.log(err)
+ console.log(methodKey)
+ } else {
+ document.getElementById('results').innerHTML = JSON.stringify(result)
+ }
+ })
+ })
+
+ })
+
+ })
+ })
+
--
cgit v1.2.3
From 92c03bdff2281b5901151ad0840b83e40dad73bc Mon Sep 17 00:00:00 2001
From: Chi Kei Chan
Date: Tue, 16 Apr 2019 12:35:22 -0700
Subject: Update buttons & colors to match design system (#6446)
* Refactoring button styles
* renaming buttons
* Add Link and Button styles
* Update new btn styles and storybook
* Fix tests
* Change font weight; Update storybook
* Fix linter
---
test/integration/lib/confirm-sig-requests.js | 6 +++---
test/integration/lib/send-new-ui.js | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'test')
diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js
index e4540c4f2..c3b0dfcff 100644
--- a/test/integration/lib/confirm-sig-requests.js
+++ b/test/integration/lib/confirm-sig-requests.js
@@ -44,7 +44,7 @@ async function runConfirmSigRequestsTest (assert, done) {
let confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
assert.equal(confirmSigRowValue[0].textContent, '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0')
- let confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
+ let confirmSigSignButton = await queryAsync($, 'button.btn-secondary.btn--large')
confirmSigSignButton[0].click()
await timeout(1000)
confirmSigHeadline = await queryAsync($, '.request-signature__headline')
@@ -53,7 +53,7 @@ async function runConfirmSigRequestsTest (assert, done) {
confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
assert.ok(confirmSigRowValue[0].textContent.match(/^#\sTerms\sof\sUse/))
- confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
+ confirmSigSignButton = await queryAsync($, 'button.btn-secondary.btn--large')
confirmSigSignButton[0].click()
await timeout(1000)
confirmSigHeadline = await queryAsync($, '.request-signature__headline')
@@ -63,7 +63,7 @@ async function runConfirmSigRequestsTest (assert, done) {
assert.equal(confirmSigRowValue[0].textContent, 'Hi, Alice!')
assert.equal(confirmSigRowValue[1].textContent, '1337')
- confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
+ confirmSigSignButton = await queryAsync($, 'button.btn-secondary.btn--large')
confirmSigSignButton[0].click()
await timeout(2000)
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index d7003f4cc..ce470fc02 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -43,7 +43,7 @@ async function runSendFlowTest (assert, done) {
selectState.val('send new ui')
reactTriggerChange(selectState[0])
- const sendScreenButton = await queryAsync($, 'button.btn-primary.transaction-view-balance__button')
+ const sendScreenButton = await queryAsync($, 'button.btn-secondary.transaction-view-balance__button')
assert.ok(sendScreenButton[1], 'send screen button present')
sendScreenButton[1].click()
@@ -88,7 +88,7 @@ async function runSendFlowTest (assert, done) {
errorMessage = $('.send-v2__error')
assert.equal(errorMessage.length, 0, 'send should stop rendering amount error message after amount is corrected')
- const sendButton = await queryAsync($, 'button.btn-primary.btn--large.page-container__footer-button')
+ const sendButton = await queryAsync($, 'button.btn-secondary.btn--large.page-container__footer-button')
assert.equal(sendButton[0].textContent, 'Next', 'next button rendered')
sendButton[0].click()
await timeout()
@@ -122,7 +122,7 @@ async function runSendFlowTest (assert, done) {
sendAmountFieldInputInEdit.val('1.0')
reactTriggerChange(sendAmountFieldInputInEdit[0])
- const sendButtonInEdit = await queryAsync($, '.btn-primary.btn--large.page-container__footer-button')
+ const sendButtonInEdit = await queryAsync($, '.btn-secondary.btn--large.page-container__footer-button')
assert.equal(sendButtonInEdit[0].textContent, 'Next', 'next button in edit rendered')
selectState.val('send new ui')
--
cgit v1.2.3
From 0db0a187c8f30dcf332cf4d41a2f957171b25630 Mon Sep 17 00:00:00 2001
From: Paul Bouchon
Date: Wed, 17 Apr 2019 13:34:49 -0400
Subject: feature: add Goerli support (#6459)
---
test/data/v17-long-history.json | 5 +++--
test/unit/app/controllers/infura-controller-test.js | 12 +++++++++++-
test/unit/app/controllers/network-contoller-test.js | 3 +++
.../transactions/recipient-blacklist-checker-test.js | 5 +++--
test/unit/ui/etherscan-prefix-for-network.spec.js | 4 ++++
5 files changed, 24 insertions(+), 5 deletions(-)
(limited to 'test')
diff --git a/test/data/v17-long-history.json b/test/data/v17-long-history.json
index a33d425f8..cccb1ef96 100644
--- a/test/data/v17-long-history.json
+++ b/test/data/v17-long-history.json
@@ -54,7 +54,8 @@
"mainnet": "degraded",
"ropsten": "ok",
"kovan": "ok",
- "rinkeby": "ok"
+ "rinkeby": "ok",
+ "goerli": "ok"
}
},
"BlacklistController": {
@@ -3050,4 +3051,4 @@
]
}
}
-}
\ No newline at end of file
+}
diff --git a/test/unit/app/controllers/infura-controller-test.js b/test/unit/app/controllers/infura-controller-test.js
index 7bd95dd4b..316f80378 100644
--- a/test/unit/app/controllers/infura-controller-test.js
+++ b/test/unit/app/controllers/infura-controller-test.js
@@ -4,7 +4,7 @@ const InfuraController = require('../../../../app/scripts/controllers/infura')
describe('infura-controller', function () {
let infuraController, sandbox, networkStatus
- const response = {'mainnet': 'degraded', 'ropsten': 'ok', 'kovan': 'ok', 'rinkeby': 'down'}
+ const response = {'mainnet': 'degraded', 'ropsten': 'ok', 'kovan': 'ok', 'rinkeby': 'down', 'goerli': 'ok'}
before(async function () {
infuraController = new InfuraController()
@@ -58,5 +58,15 @@ describe('infura-controller', function () {
assert.equal(networkStatus.rinkeby, 'down')
})
})
+
+ describe('Goerli', function () {
+ it('should have Goerli', function () {
+ assert.equal(Object.keys(networkStatus)[4], 'goerli')
+ })
+
+ it('should have a value for Goerli status', function () {
+ assert.equal(networkStatus.goerli, 'ok')
+ })
+ })
})
})
diff --git a/test/unit/app/controllers/network-contoller-test.js b/test/unit/app/controllers/network-contoller-test.js
index 7959e6cc1..32f7b337d 100644
--- a/test/unit/app/controllers/network-contoller-test.js
+++ b/test/unit/app/controllers/network-contoller-test.js
@@ -92,6 +92,9 @@ describe('Network utils', () => {
}, {
input: 'mainnet',
expected: 'Main Ethereum Network',
+ }, {
+ input: 'goerli',
+ expected: 'Goerli',
},
]
diff --git a/test/unit/app/controllers/transactions/recipient-blacklist-checker-test.js b/test/unit/app/controllers/transactions/recipient-blacklist-checker-test.js
index cb413545f..d3e47c67e 100644
--- a/test/unit/app/controllers/transactions/recipient-blacklist-checker-test.js
+++ b/test/unit/app/controllers/transactions/recipient-blacklist-checker-test.js
@@ -4,6 +4,7 @@ const {
ROPSTEN_CODE,
RINKEYBY_CODE,
KOVAN_CODE,
+ GOERLI_CODE,
} = require('../../../../../app/scripts/controllers/network/enums')
const KeyringController = require('eth-keyring-controller')
@@ -27,14 +28,14 @@ describe('Recipient Blacklist Checker', function () {
describe('#checkAccount', function () {
it('does not fail on test networks', function () {
let callCount = 0
- const networks = [ROPSTEN_CODE, RINKEYBY_CODE, KOVAN_CODE]
+ const networks = [ROPSTEN_CODE, RINKEYBY_CODE, KOVAN_CODE, GOERLI_CODE]
for (const networkId in networks) {
publicAccounts.forEach((account) => {
recipientBlackListChecker.checkAccount(networkId, account)
callCount++
})
}
- assert.equal(callCount, 30)
+ assert.equal(callCount, 40)
})
it('fails on mainnet', function () {
diff --git a/test/unit/ui/etherscan-prefix-for-network.spec.js b/test/unit/ui/etherscan-prefix-for-network.spec.js
index f0aeb8306..45e6e563d 100644
--- a/test/unit/ui/etherscan-prefix-for-network.spec.js
+++ b/test/unit/ui/etherscan-prefix-for-network.spec.js
@@ -23,4 +23,8 @@ describe('Etherscan Network Prefix', () => {
assert.equal(etherscanNetworkPrefix(42), 'kovan.')
})
+ it('returs goerli as prefix for networkId of 5', () => {
+ assert.equal(etherscanNetworkPrefix(5), 'goerli.')
+ })
+
})
--
cgit v1.2.3
From 931aaeb7003f175374a06eb949cd47a12ebc8bbf Mon Sep 17 00:00:00 2001
From: Chi Kei Chan
Date: Wed, 17 Apr 2019 12:15:13 -0700
Subject: Add token selection to the send screen (#6445)
* Move send to pages/
* Fix unit tests
* Finish UI
* Integrate asset dropdown to send actions
* Remove console.log
* Hide asset change during edit
* Enable switch from send token to seand eth
* Enable switching from token to eth when editing
* Fix linter
* Fixing test
* Fix unit tests
* Fix linter
* Fix react warning; remove console.log
* fix flat test
* Add metrics
* Address code review comments
* Consistent spacing between send screen form rows.
* Reduce height of gas buttons on send screen.
* Make send screen gas button height dependent on size of contents.
---
test/integration/lib/send-new-ui.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'test')
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index ce470fc02..d4c14392f 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -72,7 +72,7 @@ async function runSendFlowTest (assert, done) {
const sendToAccountAddress = sendToFieldInput.val()
assert.equal(sendToAccountAddress, '0x2f8D4a878cFA04A6E60D46362f5644DeAb66572D', 'send to dropdown selects the correct address')
- const sendAmountField = await queryAsync($, '.send-v2__form-row:eq(2)')
+ const sendAmountField = await queryAsync($, '.send-v2__form-row:eq(3)')
sendAmountField.find('.unit-input')[0].click()
const sendAmountFieldInput = await findAsync(sendAmountField, '.unit-input__input')
@@ -115,7 +115,7 @@ async function runSendFlowTest (assert, done) {
sendToFieldInputInEdit[0].focus()
sendToFieldInputInEdit.val('0xd85a4b6a394794842887b8284293d69163007bbb')
- const sendAmountFieldInEdit = await queryAsync($, '.send-v2__form-row:eq(2)')
+ const sendAmountFieldInEdit = await queryAsync($, '.send-v2__form-row:eq(3)')
sendAmountFieldInEdit.find('.unit-input')[0].click()
const sendAmountFieldInputInEdit = sendAmountFieldInEdit.find('.unit-input__input')
--
cgit v1.2.3
From d8b536982e5e074f94400d19f89c615eefc92f74 Mon Sep 17 00:00:00 2001
From: Chi Kei Chan
Date: Wed, 17 Apr 2019 13:34:47 -0700
Subject: Update confirm to use btn-primary (#6473)
* Update confirm to use btn-primary
* Remove console
* Fix e2e test
---
test/e2e/beta/metamask-beta-responsive-ui.spec.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'test')
diff --git a/test/e2e/beta/metamask-beta-responsive-ui.spec.js b/test/e2e/beta/metamask-beta-responsive-ui.spec.js
index b1ed8536e..9ef560556 100644
--- a/test/e2e/beta/metamask-beta-responsive-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-responsive-ui.spec.js
@@ -123,7 +123,7 @@ describe('MetaMask', function () {
})
it('clicks the "I agree" option on the metametrics opt-in screen', async () => {
- const optOutButton = await findElement(driver, By.css('.btn-confirm'))
+ const optOutButton = await findElement(driver, By.css('.btn-primary'))
optOutButton.click()
await delay(largeDelayMs)
})
--
cgit v1.2.3
From 3519e90ffdec61589359f44556994f42492fffd8 Mon Sep 17 00:00:00 2001
From: Chi Kei Chan
Date: Wed, 17 Apr 2019 20:11:04 -0700
Subject: Make height consistent on all row in send-content (#6480)
* Update all send-content row to 54px height
* Remove header subtitle
* Remove tests that check for send screen subheader
---
test/integration/lib/send-new-ui.js | 3 ---
1 file changed, 3 deletions(-)
(limited to 'test')
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index d4c14392f..6a58611d1 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -50,9 +50,6 @@ async function runSendFlowTest (assert, done) {
const sendTitle = await queryAsync($, '.page-container__title')
assert.equal(sendTitle[0].textContent, 'Send ETH', 'Send screen title is correct')
- const sendCopy = await queryAsync($, '.page-container__subtitle')
- assert.equal(sendCopy[0].textContent, 'Only send ETH to an Ethereum address.', 'Send screen has copy')
-
const sendFromField = await queryAsync($, '.send-v2__form-field')
assert.ok(sendFromField[0], 'send screen has a from field')
--
cgit v1.2.3