From 2381c0e0f461304265279155176fa655e2eb97b4 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Thu, 10 May 2018 16:51:26 -0700 Subject: Add new unlock screen design --- test/integration/lib/mascara-first-time.js | 19 ++++++++++++++++--- test/integration/lib/tx-list-items.js | 4 ++-- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/integration/lib/mascara-first-time.js b/test/integration/lib/mascara-first-time.js index 5e07ab0b4..d86703277 100644 --- a/test/integration/lib/mascara-first-time.js +++ b/test/integration/lib/mascara-first-time.js @@ -71,10 +71,23 @@ async function runFirstTimeUsageTest (assert, done) { assert.ok(lock, 'Lock menu item found') lock.click() - const pwBox2 = (await findAsync(app, '#password-box'))[0] - pwBox2.value = PASSWORD + await timeout(1000) - const createButton2 = (await findAsync(app, 'button.primary'))[0] + const pwBox2 = (await findAsync(app, '#password'))[0] + pwBox2.focus() + await timeout(1000) + + // Used to set values on TextField input component + const nativeInputValueSetter = Object.getOwnPropertyDescriptor( + window.HTMLInputElement.prototype, 'value' + ).set + + nativeInputValueSetter.call(pwBox2, PASSWORD) + + var ev2 = new Event('input', { bubbles: true}) + pwBox2.dispatchEvent(ev2) + + const createButton2 = (await findAsync(app, 'button[type="submit"]'))[0] createButton2.click() const detail2 = (await findAsync(app, '.wallet-view'))[0] diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index 0c0c5a77f..4856b3852 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -21,7 +21,7 @@ async function runTxListItemsTest(assert, done) { selectState.val('tx list items') reactTriggerChange(selectState[0]) - const metamaskLogo = await queryAsync($, '.left-menu-wrapper') + const metamaskLogo = await queryAsync($, '.app-header__logo-container') assert.ok(metamaskLogo[0], 'metamask logo present') metamaskLogo[0].click() @@ -46,7 +46,7 @@ async function runTxListItemsTest(assert, done) { const failedTx = txListItems[4] const failedTxRenderedStatus = await findAsync($(failedTx), '.tx-list-status') assert.equal(failedTxRenderedStatus[0].textContent, 'Failed', 'failedTx has correct label') - + const shapeShiftTx = txListItems[5] const shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)') assert.equal(shapeShiftTxStatus[0].textContent, 'No deposits received', 'shapeShiftTx has correct status') -- cgit v1.2.3 From 0bcfbc15446b01b3b87233715cd3ead42d2730e4 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Sat, 12 May 2018 20:53:40 -0700 Subject: Add error message when passwords don't match in first time flow. Change input field styling in first time flow --- test/integration/lib/mascara-first-time.js | 29 ++++++++++++++--------------- test/screens/new-ui.js | 4 ++-- 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/integration/lib/mascara-first-time.js b/test/integration/lib/mascara-first-time.js index d86703277..f43a30c74 100644 --- a/test/integration/lib/mascara-first-time.js +++ b/test/integration/lib/mascara-first-time.js @@ -1,5 +1,4 @@ const PASSWORD = 'password123' -const reactTriggerChange = require('react-trigger-change') const { timeout, findAsync, @@ -11,6 +10,11 @@ async function runFirstTimeUsageTest (assert, done) { const app = await queryAsync($, '#app-content') + // Used to set values on TextField input component + const nativeInputValueSetter = Object.getOwnPropertyDescriptor( + window.HTMLInputElement.prototype, 'value' + ).set + await skipNotices(app) const welcomeButton = (await findAsync(app, '.welcome-screen__button'))[0] @@ -21,12 +25,14 @@ async function runFirstTimeUsageTest (assert, done) { assert.equal(title, 'Create Password', 'create password screen') // enter password - const pwBox = (await findAsync(app, '.first-time-flow__input'))[0] - const confBox = (await findAsync(app, '.first-time-flow__input'))[1] - pwBox.value = PASSWORD - confBox.value = PASSWORD - reactTriggerChange(pwBox) - reactTriggerChange(confBox) + const pwBox = (await findAsync(app, '#create-password'))[0] + const confBox = (await findAsync(app, '#confirm-password'))[0] + + nativeInputValueSetter.call(pwBox, PASSWORD) + pwBox.dispatchEvent(new Event('input', { bubbles: true})) + + nativeInputValueSetter.call(confBox, PASSWORD) + confBox.dispatchEvent(new Event('input', { bubbles: true})) // Create Password const createButton = (await findAsync(app, 'button.first-time-flow__button'))[0] @@ -77,15 +83,8 @@ async function runFirstTimeUsageTest (assert, done) { pwBox2.focus() await timeout(1000) - // Used to set values on TextField input component - const nativeInputValueSetter = Object.getOwnPropertyDescriptor( - window.HTMLInputElement.prototype, 'value' - ).set - nativeInputValueSetter.call(pwBox2, PASSWORD) - - var ev2 = new Event('input', { bubbles: true}) - pwBox2.dispatchEvent(ev2) + pwBox2.dispatchEvent(new Event('input', { bubbles: true})) const createButton2 = (await findAsync(app, 'button[type="submit"]'))[0] createButton2.click() diff --git a/test/screens/new-ui.js b/test/screens/new-ui.js index e176da529..6a8822eb3 100644 --- a/test/screens/new-ui.js +++ b/test/screens/new-ui.js @@ -74,8 +74,8 @@ async function captureAllScreens() { await driver.findElement(By.css('button')).click() await captureLanguageScreenShots('create password') - const passwordBox = await driver.findElement(By.css('input[type=password]:nth-of-type(1)')) - const passwordBoxConfirm = await driver.findElement(By.css('input[type=password]:nth-of-type(2)')) + const passwordBox = await driver.findElement(By.css('input#create-password')) + const passwordBoxConfirm = await driver.findElement(By.css('input#confirm-password')) passwordBox.sendKeys('123456789') passwordBoxConfirm.sendKeys('123456789') await delay(500) -- cgit v1.2.3 From 6afd169e603fead364aa3608c90e6e8a20fcb0dc Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 14 May 2018 13:57:19 -0230 Subject: e2e: Use newest window as MM tx confirm popup --- test/e2e/chrome/metamask.spec.js | 2 +- test/e2e/firefox/metamask.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/e2e/chrome/metamask.spec.js b/test/e2e/chrome/metamask.spec.js index d72ebe1a9..87ccf8a83 100644 --- a/test/e2e/chrome/metamask.spec.js +++ b/test/e2e/chrome/metamask.spec.js @@ -237,7 +237,7 @@ describe('Metamask popup page', function () { it('confirms transaction in MetaMask popup', async function () { const windowHandles = await driver.getAllWindowHandles() - await driver.switchTo().window(windowHandles[2]) + await driver.switchTo().window(windowHandles[windowHandles.length - 1]) const metamaskSubmit = await driver.findElement(By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input')) await metamaskSubmit.click() await delay(1000) diff --git a/test/e2e/firefox/metamask.spec.js b/test/e2e/firefox/metamask.spec.js index 20b8a5092..26e5dfb40 100644 --- a/test/e2e/firefox/metamask.spec.js +++ b/test/e2e/firefox/metamask.spec.js @@ -238,7 +238,7 @@ describe('', function () { // There is an issue with blank confirmation window, but the button is still there and the driver is able to clicked (?.?) it('confirms transaction in MetaMask popup', async function () { const windowHandles = await driver.getAllWindowHandles() - await driver.switchTo().window(windowHandles[2]) + await driver.switchTo().window(windowHandles[windowHandles.length - 1]) const metamaskSubmit = await driver.findElement(By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input')) await metamaskSubmit.click() await delay(1000) -- cgit v1.2.3 From 4e91fc863987fa002aa4184316282ebac9945735 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 14 May 2018 13:57:58 -0230 Subject: e2e: Adjust the extension ID query for newer Chrome versions --- test/e2e/chrome/metamask.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/e2e/chrome/metamask.spec.js b/test/e2e/chrome/metamask.spec.js index 87ccf8a83..b17d4c818 100644 --- a/test/e2e/chrome/metamask.spec.js +++ b/test/e2e/chrome/metamask.spec.js @@ -291,7 +291,7 @@ describe('Metamask popup page', function () { }) async function getExtensionId () { - const extension = await driver.executeScript('return document.querySelector("extensions-manager").shadowRoot.querySelector("extensions-view-manager extensions-item-list").shadowRoot.querySelector("#container > div.items-container > extensions-item:nth-child(2)").getAttribute("id")') + const extension = await driver.executeScript('return document.querySelector("extensions-manager").shadowRoot.querySelector("extensions-view-manager extensions-item-list").shadowRoot.querySelector("extensions-item:nth-child(2)").getAttribute("id")') return extension } -- cgit v1.2.3 From dc6f6addb9551c599dfef6a75bf59e8531a26d82 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 14 May 2018 13:58:56 -0230 Subject: e2e: Wait a bit before clicking through privacy screen The network connection can take a bit so we need to wait for the spinner to go away. --- test/e2e/firefox/metamask.spec.js | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/e2e/firefox/metamask.spec.js b/test/e2e/firefox/metamask.spec.js index 26e5dfb40..1bb76a6b5 100644 --- a/test/e2e/firefox/metamask.spec.js +++ b/test/e2e/firefox/metamask.spec.js @@ -59,6 +59,7 @@ describe('', function () { }) it('shows privacy notice', async () => { + await delay(300) const privacy = await driver.findElement(By.css('.terms-header')).getText() assert.equal(privacy, 'PRIVACY NOTICE', 'shows privacy notice') await driver.findElement(By.css('button')).click() -- cgit v1.2.3 From 6926e4e9d26518e644ec9f8bd3316af087a52c9f Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 14 May 2018 14:01:28 -0230 Subject: e2e: Use the more reliable enter key for logging in --- test/e2e/firefox/metamask.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/e2e/firefox/metamask.spec.js b/test/e2e/firefox/metamask.spec.js index 1bb76a6b5..c75b1a9b5 100644 --- a/test/e2e/firefox/metamask.spec.js +++ b/test/e2e/firefox/metamask.spec.js @@ -126,7 +126,7 @@ describe('', function () { it('accepts account password after lock', async () => { await delay(500) await driver.findElement(By.id('password-box')).sendKeys('123456789') - await driver.findElement(By.css('button')).click() + await driver.findElement(By.id('password-box')).sendKeys(webdriver.Key.ENTER) await delay(500) }) -- cgit v1.2.3