From 30a2be85eebe4f6b8cddb297f14faba392fe1133 Mon Sep 17 00:00:00 2001
From: Alexander Tseung <alextsg@users.noreply.github.com>
Date: Thu, 13 Dec 2018 18:19:36 -0800
Subject: Prevent users from changing the From field in the send screen (#5922)

* Prevent users from changing the From field in the send screen

* Fix integration tests
---
 test/integration/lib/send-new-ui.js | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

(limited to 'test/integration/lib/send-new-ui.js')

diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index 1acd85a35..145c9ad3b 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -54,23 +54,14 @@ async function runSendFlowTest (assert, done) {
   const sendFromField = await queryAsync($, '.send-v2__form-field')
   assert.ok(sendFromField[0], 'send screen has a from field')
 
-  let sendFromFieldItemAddress = await queryAsync($, '.account-list-item__account-name')
-  assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 4', 'send from field shows correct account name')
-
-  const sendFromFieldItem = await queryAsync($, '.account-list-item')
-  sendFromFieldItem[0].click()
-
-  // this seems to fail if the firefox window is not in focus...
-  const sendFromDropdownList = await queryAsync($, '.send-v2__from-dropdown__list')
-  assert.equal(sendFromDropdownList.children().length, 4, 'send from dropdown shows all accounts')
-  sendFromDropdownList.children()[1].click()
-
-  sendFromFieldItemAddress = await queryAsync($, '.account-list-item__account-name')
-  assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 2', 'send from field dropdown changes account name')
+  const sendFromFieldItemAddress = await queryAsync($, '.account-list-item__account-name')
+  assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 2', 'send from field shows correct account name')
 
   const sendToFieldInput = await queryAsync($, '.send-v2__to-autocomplete__input')
   sendToFieldInput[0].focus()
 
+  await timeout(1000)
+
   const sendToDropdownList = await queryAsync($, '.send-v2__from-dropdown__list')
   assert.equal(sendToDropdownList.children().length, 5, 'send to dropdown shows all accounts and address book accounts')
 
@@ -104,7 +95,7 @@ async function runSendFlowTest (assert, done) {
   reactTriggerChange(selectState[0])
 
   const confirmFromName = (await queryAsync($, '.sender-to-recipient__name')).first()
-  assert.equal(confirmFromName[0].textContent, 'Send Account 4', 'confirm screen should show correct from name')
+  assert.equal(confirmFromName[0].textContent, 'Send Account 2', 'confirm screen should show correct from name')
 
   const confirmToName = (await queryAsync($, '.sender-to-recipient__name')).last()
   assert.equal(confirmToName[0].textContent, 'Send Account 3', 'confirm screen should show correct to name')
@@ -118,12 +109,6 @@ async function runSendFlowTest (assert, done) {
   const confirmScreenBackButton = await queryAsync($, '.confirm-page-container-header__back-button')
   confirmScreenBackButton[0].click()
 
-  const sendFromFieldItemInEdit = await queryAsync($, '.account-list-item')
-  sendFromFieldItemInEdit[0].click()
-
-  const sendFromDropdownListInEdit = await queryAsync($, '.send-v2__from-dropdown__list')
-  sendFromDropdownListInEdit.children()[2].click()
-
   const sendToFieldInputInEdit = await queryAsync($, '.send-v2__to-autocomplete__input')
   sendToFieldInputInEdit[0].focus()
   sendToFieldInputInEdit.val('0xd85a4b6a394794842887b8284293d69163007bbb')
-- 
cgit