Fix recipient field of approve screen (#7171)

feature/default_network_editable
Dan J Miller 5 years ago committed by GitHub
parent 7985f4f4f8
commit 5641f1be29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      test/e2e/contract-test/contract.js
  2. 14
      test/e2e/metamask-ui.spec.js
  3. 2
      ui/app/helpers/utils/token-util.js

@ -129,10 +129,10 @@ web3.currentProvider.enable().then(() => {
}) })
approveTokens.addEventListener('click', function () { approveTokens.addEventListener('click', function () {
contract.approve('0x2f318C334780961FB129D2a6c30D0763d9a5C970', '70000', { contract.approve('0x9bc5baF874d2DA8D216aE9f137804184EE5AfEF4', '70000', {
from: web3.eth.accounts[0], from: web3.eth.accounts[0],
to: contract.address, to: contract.address,
data: '0x095ea7b30000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C9700000000000000000000000000000000000000000000000000000000000000005', data: '0x095ea7b30000000000000000000000009bc5baF874d2DA8D216aE9f137804184EE5AfEF40000000000000000000000000000000000000000000000000000000000000005',
gas: 60000, gas: 60000,
gasPrice: '20000000000', gasPrice: '20000000000',
}, function (result) { }, function (result) {

@ -1220,7 +1220,7 @@ describe('MetaMask', function () {
const confirmDataDiv = await findElement(driver, By.css('.confirm-page-container-content__data-box')) const confirmDataDiv = await findElement(driver, By.css('.confirm-page-container-content__data-box'))
const confirmDataText = await confirmDataDiv.getText() const confirmDataText = await confirmDataDiv.getText()
assert(confirmDataText.match(/0x095ea7b30000000000000000000000002f318c334780961fb129d2a6c30d0763d9a5c97/)) assert(confirmDataText.match(/0x095ea7b30000000000000000000000009bc5baf874d2da8d216ae9f137804184ee5afef4/))
const detailsTab = await findElement(driver, By.xpath(`//li[contains(text(), 'Details')]`)) const detailsTab = await findElement(driver, By.xpath(`//li[contains(text(), 'Details')]`))
detailsTab.click() detailsTab.click()
@ -1280,6 +1280,12 @@ describe('MetaMask', function () {
assert.equal(await gasFeeInputs[0].getText(), '0.0006') assert.equal(await gasFeeInputs[0].getText(), '0.0006')
}) })
it('shows the correct recipient', async function () {
const senderToRecipientDivs = await findElements(driver, By.css('.sender-to-recipient__name'))
const recipientDiv = senderToRecipientDivs[1]
assert.equal(await recipientDiv.getText(), '0x9bc5...fEF4')
})
it('submits the transaction', async function () { it('submits the transaction', async function () {
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`)) const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
await confirmButton.click() await confirmButton.click()
@ -1394,6 +1400,12 @@ describe('MetaMask', function () {
await delay(regularDelayMs) await delay(regularDelayMs)
}) })
it('shows the correct recipient', async function () {
const senderToRecipientDivs = await findElements(driver, By.css('.sender-to-recipient__name'))
const recipientDiv = senderToRecipientDivs[1]
assert.equal(await recipientDiv.getText(), 'Account 2')
})
it('submits the transaction', async function () { it('submits the transaction', async function () {
await delay(regularDelayMs) await delay(regularDelayMs)
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`)) const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))

@ -135,5 +135,5 @@ export function getTokenValue (tokenParams = []) {
export function getTokenToAddress (tokenParams = []) { export function getTokenToAddress (tokenParams = []) {
const toAddressData = tokenParams.find(param => param.name === '_to') const toAddressData = tokenParams.find(param => param.name === '_to')
return toAddressData && toAddressData.value return toAddressData ? toAddressData.value : tokenParams[0].value
} }

Loading…
Cancel
Save