1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 23:58:06 +01:00

Fix bugs in e2e tests related to gas customization inputs.

This commit is contained in:
Dan Miller 2019-01-24 12:28:47 -03:30 committed by Whymarrh Whitby
parent 76f9bdec63
commit bf4b6770a0

View File

@ -635,7 +635,7 @@ describe('MetaMask', function () {
await confirmButton.click() await confirmButton.click()
await delay(largeDelayMs) await delay(largeDelayMs)
driver.wait(async () => { await driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
return confirmedTxes.length === 4 return confirmedTxes.length === 4
}, 10000) }, 10000)
@ -695,7 +695,7 @@ describe('MetaMask', function () {
await confirmButton.click() await confirmButton.click()
await delay(regularDelayMs) await delay(regularDelayMs)
driver.wait(async () => { await driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
return confirmedTxes.length === 5 return confirmedTxes.length === 5
}, 10000) }, 10000)
@ -727,7 +727,7 @@ describe('MetaMask', function () {
await confirmButton.click() await confirmButton.click()
await delay(regularDelayMs) await delay(regularDelayMs)
driver.wait(async () => { await driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
return confirmedTxes.length === 6 return confirmedTxes.length === 6
}, 10000) }, 10000)
@ -911,7 +911,7 @@ describe('MetaMask', function () {
await driver.wait(until.elementTextMatches(txValues[0], /-50\s*TST/), 10000) await driver.wait(until.elementTextMatches(txValues[0], /-50\s*TST/), 10000)
} }
driver.wait(async () => { await driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
return confirmedTxes.length === 1 return confirmedTxes.length === 1
}, 10000) }, 10000)
@ -962,26 +962,29 @@ describe('MetaMask', function () {
const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.advanced-tab__gas-edit-row__input')) const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.advanced-tab__gas-edit-row__input'))
await gasPriceInput.clear() await gasPriceInput.clear()
await delay(tinyDelayMs) await delay(tinyDelayMs)
await gasPriceInput.sendKeys(Key.BACK_SPACE)
await gasPriceInput.sendKeys(Key.BACK_SPACE)
await gasPriceInput.sendKeys('10') await gasPriceInput.sendKeys('10')
await delay(tinyDelayMs) await delay(tinyDelayMs)
await gasLimitInput.clear() await gasLimitInput.clear()
await delay(tinyDelayMs) await delay(tinyDelayMs)
await gasLimitInput.sendKeys(Key.chord(Key.CONTROL, 'a')) await gasLimitInput.sendKeys(Key.chord(Key.CONTROL, 'a'))
await gasLimitInput.sendKeys(Key.BACK_SPACE)
await gasLimitInput.sendKeys(Key.BACK_SPACE)
await gasLimitInput.sendKeys(Key.BACK_SPACE)
await gasLimitInput.sendKeys(Key.BACK_SPACE)
await gasLimitInput.sendKeys(Key.BACK_SPACE)
await gasLimitInput.sendKeys('60000') await gasLimitInput.sendKeys('60000')
await gasLimitInput.sendKeys(Key.chord(Key.CONTROL, 'e')) await gasLimitInput.sendKeys(Key.chord(Key.CONTROL, 'e'))
// Needed for different behaviour of input in different versions of firefox
const gasLimitInputValue = await gasLimitInput.getAttribute('value')
if (gasLimitInputValue === '600001') {
await gasLimitInput.sendKeys(Key.BACK_SPACE)
}
const save = await findElement(driver, By.css('.page-container__footer-button')) const save = await findElement(driver, By.css('.page-container__footer-button'))
await save.click() await save.click()
await driver.wait(until.stalenessOf(gasModal)) await driver.wait(until.stalenessOf(gasModal))
const gasFeeInputs = await findElements(driver, By.css('.confirm-detail-row__primary')) const gasFeeInputs = await findElements(driver, By.css('.confirm-detail-row__primary'))
assert.equal(await gasFeeInputs[0].getText(), '0.0006') const renderedGasFee = await gasFeeInputs[0].getText()
assert.equal(renderedGasFee, '0.0006')
}) })
it('submits the transaction', async function () { it('submits the transaction', async function () {
@ -991,7 +994,7 @@ describe('MetaMask', function () {
}) })
it('finds the transaction in the transactions list', async function () { it('finds the transaction in the transactions list', async function () {
driver.wait(async () => { await driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
return confirmedTxes.length === 2 return confirmedTxes.length === 2
}, 10000) }, 10000)
@ -1036,7 +1039,7 @@ describe('MetaMask', function () {
await driver.switchTo().window(extension) await driver.switchTo().window(extension)
await delay(regularDelayMs) await delay(regularDelayMs)
driver.wait(async () => { await driver.wait(async () => {
const pendingTxes = await findElements(driver, By.css('.transaction-list__pending-transactions .transaction-list-item')) const pendingTxes = await findElements(driver, By.css('.transaction-list__pending-transactions .transaction-list-item'))
return pendingTxes.length === 1 return pendingTxes.length === 1
}, 10000) }, 10000)
@ -1116,7 +1119,7 @@ describe('MetaMask', function () {
}) })
it('finds the transaction in the transactions list', async function () { it('finds the transaction in the transactions list', async function () {
driver.wait(async () => { await driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
return confirmedTxes.length === 3 return confirmedTxes.length === 3
}, 10000) }, 10000)