From 74e2225f36fb8ab10f701eb4b86ad9dab1a83474 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Tue, 24 Jul 2018 14:54:13 -0230 Subject: Improve waits for new tx-list-items after first contract method call in e2e beta tests. --- test/e2e/beta/contract-test/contract.js | 5 +++++ test/e2e/beta/contract-test/index.html | 3 +++ test/e2e/beta/metamask-beta-ui.spec.js | 12 +++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/contract-test/contract.js b/test/e2e/beta/contract-test/contract.js index 8af008dce..51891ea21 100644 --- a/test/e2e/beta/contract-test/contract.js +++ b/test/e2e/beta/contract-test/contract.js @@ -50,15 +50,20 @@ deployButton.addEventListener('click', async function (event) { console.log(`contract`, contract) + document.getElementById('contractStatus').innerHTML = 'Deployed' + depositButton.addEventListener('click', function (event) { + document.getElementById('contractStatus').innerHTML = 'Deposit initiated' contract.deposit({ from: web3.eth.accounts[0], value: '0x3782dace9d900000' }, function (result) { console.log(result) + document.getElementById('contractStatus').innerHTML = 'Deposit completed' }) }) withdrawButton.addEventListener('click', function (event) { contract.withdraw('0xde0b6b3a7640000', { from: web3.eth.accounts[0] }, function (result) { console.log(result) + document.getElementById('contractStatus').innerHTML = 'Withdrawn' }) }) } diff --git a/test/e2e/beta/contract-test/index.html b/test/e2e/beta/contract-test/index.html index 0d63fd940..f6e6f44c7 100644 --- a/test/e2e/beta/contract-test/index.html +++ b/test/e2e/beta/contract-test/index.html @@ -10,6 +10,9 @@ +
+ Not yet deployed +
Send eth
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 98132e68c..f5bda4e68 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -516,7 +516,7 @@ describe('MetaMask', function () { it('displays the contract creation data', async () => { const dataTab = await findElement(driver, By.xpath(`//li[contains(text(), 'Data')]`)) - dataTab.click() + await dataTab.click() await delay(regularDelayMs) await findElement(driver, By.xpath(`//div[contains(text(), '127.0.0.1')]`)) @@ -526,7 +526,7 @@ describe('MetaMask', function () { assert.equal(confirmDataText.match(/0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff/)) const detailsTab = await findElement(driver, By.xpath(`//li[contains(text(), 'Details')]`)) - detailsTab.click() + await detailsTab.click() await delay(regularDelayMs) }) @@ -547,9 +547,15 @@ describe('MetaMask', function () { await driver.switchTo().window(dapp) await delay(regularDelayMs) + let contractStatus = await driver.findElement(By.css('#contractStatus')) + await driver.wait(until.elementTextMatches(contractStatus, /Deployed/)) + const depositButton = await findElement(driver, By.css('#depositButton')) await depositButton.click() - await delay(regularDelayMs) + await delay(largeDelayMs) + + contractStatus = await driver.findElement(By.css('#contractStatus')) + await driver.wait(until.elementTextMatches(contractStatus, /Deposit\sinitiated/)) await driver.switchTo().window(extension) await delay(largeDelayMs) -- cgit v1.2.3 From aff66f4b07156d9b69994fd404fe210a3af102bc Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Mon, 6 Aug 2018 11:01:52 -0230 Subject: Use unmodified constant for test delay in from-import-beta-spec. --- test/e2e/beta/from-import-beta-ui.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js index 06e669e5b..5582d4697 100644 --- a/test/e2e/beta/from-import-beta-ui.spec.js +++ b/test/e2e/beta/from-import-beta-ui.spec.js @@ -232,7 +232,7 @@ describe('Using MetaMask with an existing account', function () { const [localhost] = await findElements(driver, By.xpath(`//span[contains(text(), 'Localhost')]`)) await localhost.click() - await delay(largeDelayMs * 2) + await delay(largeDelayMs) }) it('choose Create Account from the account menu', async () => { -- cgit v1.2.3 From 7de2a0687dfdd7e36c8653f31e6e84f12396bf13 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Mon, 6 Aug 2018 11:41:40 -0230 Subject: Fix seed word confirmation step of e2e beta tests. --- test/e2e/beta/metamask-beta-ui.spec.js | 88 +++++++++++----------------------- 1 file changed, 28 insertions(+), 60 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index f5bda4e68..3ad5c2d61 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -195,7 +195,16 @@ describe('MetaMask', function () { await delay(regularDelayMs) }) - async function retypeSeedPhrase (words, wasReloaded) { + async function clickWordAndWait (word) { + const xpathClass = 'backup-phrase__confirm-seed-option backup-phrase__confirm-seed-option--unselected' + const xpath = `//button[@class='${xpathClass}' and contains(text(), '${word}')]` + const word0 = await findElement(driver, By.xpath(xpath), 10000) + + await word0.click() + await delay(tinyDelayMs) + } + + async function retypeSeedPhrase (words, wasReloaded, count = 0) { try { if (wasReloaded) { const byRevealButton = By.css('.backup-phrase__secret-blocker .backup-phrase__reveal-button') @@ -209,67 +218,26 @@ describe('MetaMask', function () { await delay(regularDelayMs) } - const word0 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[0]}')]`), 10000) - - await word0.click() - await delay(tinyDelayMs) - - const word1 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[1]}')]`), 10000) - - await word1.click() - await delay(tinyDelayMs) - - const word2 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[2]}')]`), 10000) - - await word2.click() - await delay(tinyDelayMs) - - const word3 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[3]}')]`), 10000) - - await word3.click() - await delay(tinyDelayMs) - - const word4 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[4]}')]`), 10000) - - await word4.click() - await delay(tinyDelayMs) - - const word5 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[5]}')]`), 10000) + await clickWordAndWait(words[0]) + await clickWordAndWait(words[1]) + await clickWordAndWait(words[2]) + await clickWordAndWait(words[3]) + await clickWordAndWait(words[4]) + await clickWordAndWait(words[5]) + await clickWordAndWait(words[6]) + await clickWordAndWait(words[7]) + await clickWordAndWait(words[8]) + await clickWordAndWait(words[9]) + await clickWordAndWait(words[10]) + await clickWordAndWait(words[11]) - await word5.click() - await delay(tinyDelayMs) - - const word6 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[6]}')]`), 10000) - - await word6.click() - await delay(tinyDelayMs) - - const word7 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[7]}')]`), 10000) - - await word7.click() - await delay(tinyDelayMs) - - const word8 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[8]}')]`), 10000) - - await word8.click() - await delay(tinyDelayMs) - - const word9 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[9]}')]`), 10000) - - await word9.click() - await delay(tinyDelayMs) - - const word10 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[10]}')]`), 10000) - - 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) } catch (e) { - await loadExtension(driver, extensionId) - await retypeSeedPhrase(words, true) + if (count > 2) { + throw e + } else { + await loadExtension(driver, extensionId) + await retypeSeedPhrase(words, true, count + 1) + } } } -- cgit v1.2.3 From d1435fb883395115e2f7d7df3bcbb5ea8b873474 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 6 Aug 2018 13:40:02 -0230 Subject: Switch superstatic for static-server pkg --- test/e2e/beta/run-all.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/run-all.sh b/test/e2e/beta/run-all.sh index 493e1360a..7da61e504 100755 --- a/test/e2e/beta/run-all.sh +++ b/test/e2e/beta/run-all.sh @@ -6,5 +6,5 @@ set -o pipefail export PATH="$PATH:./node_modules/.bin" -shell-parallel -s 'npm run ganache:start' -x 'sleep 5 && superstatic test/e2e/beta/contract-test/ --port 8080 --host 127.0.0.1' -x 'sleep 5 && mocha test/e2e/beta/metamask-beta-ui.spec' -shell-parallel -s 'npm run ganache:start -- -d' -x 'sleep 5 && superstatic test/e2e/beta/contract-test/ --port 8080 --host 127.0.0.1' -x 'sleep 5 && mocha test/e2e/beta/from-import-beta-ui.spec' +shell-parallel -s 'npm run ganache:start' -x 'sleep 5 && static-server test/e2e/beta/contract-test/ --port 8080' -x 'sleep 5 && mocha test/e2e/beta/metamask-beta-ui.spec' +shell-parallel -s 'npm run ganache:start -- -d' -x 'sleep 5 && static-server test/e2e/beta/contract-test/ --port 8080' -x 'sleep 5 && mocha test/e2e/beta/from-import-beta-ui.spec' -- cgit v1.2.3