1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Adds e2e tests that fail when token decimals are displaying incorrectly.

This commit is contained in:
Dan Miller 2019-06-28 01:22:21 -02:30 committed by Mark Stacey
parent 99209095d1
commit 0e108db3cc
2 changed files with 24 additions and 16 deletions

File diff suppressed because one or more lines are too long

View File

@ -983,9 +983,9 @@ describe('MetaMask', function () {
it('renders the balance for the new token', async () => {
const balance = await findElement(driver, By.css('.transaction-view-balance .transaction-view-balance__primary-balance'))
await driver.wait(until.elementTextMatches(balance, /^100\s*TST\s*$/))
await driver.wait(until.elementTextMatches(balance, /^10.000\s*TST\s*$/))
const tokenAmount = await balance.getText()
assert.ok(/^100\s*TST\s*$/.test(tokenAmount))
assert.ok(/^10.000\s*TST\s*$/.test(tokenAmount))
await delay(regularDelayMs)
})
})
@ -1000,7 +1000,7 @@ describe('MetaMask', function () {
const inputAddress = await findElement(driver, By.css('input[placeholder="Recipient Address"]'))
const inputAmount = await findElement(driver, By.css('.unit-input__input'))
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAmount.sendKeys('50')
await inputAmount.sendKeys('1')
// Set the gas limit
const configureGas = await findElement(driver, By.css('.advanced-gas-options-btn'))
@ -1036,6 +1036,10 @@ describe('MetaMask', function () {
const functionTypeText = await functionType.getText()
assert.equal(functionTypeText, 'Transfer')
const tokenAmount = await findElement(driver, By.css('.confirm-page-container-summary__title-text'))
const tokenAmountText = await tokenAmount.getText()
assert.equal(tokenAmountText, '1 TST')
const confirmDataDiv = await findElement(driver, By.css('.confirm-page-container-content__data-box'))
const confirmDataText = await confirmDataDiv.getText()
@ -1063,7 +1067,7 @@ describe('MetaMask', function () {
// test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved,
// or possibly until we use latest version of firefox in the tests
if (process.env.SELENIUM_BROWSER !== 'firefox') {
await driver.wait(until.elementTextMatches(txValues[0], /-50\s*TST/), 10000)
await driver.wait(until.elementTextMatches(txValues[0], /-1\s*TST/), 10000)
}
await driver.wait(async () => {
@ -1094,7 +1098,7 @@ describe('MetaMask', function () {
await findElements(driver, By.css('.transaction-list__pending-transactions'))
const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
await driver.wait(until.elementTextMatches(txListValue, /-7\s*TST/), 10000)
await driver.wait(until.elementTextMatches(txListValue, /-1.5\s*TST/), 10000)
await txListValue.click()
await delay(regularDelayMs)
@ -1148,6 +1152,10 @@ describe('MetaMask', function () {
})
it('submits the transaction', async function () {
const tokenAmount = await findElement(driver, By.css('.confirm-page-container-summary__title-text'))
const tokenAmountText = await tokenAmount.getText()
assert.equal(tokenAmountText, '1.5 TST')
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
await confirmButton.click()
await delay(regularDelayMs)
@ -1161,7 +1169,7 @@ describe('MetaMask', function () {
await delay(regularDelayMs)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
await driver.wait(until.elementTextMatches(txValues[0], /-7\s*TST/))
await driver.wait(until.elementTextMatches(txValues[0], /-1.5\s*TST/))
const txStatuses = await findElements(driver, By.css('.transaction-list-item__action'))
await driver.wait(until.elementTextMatches(txStatuses[0], /Sent\sToken/), 10000)
@ -1176,7 +1184,7 @@ describe('MetaMask', function () {
// or possibly until we use latest version of firefox in the tests
if (process.env.SELENIUM_BROWSER !== 'firefox') {
const tokenBalanceAmount = await findElements(driver, By.css('.transaction-view-balance__primary-balance'))
await driver.wait(until.elementTextMatches(tokenBalanceAmount[0], /43\s*TST/), 10000)
await driver.wait(until.elementTextMatches(tokenBalanceAmount[0], /7.500\s*TST/), 10000)
}
})
})
@ -1326,7 +1334,7 @@ describe('MetaMask', function () {
const [txListItem] = await findElements(driver, By.css('.transaction-list-item'))
const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
await driver.wait(until.elementTextMatches(txListValue, /-7\s*TST/))
await driver.wait(until.elementTextMatches(txListValue, /-1.5\s*TST/))
await txListItem.click()
await delay(regularDelayMs)
})
@ -1345,7 +1353,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
await driver.wait(until.elementTextMatches(txValues[0], /-7\s*TST/))
await driver.wait(until.elementTextMatches(txValues[0], /-1.5\s*TST/))
const txStatuses = await findElements(driver, By.css('.transaction-list-item__action'))
await driver.wait(until.elementTextMatches(txStatuses[0], /Sent Tokens/))
})