mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
Fix existing e2e tests
This commit is contained in:
parent
1a0a701de0
commit
228b807221
@ -196,8 +196,20 @@ describe('MetaMask', function () {
|
|||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
|
|
||||||
async function retypeSeedPhrase (words) {
|
async function retypeSeedPhrase (words, wasReloaded) {
|
||||||
try {
|
try {
|
||||||
|
if (wasReloaded) {
|
||||||
|
const byRevealButton = By.css('.backup-phrase__secret-blocker .backup-phrase__reveal-button')
|
||||||
|
await driver.wait(until.elementLocated(byRevealButton, 10000))
|
||||||
|
const revealSeedPhraseButton = await findElement(driver, byRevealButton, 10000)
|
||||||
|
await revealSeedPhraseButton.click()
|
||||||
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
|
const nextScreen = await findElement(driver, By.css('.backup-phrase button'))
|
||||||
|
await nextScreen.click()
|
||||||
|
await delay(regularDelayMs)
|
||||||
|
}
|
||||||
|
|
||||||
const word0 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[0]}')]`), 10000)
|
const word0 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[0]}')]`), 10000)
|
||||||
|
|
||||||
await word0.click()
|
await word0.click()
|
||||||
@ -258,7 +270,7 @@ describe('MetaMask', function () {
|
|||||||
await delay(tinyDelayMs)
|
await delay(tinyDelayMs)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await loadExtension(driver, extensionId)
|
await loadExtension(driver, extensionId)
|
||||||
await retypeSeedPhrase(words)
|
await retypeSeedPhrase(words, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +323,7 @@ describe('MetaMask', function () {
|
|||||||
it('accepts the account password after lock', async () => {
|
it('accepts the account password after lock', async () => {
|
||||||
await driver.findElement(By.id('password')).sendKeys('correct horse battery staple')
|
await driver.findElement(By.id('password')).sendKeys('correct horse battery staple')
|
||||||
await driver.findElement(By.id('password')).sendKeys(Key.ENTER)
|
await driver.findElement(By.id('password')).sendKeys(Key.ENTER)
|
||||||
await delay(regularDelayMs * 4)
|
await delay(largeDelayMs * 4)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -390,6 +402,9 @@ describe('MetaMask', function () {
|
|||||||
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
|
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
|
||||||
await inputAmount.sendKeys('1')
|
await inputAmount.sendKeys('1')
|
||||||
|
|
||||||
|
const inputValue = await inputAmount.getAttribute('value')
|
||||||
|
assert.equal(inputValue, '1')
|
||||||
|
|
||||||
// Set the gas limit
|
// Set the gas limit
|
||||||
const configureGas = await findElement(driver, By.css('.send-v2__gas-fee-display button'))
|
const configureGas = await findElement(driver, By.css('.send-v2__gas-fee-display button'))
|
||||||
await configureGas.click()
|
await configureGas.click()
|
||||||
@ -515,12 +530,12 @@ describe('MetaMask', function () {
|
|||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
// Set the gas limit
|
// Set the gas limit
|
||||||
const configureGas = await findElement(driver, By.css('.sliders-icon-container'))
|
const configureGas = await findElement(driver, By.css('.confirm-detail-row__header-text--edit'))
|
||||||
await configureGas.click()
|
await configureGas.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
const gasModal = await driver.findElement(By.css('span .modal'))
|
const gasModal = await driver.findElement(By.css('span .modal'))
|
||||||
await driver.wait(until.elementLocated(By.css('.send-v2__customize-gas__title')))
|
await driver.wait(until.elementLocated(By.css('.customize-gas__title')))
|
||||||
|
|
||||||
const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.customize-gas-input'))
|
const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.customize-gas-input'))
|
||||||
await gasPriceInput.clear()
|
await gasPriceInput.clear()
|
||||||
@ -680,7 +695,7 @@ describe('MetaMask', function () {
|
|||||||
gasModal = await driver.findElement(By.css('span .modal'))
|
gasModal = await driver.findElement(By.css('span .modal'))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('customizes gas', async () => {
|
it('opens customizes gas modal', async () => {
|
||||||
await driver.wait(until.elementLocated(By.css('.send-v2__customize-gas__title')))
|
await driver.wait(until.elementLocated(By.css('.send-v2__customize-gas__title')))
|
||||||
const save = await findElement(driver, By.xpath(`//button[contains(text(), 'Save')]`))
|
const save = await findElement(driver, By.xpath(`//button[contains(text(), 'Save')]`))
|
||||||
await save.click()
|
await save.click()
|
||||||
@ -747,7 +762,7 @@ describe('MetaMask', function () {
|
|||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
// Set the gas limit
|
// Set the gas limit
|
||||||
const configureGas = await driver.wait(until.elementLocated(By.css('.send-v2__gas-fee-display button')))
|
const configureGas = await driver.wait(until.elementLocated(By.css('.confirm-detail-row__header-text--edit')))
|
||||||
await configureGas.click()
|
await configureGas.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
@ -755,7 +770,7 @@ describe('MetaMask', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('customizes gas', async () => {
|
it('customizes gas', async () => {
|
||||||
await driver.wait(until.elementLocated(By.css('.send-v2__customize-gas__title')))
|
await driver.wait(until.elementLocated(By.css('.customize-gas__title')))
|
||||||
|
|
||||||
const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.customize-gas-input'))
|
const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.customize-gas-input'))
|
||||||
await gasPriceInput.clear()
|
await gasPriceInput.clear()
|
||||||
@ -774,12 +789,12 @@ describe('MetaMask', function () {
|
|||||||
await gasLimitInput.sendKeys(Key.BACK_SPACE)
|
await gasLimitInput.sendKeys(Key.BACK_SPACE)
|
||||||
}
|
}
|
||||||
|
|
||||||
const save = await findElement(driver, By.css('.send-v2__customize-gas__save'))
|
const save = await findElement(driver, By.css('.customize-gas__save'))
|
||||||
await save.click()
|
await save.click()
|
||||||
await driver.wait(until.stalenessOf(gasModal))
|
await driver.wait(until.stalenessOf(gasModal))
|
||||||
|
|
||||||
const gasFeeInput = await findElement(driver, By.css('.currency-display__input'))
|
const gasFeeInputs = await findElements(driver, By.css('.confirm-detail-row__eth'))
|
||||||
assert.equal(await gasFeeInput.getAttribute('value'), 0.0006)
|
assert.equal(await gasFeeInputs[0].getText(), '♦ 0.0006')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('submits the transaction', async function () {
|
it('submits the transaction', async function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user