1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

metamask-beta-ui.spec.js tests custom token send before searched token.

This commit is contained in:
Dan 2018-06-08 11:16:47 -02:30
parent 9cb15d44a0
commit 9734e6ffb8

View File

@ -160,8 +160,9 @@ describe('MetaMask', function () {
let seedPhrase
it('reveals the seed phrase', async () => {
const revealSeedPhrase = await findElement(driver, By.css('.backup-phrase__secret-blocker'), 14000)
await revealSeedPhrase.click()
await driver.wait(until.elementIsVisible(By.css('.backup-phrase__reveal-button')))
const revealSeedPhraseButton = await findElement(driver, By.css('.backup-phrase__reveal-button'), 10000)
await revealSeedPhraseButton.click()
await delay(regularDelayMs)
seedPhrase = await driver.findElement(By.css('.backup-phrase__secret-words')).getText()
@ -405,40 +406,6 @@ describe('MetaMask', function () {
})
})
describe('Add existing token using search', () => {
it('clicks on the Add Token button', async () => {
const addToken = await findElement(driver, By.xpath(`//button[contains(text(), 'Add Token')]`))
await addToken.click()
await delay(regularDelayMs)
})
it('can pick a token from the existing options', async () => {
const tokenSearch = await findElement(driver, By.css('#search-tokens'))
await tokenSearch.sendKeys('BAT')
await delay(regularDelayMs)
const token = await findElement(driver, By.xpath("//span[contains(text(), 'BAT')]"))
await token.click()
await delay(regularDelayMs)
const nextScreen = await findElement(driver, By.xpath(`//button[contains(text(), 'Next')]`))
await nextScreen.click()
await delay(regularDelayMs)
const addTokens = await findElement(driver, By.xpath(`//button[contains(text(), 'Add Tokens')]`))
await addTokens.click()
await delay(largeDelayMs)
})
it('renders the balance for the chosen token', async () => {
const balance = await findElement(driver, By.css('.tx-view .balance-display .token-amount'))
await driver.wait(until.elementTextMatches(balance, /^0\s*BAT\s*$/), 10000)
const tokenAmount = await balance.getText()
assert.ok(/^0\s*BAT\s*$/.test(tokenAmount))
await delay(regularDelayMs)
})
})
describe('Add a custom token from TokenFactory', () => {
it('creates a new token', async () => {
await driver.executeScript('window.open("https://tokenfactory.surge.sh/#/factory")')
@ -710,10 +677,48 @@ describe('MetaMask', function () {
assert.equal(txValues.length, 5)
assert.equal(await txValues[0].getText(), '26 TST')
const txStatuses = await findElements(driver, By.css('.tx-list-status'))
await driver.wait(until.elementTextMatches(txStatuses[1], /Confirmed/))
await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/))
const tokenListItems = await findElements(driver, By.css('.token-list-item'))
tokenListItems[0].click()
await delay(regularDelayMs)
const tokenBalanceAmount = await findElement(driver, By.css('.token-balance__amount'))
assert.equal(tokenBalanceAmount.getText(), '24 TST')
assert.equal(await tokenBalanceAmount.getText(), '24')
})
})
describe('Add existing token using search', () => {
it('clicks on the Add Token button', async () => {
const addToken = await findElement(driver, By.xpath(`//button[contains(text(), 'Add Token')]`))
await addToken.click()
await delay(regularDelayMs)
})
it('can pick a token from the existing options', async () => {
const tokenSearch = await findElement(driver, By.css('#search-tokens'))
await tokenSearch.sendKeys('BAT')
await delay(regularDelayMs)
const token = await findElement(driver, By.xpath("//span[contains(text(), 'BAT')]"))
await token.click()
await delay(regularDelayMs)
const nextScreen = await findElement(driver, By.xpath(`//button[contains(text(), 'Next')]`))
await nextScreen.click()
await delay(regularDelayMs)
const addTokens = await findElement(driver, By.xpath(`//button[contains(text(), 'Add Tokens')]`))
await addTokens.click()
await delay(largeDelayMs)
})
it('renders the balance for the chosen token', async () => {
const balance = await findElement(driver, By.css('.tx-view .balance-display .token-amount'))
await driver.wait(until.elementTextIs(balance, '0BAT'))
const tokenAmount = await balance.getText()
assert.equal(tokenAmount, '0BAT')
await delay(regularDelayMs)
})
})
})