aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-07-04 00:40:25 +0800
committerGitHub <noreply@github.com>2018-07-04 00:40:25 +0800
commit1f0cf11af1c94e750bbc4c5238c3ee028350a6c6 (patch)
tree5e8d89ef2d904d7b8dffaa356a6b21a8b542a693 /test/e2e
parent4d9ef0dd7f3e788f7734c505b72edb4657ddec9d (diff)
parent53f1072ff467d6284d1fc3143330961749baaf5e (diff)
downloadtangerine-wallet-browser-1f0cf11af1c94e750bbc4c5238c3ee028350a6c6.tar.gz
tangerine-wallet-browser-1f0cf11af1c94e750bbc4c5238c3ee028350a6c6.tar.zst
tangerine-wallet-browser-1f0cf11af1c94e750bbc4c5238c3ee028350a6c6.zip
Merge pull request #4712 from MetaMask/lint-fix
Lint - Lint all the things (without conflicts!)
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/beta/contract-test/contract.js29
-rw-r--r--test/e2e/beta/from-import-beta-ui.spec.js14
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js15
-rw-r--r--test/e2e/metamask.spec.js2
4 files changed, 31 insertions, 29 deletions
diff --git a/test/e2e/beta/contract-test/contract.js b/test/e2e/beta/contract-test/contract.js
index 19c29e5c1..18c866f21 100644
--- a/test/e2e/beta/contract-test/contract.js
+++ b/test/e2e/beta/contract-test/contract.js
@@ -28,21 +28,24 @@ The `piggybankContract` is compiled from:
}
*/
-var piggybankContract = web3.eth.contract([{"constant":false,"inputs":[{"name":"withdrawAmount","type":"uint256"}],"name":"withdraw","outputs":[{"name":"remainingBal","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"deposit","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]);
+var piggybankContract = web3.eth.contract([{'constant': false, 'inputs': [{'name': 'withdrawAmount', 'type': 'uint256'}], 'name': 'withdraw', 'outputs': [{'name': 'remainingBal', 'type': 'uint256'}], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [], 'name': 'owner', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [], 'name': 'deposit', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': true, 'stateMutability': 'payable', 'type': 'function'}, {'inputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'constructor'}])
+const deployButton = document.getElementById('deployButton')
+const depositButton = document.getElementById('depositButton')
+const withdrawButton = document.getElementById('withdrawButton')
-deployButton.addEventListener('click', function (event) {
-
- var piggybank = piggybankContract.new(
+deployButton.addEventListener('click', async function (event) {
+
+ var piggybank = await piggybankContract.new(
{
- from: web3.eth.accounts[0],
- data: '0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029',
- gas: '4700000'
- }, function (e, contract){
- console.log(e, contract);
+ from: web3.eth.accounts[0],
+ data: '0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029',
+ gas: '4700000',
+ }, function (e, contract) {
+ console.log(e, contract)
if (typeof contract.address !== 'undefined') {
- console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
+ console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash)
- console.log(`contract`, contract);
+ console.log(`contract`, contract)
depositButton.addEventListener('click', function (event) {
contract.deposit({ from: web3.eth.accounts[0], value: '0x29a2241af62c0000' }, function (result) {
@@ -58,4 +61,6 @@ deployButton.addEventListener('click', function (event) {
}
})
-}) \ No newline at end of file
+ console.log(piggybank)
+
+})
diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js
index 38fdedcec..b396dc5b9 100644
--- a/test/e2e/beta/from-import-beta-ui.spec.js
+++ b/test/e2e/beta/from-import-beta-ui.spec.js
@@ -12,7 +12,6 @@ const {
} = require('../func')
const {
checkBrowserForConsoleErrors,
- loadExtension,
verboseReportOnFailure,
findElement,
findElements,
@@ -22,14 +21,12 @@ const {
describe('Using MetaMask with an existing account', function () {
let extensionId
let driver
- let tokenAddress
const testSeedPhrase = 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent'
const testAddress = '0xE18035BF8712672935FDB4e5e431b1a0183d2DFC'
const testPrivateKey2 = '14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6'
const regularDelayMs = 1000
const largeDelayMs = regularDelayMs * 2
- const waitingNewPageDelayMs = regularDelayMs * 10
this.timeout(0)
this.bail(true)
@@ -98,15 +95,16 @@ describe('Using MetaMask with an existing account', function () {
await delay(regularDelayMs)
// Close all other tabs
- let [oldUi, infoPage, newUi] = await driver.getAllWindowHandles()
- newUi = newUi || infoPage
+ const [oldUi, infoPage, newUi] = await driver.getAllWindowHandles()
+
+ const newUiOrInfoPage = newUi || infoPage
await driver.switchTo().window(oldUi)
await driver.close()
- if (infoPage !== newUi) {
+ if (infoPage !== newUiOrInfoPage) {
await driver.switchTo().window(infoPage)
await driver.close()
}
- await driver.switchTo().window(newUi)
+ await driver.switchTo().window(newUiOrInfoPage)
await delay(regularDelayMs)
const continueBtn = await findElement(driver, By.css('.welcome-screen__button'))
@@ -322,5 +320,5 @@ describe('Using MetaMask with an existing account', function () {
await delay(regularDelayMs)
})
})
-
+
})
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index 0f424abcc..5f270b52b 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -28,7 +28,6 @@ describe('MetaMask', function () {
const tinyDelayMs = 1000
const regularDelayMs = tinyDelayMs * 2
const largeDelayMs = regularDelayMs * 2
- const waitingNewPageDelayMs = regularDelayMs * 30
this.timeout(0)
this.bail(true)
@@ -100,7 +99,7 @@ describe('MetaMask', function () {
await delay(regularDelayMs)
// Close all other tabs
- let [oldUi, tab1, tab2] = await driver.getAllWindowHandles()
+ const [oldUi, tab1, tab2] = await driver.getAllWindowHandles()
await driver.switchTo().window(oldUi)
await driver.close()
@@ -245,7 +244,7 @@ describe('MetaMask', function () {
await word10.click()
await delay(tinyDelayMs)
-
+
const word11 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[11]}')]`), 10000)
await word11.click()
await delay(tinyDelayMs)
@@ -281,7 +280,7 @@ describe('MetaMask', function () {
await driver.findElement(By.css('.qr-wrapper')).isDisplayed()
await delay(regularDelayMs)
- let accountModal = await driver.findElement(By.css('span .modal'))
+ const accountModal = await driver.findElement(By.css('span .modal'))
await driver.executeScript("document.querySelector('.account-modal-close').click()")
@@ -499,7 +498,7 @@ describe('MetaMask', function () {
await configureGas.click()
await delay(regularDelayMs)
- let gasModal = await driver.findElement(By.css('span .modal'))
+ const gasModal = await driver.findElement(By.css('span .modal'))
await driver.wait(until.elementLocated(By.css('.send-v2__customize-gas__title')))
const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.customize-gas-input'))
@@ -700,7 +699,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER !== 'firefox') {
await driver.wait(until.elementTextMatches(txValues[0], /50\sTST/), 10000)
}
-
+
const txStatuses = await findElements(driver, By.css('.tx-list-status'))
const tx = await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed|Failed/), 10000)
assert.equal(await tx.getText(), 'Confirmed')
@@ -712,7 +711,7 @@ describe('MetaMask', function () {
it('sends an already created token', async () => {
openNewPage(driver, `https://tokenfactory.surge.sh/#/token/${tokenAddress}`)
- const [extension, tokenFactory] = await driver.getAllWindowHandles()
+ const [extension] = await driver.getAllWindowHandles()
const [
transferToAddress,
@@ -759,7 +758,7 @@ describe('MetaMask', function () {
await gasLimitInput.sendKeys(Key.chord(Key.CONTROL, 'e'))
// Needed for different behaviour of input in different versions of firefox
- const gasLimitInputValue = await gasLimitInput.getAttribute('value')
+ const gasLimitInputValue = await gasLimitInput.getAttribute('value')
if (gasLimitInputValue === '600001') {
await gasLimitInput.sendKeys(Key.BACK_SPACE)
}
diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js
index 6ab21dfcd..a32b924b8 100644
--- a/test/e2e/metamask.spec.js
+++ b/test/e2e/metamask.spec.js
@@ -335,7 +335,7 @@ describe('Metamask popup page', function () {
await driver.executeScript('window.metamask.setProviderType(arguments[0])', type)
}
- async function checkBrowserForConsoleErrors() {
+ async function checkBrowserForConsoleErrors () {
const ignoredLogTypes = ['WARNING']
const ignoredErrorMessages = [
// React throws error warnings on "dataset", but still sets the data-* properties correctly