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

Update add token integration tests.

This commit is contained in:
Dan 2018-03-26 06:06:28 -02:30
parent c710fb8f50
commit a30b5ccd95

View File

@ -34,11 +34,11 @@ async function runAddTokenFlowTest (assert, done) {
let addTokenWrapper = await queryAsync($, '.add-token__wrapper') let addTokenWrapper = await queryAsync($, '.add-token__wrapper')
assert.ok(addTokenWrapper[0], 'add token wrapper renders') assert.ok(addTokenWrapper[0], 'add token wrapper renders')
let addTokenTitle = await queryAsync($, '.add-token__title') let addTokenTitle = await queryAsync($, '.add-token__header__title')
assert.equal(addTokenTitle[0].textContent, 'Add Token', 'add token title is correct') assert.equal(addTokenTitle[0].textContent, 'Add Tokens', 'add token title is correct')
// Cancel Add Token // Cancel Add Token
const cancelAddTokenButton = await queryAsync($, 'button.btn-cancel.add-token__button') const cancelAddTokenButton = await queryAsync($, 'button.btn-cancel.add-token__button--cancel')
assert.ok(cancelAddTokenButton[0], 'cancel add token button present') assert.ok(cancelAddTokenButton[0], 'cancel add token button present')
cancelAddTokenButton.click() cancelAddTokenButton.click()
@ -51,9 +51,9 @@ async function runAddTokenFlowTest (assert, done) {
// Verify Add Token Screen // Verify Add Token Screen
addTokenWrapper = await queryAsync($, '.add-token__wrapper') addTokenWrapper = await queryAsync($, '.add-token__wrapper')
addTokenTitle = await queryAsync($, '.add-token__title') addTokenTitle = await queryAsync($, '.add-token__header__title')
assert.ok(addTokenWrapper[0], 'add token wrapper renders') assert.ok(addTokenWrapper[0], 'add token wrapper renders')
assert.equal(addTokenTitle[0].textContent, 'Add Token', 'add token title is correct') assert.equal(addTokenTitle[0].textContent, 'Add Tokens', 'add token title is correct')
// Search for token // Search for token
const searchInput = await queryAsync($, 'input.add-token__input') const searchInput = await queryAsync($, 'input.add-token__input')
@ -91,9 +91,11 @@ async function runAddTokenFlowTest (assert, done) {
assert.ok(addTokenButton[0], 'add token button present') assert.ok(addTokenButton[0], 'add token button present')
addTokenButton[0].click() addTokenButton[0].click()
const addCustom = await queryAsync($, '.add-token__add-custom') const addTokenTabs = await queryAsync($, '.add-token__header__tabs__tab')
assert.ok(addCustom[0], 'add custom token button present') assert.equal(addTokenTabs.length, 2, 'expected number of tabs')
addCustom[0].click() assert.equal(addTokenTabs[1].textContent, 'Custom Token', 'Custom Token tab present')
assert.ok(addTokenTabs[1], 'add custom token tab present')
addTokenTabs[1].click()
// Input token contract address // Input token contract address
const customInput = await queryAsync($, 'input.add-token__add-custom-input') const customInput = await queryAsync($, 'input.add-token__add-custom-input')
@ -108,7 +110,7 @@ async function runAddTokenFlowTest (assert, done) {
// Verify symbol length error since contract address won't return symbol // Verify symbol length error since contract address won't return symbol
const errorMessage = await queryAsync($, '.add-token__add-custom-error-message') const errorMessage = await queryAsync($, '.add-token__add-custom-error-message')
assert.ok(errorMessage[0], 'error rendered') assert.ok(errorMessage[0], 'error rendered')
$('button.btn-cancel.add-token__button')[0].click() $('button.btn-cancel.add-token__button--cancel')[0].click()
// // Confirm Add token // // Confirm Add token
// assert.equal( // assert.equal(