3box integration 2.0 (#6972)
* Adds threebox controller * Adds threebox approval modal * Fix unit tests and lint after addition of threebox * Correct threebox behaviour after rejecting request for backup; fixes e2e tests. * Update threebox controller for automatic syncing * Ensure frontend locale updates when preferences are changed via direct update within controller * Add toggle in settings for 3box syncing * Update threebox controller for latest 3box version * Delete unnecessary frontend changes for threebox integration * Backing up address book contacts with threebox * Update unit tests for 3box-integration additions * Only enable threebox by default for new wallets * Mock globals for correct unit tests * 3box '1.10.2' -> '^1.10.2' * Correct capilalization on 3Box * Use log.debug instead of console.log in threebox controller * Update yarn.lock * Remove edge build * Split 3box module into background deps js file * extra bundle opts for bg-libs * sync yarn.lock * new3Box logic * Show confirm threebox restore after import * Remove bg-libs.js from manifest file for dev builds * Switch 3Box controller to using the spaces api (instead of the profile api) * Finalize switching to spaces api and only restoring from 3box after import * Update metamask-controller-test.js for threebox controller changes * Make threebox modal style consistent with others and update success button wording * Use mock 3box when in test * Correct 3box modal header * Remove unnecessary property of threebox controller provider * Remove unnecessary method calls after restoration from 3box in the threebox-restore-confirm modal. * Replace setThreeBoxSyncingPermission calls in routes/index.js with turnThreeBoxSyncingOn * Replace erroneous use of with * Replace erroneous use of threeboxSyncing with threeBoxSyncingAllowed in advancted-tab directory * Lint fixes for 3box changes * Log errors encountered when updating 3Box * Remove unnecessary parameter from state update * Add timeout to initial 3Box sync The initial 3Box sync will now timeout after 1 minute. If the timeout is triggered, 3Box is disabled and cannot be re-enabled unless the initial sync does finally finish. If it never finishes, 3Box cannot be enabled unless the extension is reinstalled. The Advanced Settings page was updated to show this option as disabled in that circumstance, with a new discription explaining why it's disabled. The UI here could certainly be improved. Additionally, "on" and "off" labels were added to the toggle to match the other toggles on the Advanced Settings page. * Use non-minified 3Box module We had previously used the minified 3Box module to avoid a build error encountered when `envify` was processing the `libp2p` module (which is used by 3Box). The build would fail because `esprima` (used by `envify`) is incompatible with the object spread/rest operator (which is used in `libp2p`). That issue has been solved by adding a global Babelify transformation specifically for transpiling out the object rest/spread operator from dependencies. It has been targetted to only affect `libp2p` to avoid extending the build time too much. This workaround can be used until a new version of `esprima` is released that includes this bug fix. * Use app key addresses for threebox * Replace use of modal for confirming 3box restoration with a home notification * Adds e2e tests for restoring from threebox * Update eth-keyring-controller to 5.1.0 * Correct parameters passed to getAppKeyAddress in threebox.js * Add prefix to origin passed to getAppKeyAddress in threebox.js * Remove unused locale message. * Prevent CORS errors in firefox e2e tests * Ensure extraneous scripts are excluded from the local test dev build * Move threeBoxLastUpdate state from home.component to redux * Threebox PR code cleanup * Always use first address when initializing threebox * Replace setRestoredFromThreeBox api with setRestoredFromThreeBoxToFalse and setRestoredFromThreeBoxToTrue * Update development/metamaskbot-build-announce.js to include ui-libs and bg-libs in hard coded bundle list * Update test/e2e/threebox.spec.js to use new helpers added with pull #7144 * Make setFeatureFlag available on the ui window during testing * Hide threebox feature behind a feature flag that can only be activated via dev console * Remove unnecessary migration of threebox feature flag * Prevent this.init() call in threebox constructor if feature flag is not turned on * Prevent threebox notification from showing if feature flag is falsy * http://localhost/8889 -> http://localhost/* in gulp manifest:testing tasksfeature/default_network_editable
parent
bf72f39ff1
commit
7985f4f4f8
@ -0,0 +1,213 @@ |
||||
const ObservableStore = require('obs-store') |
||||
const Box = process.env.IN_TEST |
||||
? require('../../../development/mock-3box') |
||||
: require('3box') |
||||
// const Box = require(process.env.IN_TEST ? '../lib/mock-3box' : '3box/dist/3box.min')
|
||||
const log = require('loglevel') |
||||
|
||||
const JsonRpcEngine = require('json-rpc-engine') |
||||
const providerFromEngine = require('eth-json-rpc-middleware/providerFromEngine') |
||||
const createMetamaskMiddleware = require('./network/createMetamaskMiddleware') |
||||
const createOriginMiddleware = require('../lib/createOriginMiddleware') |
||||
|
||||
const SYNC_TIMEOUT = 60 * 1000 // one minute
|
||||
|
||||
class ThreeBoxController { |
||||
constructor (opts = {}) { |
||||
const { |
||||
preferencesController, |
||||
keyringController, |
||||
addressBookController, |
||||
version, |
||||
getKeyringControllerState, |
||||
getSelectedAddress, |
||||
} = opts |
||||
|
||||
this.preferencesController = preferencesController |
||||
this.addressBookController = addressBookController |
||||
this.keyringController = keyringController |
||||
this.provider = this._createProvider({ |
||||
version, |
||||
getAccounts: async ({ origin }) => { |
||||
if (origin !== '3Box') { return [] } |
||||
const isUnlocked = getKeyringControllerState().isUnlocked |
||||
|
||||
const selectedAddress = getSelectedAddress() |
||||
|
||||
if (isUnlocked && selectedAddress) { |
||||
return [selectedAddress] |
||||
} else { |
||||
return [] |
||||
} |
||||
}, |
||||
processPersonalMessage: (msgParams) => { |
||||
return Promise.resolve(keyringController.signPersonalMessage(msgParams, { |
||||
withAppKeyOrigin: 'wallet://3box.metamask.io', |
||||
})) |
||||
}, |
||||
}) |
||||
|
||||
const initState = { |
||||
threeBoxSyncingAllowed: true, |
||||
restoredFromThreeBox: null, |
||||
...opts.initState, |
||||
threeBoxAddress: null, |
||||
threeBoxSynced: false, |
||||
threeBoxDisabled: false, |
||||
} |
||||
this.store = new ObservableStore(initState) |
||||
this.registeringUpdates = false |
||||
|
||||
const threeBoxFeatureFlagTurnedOn = this.preferencesController.getFeatureFlags().threeBox |
||||
|
||||
if (threeBoxFeatureFlagTurnedOn) { |
||||
this.init() |
||||
} |
||||
} |
||||
|
||||
async init () { |
||||
const accounts = await this.keyringController.getAccounts() |
||||
this.address = accounts[0] |
||||
if (this.address && !(this.box && this.store.getState().threeBoxSynced)) { |
||||
await this.new3Box() |
||||
} |
||||
} |
||||
|
||||
async _update3Box ({ type }, newState) { |
||||
try { |
||||
const { threeBoxSyncingAllowed, threeBoxSynced } = this.store.getState() |
||||
if (threeBoxSyncingAllowed && threeBoxSynced) { |
||||
await this.space.private.set('lastUpdated', Date.now()) |
||||
await this.space.private.set(type, JSON.stringify(newState)) |
||||
} |
||||
} catch (error) { |
||||
console.error(error) |
||||
} |
||||
} |
||||
|
||||
_createProvider (providerOpts) { |
||||
const metamaskMiddleware = createMetamaskMiddleware(providerOpts) |
||||
const engine = new JsonRpcEngine() |
||||
engine.push(createOriginMiddleware({ origin: '3Box' })) |
||||
engine.push(metamaskMiddleware) |
||||
const provider = providerFromEngine(engine) |
||||
return provider |
||||
} |
||||
|
||||
_waitForOnSyncDone () { |
||||
return new Promise((resolve) => { |
||||
this.box.onSyncDone(() => { |
||||
log.debug('3Box box sync done') |
||||
return resolve() |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
async new3Box () { |
||||
const accounts = await this.keyringController.getAccounts() |
||||
const address = accounts[0] |
||||
|
||||
if (this.getThreeBoxSyncingState()) { |
||||
this.store.updateState({ threeBoxSynced: false }) |
||||
this.address = await this.keyringController.getAppKeyAddress(address, 'wallet://3box.metamask.io') |
||||
|
||||
let timedOut = false |
||||
const syncTimeout = setTimeout(() => { |
||||
log.error(`3Box sync timed out after ${SYNC_TIMEOUT} ms`) |
||||
timedOut = true |
||||
this.store.updateState({ |
||||
threeBoxDisabled: true, |
||||
threeBoxSyncingAllowed: false, |
||||
}) |
||||
}, SYNC_TIMEOUT) |
||||
try { |
||||
this.box = await Box.openBox(address, this.provider) |
||||
await this._waitForOnSyncDone() |
||||
this.space = await this.box.openSpace('metamask', { |
||||
onSyncDone: async () => { |
||||
const stateUpdate = { |
||||
threeBoxSynced: true, |
||||
threeBoxAddress: address, |
||||
} |
||||
if (timedOut) { |
||||
log.info(`3Box sync completed after timeout; no longer disabled`) |
||||
stateUpdate.threeBoxDisabled = false |
||||
} |
||||
|
||||
clearTimeout(syncTimeout) |
||||
this.store.updateState(stateUpdate) |
||||
log.debug('3Box space sync done') |
||||
}, |
||||
}) |
||||
} catch (e) { |
||||
console.error(e) |
||||
throw e |
||||
} |
||||
} |
||||
} |
||||
|
||||
async getLastUpdated () { |
||||
return await this.space.private.get('lastUpdated') |
||||
} |
||||
|
||||
async restoreFromThreeBox () { |
||||
this.setRestoredFromThreeBoxToTrue() |
||||
const backedUpPreferences = await this.space.private.get('preferences') |
||||
backedUpPreferences && this.preferencesController.store.updateState(JSON.parse(backedUpPreferences)) |
||||
const backedUpAddressBook = await this.space.private.get('addressBook') |
||||
backedUpAddressBook && this.addressBookController.update(JSON.parse(backedUpAddressBook), true) |
||||
} |
||||
|
||||
turnThreeBoxSyncingOn () { |
||||
this._registerUpdates() |
||||
} |
||||
|
||||
turnThreeBoxSyncingOff () { |
||||
this.box.logout() |
||||
} |
||||
|
||||
setRestoredFromThreeBoxToTrue () { |
||||
this.store.updateState({ restoredFromThreeBox: true }) |
||||
} |
||||
|
||||
setRestoredFromThreeBoxToFalse () { |
||||
this.store.updateState({ restoredFromThreeBox: false }) |
||||
} |
||||
|
||||
setThreeBoxSyncingPermission (newThreeboxSyncingState) { |
||||
if (this.store.getState().threeBoxDisabled) { |
||||
return |
||||
} |
||||
this.store.updateState({ |
||||
threeBoxSyncingAllowed: newThreeboxSyncingState, |
||||
}) |
||||
|
||||
if (newThreeboxSyncingState && this.box) { |
||||
this.turnThreeBoxSyncingOn() |
||||
} |
||||
|
||||
if (!newThreeboxSyncingState && this.box) { |
||||
this.turnThreeBoxSyncingOff() |
||||
} |
||||
} |
||||
|
||||
getThreeBoxSyncingState () { |
||||
return this.store.getState().threeBoxSyncingAllowed |
||||
} |
||||
|
||||
getThreeBoxAddress () { |
||||
return this.store.getState().threeBoxAddress |
||||
} |
||||
|
||||
_registerUpdates () { |
||||
if (!this.registeringUpdates) { |
||||
const updatePreferences = this._update3Box.bind(this, { type: 'preferences' }) |
||||
this.preferencesController.store.subscribe(updatePreferences) |
||||
const updateAddressBook = this._update3Box.bind(this, { type: 'addressBook' }) |
||||
this.addressBookController.subscribe(updateAddressBook) |
||||
this.registeringUpdates = true |
||||
} |
||||
} |
||||
} |
||||
|
||||
module.exports = ThreeBoxController |
@ -0,0 +1,60 @@ |
||||
function delay (time) { |
||||
return new Promise(resolve => setTimeout(resolve, time)) |
||||
} |
||||
|
||||
function loadFromMock3Box (key) { |
||||
return new Promise(async (resolve) => { |
||||
const res = await fetch('http://localhost:8889?key=' + key) |
||||
const text = await res.text() |
||||
resolve(text.length ? JSON.parse(text) : null) |
||||
}) |
||||
} |
||||
|
||||
function saveToMock3Box (key, newDataAtKey) { |
||||
return new Promise(async (resolve) => { |
||||
const res = await fetch('http://localhost:8889', { |
||||
method: 'POST', |
||||
body: JSON.stringify({ |
||||
key, |
||||
data: newDataAtKey, |
||||
}), |
||||
}) |
||||
|
||||
resolve(res.text()) |
||||
}) |
||||
} |
||||
|
||||
class Mock3Box { |
||||
static openBox (address) { |
||||
this.address = address |
||||
return Promise.resolve({ |
||||
onSyncDone: cb => { setTimeout(cb, 200) }, |
||||
openSpace: async (spaceName, config) => { |
||||
const { onSyncDone } = config |
||||
this.spaceName = spaceName |
||||
|
||||
setTimeout(onSyncDone, 150) |
||||
|
||||
await delay(50) |
||||
|
||||
return { |
||||
private: { |
||||
get: async (key) => { |
||||
await delay(50) |
||||
const res = await loadFromMock3Box(`${this.address}-${this.spaceName}-${key}`) |
||||
return res |
||||
}, |
||||
set: async (key, data) => { |
||||
await saveToMock3Box(`${this.address}-${this.spaceName}-${key}`, data) |
||||
await delay(50) |
||||
return null |
||||
}, |
||||
}, |
||||
} |
||||
}, |
||||
logout: () => {}, |
||||
}) |
||||
} |
||||
} |
||||
|
||||
module.exports = Mock3Box |
@ -0,0 +1,36 @@ |
||||
const http = require('http') |
||||
const url = require('url') |
||||
const port = 8889 |
||||
|
||||
const database = {} |
||||
|
||||
const requestHandler = (request, response) => { |
||||
response.setHeader('Content-Type', 'application/json') |
||||
if (request.method === 'POST') { |
||||
let body = '' |
||||
request.on('data', chunk => { |
||||
body += chunk.toString() // convert Buffer to string
|
||||
}) |
||||
request.on('end', () => { |
||||
const { key, data } = JSON.parse(body) |
||||
|
||||
database[key] = data |
||||
response.setHeader('Access-Control-Allow-Headers', '*') |
||||
response.end('ok') |
||||
}) |
||||
} else if (request.method === 'GET') { |
||||
const { key } = url.parse(request.url, true).query |
||||
response.setHeader('Access-Control-Allow-Headers', '*') |
||||
response.end(JSON.stringify(database[key] || '')) |
||||
} else { |
||||
response.end('unknown request') |
||||
} |
||||
} |
||||
|
||||
const server = http.createServer(requestHandler) |
||||
|
||||
server.listen(port, (err) => { |
||||
if (err) { |
||||
return console.log('mock 3box server error: ', err) |
||||
} |
||||
}) |
@ -0,0 +1,254 @@ |
||||
const assert = require('assert') |
||||
const webdriver = require('selenium-webdriver') |
||||
const { By, until } = webdriver |
||||
const { |
||||
delay, |
||||
} = require('./func') |
||||
const { |
||||
checkBrowserForConsoleErrors, |
||||
findElement, |
||||
findElements, |
||||
verboseReportOnFailure, |
||||
setupFetchMocking, |
||||
prepareExtensionForTesting, |
||||
} = require('./helpers') |
||||
|
||||
describe('MetaMask', function () { |
||||
let driver |
||||
|
||||
const testSeedPhrase = 'forum vessel pink push lonely enact gentle tail admit parrot grunt dress' |
||||
const tinyDelayMs = 200 |
||||
const regularDelayMs = tinyDelayMs * 2 |
||||
const largeDelayMs = regularDelayMs * 2 |
||||
|
||||
this.timeout(0) |
||||
this.bail(true) |
||||
|
||||
before(async function () { |
||||
const result = await prepareExtensionForTesting() |
||||
driver = result.driver |
||||
await setupFetchMocking(driver) |
||||
}) |
||||
|
||||
afterEach(async function () { |
||||
if (process.env.SELENIUM_BROWSER === 'chrome') { |
||||
const errors = await checkBrowserForConsoleErrors(driver) |
||||
if (errors.length) { |
||||
const errorReports = errors.map(err => err.message) |
||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}` |
||||
console.error(new Error(errorMessage)) |
||||
} |
||||
} |
||||
if (this.currentTest.state === 'failed') { |
||||
await verboseReportOnFailure(driver, this.currentTest) |
||||
} |
||||
}) |
||||
|
||||
after(async function () { |
||||
await driver.quit() |
||||
}) |
||||
|
||||
describe('set up data to be restored by 3box', () => { |
||||
|
||||
describe('First time flow starting from an existing seed phrase', () => { |
||||
it('turns on the threebox feature flag', async () => { |
||||
await delay(largeDelayMs) |
||||
await driver.executeScript('window.metamask.setFeatureFlag("threeBox", true)') |
||||
await delay(largeDelayMs) |
||||
}) |
||||
|
||||
it('clicks the continue button on the welcome screen', async () => { |
||||
await findElement(driver, By.css('.welcome-page__header')) |
||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button')) |
||||
welcomeScreenBtn.click() |
||||
await delay(largeDelayMs) |
||||
}) |
||||
|
||||
it('clicks the "Import Wallet" option', async () => { |
||||
const customRpcButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Import Wallet')]`)) |
||||
customRpcButton.click() |
||||
await delay(largeDelayMs) |
||||
}) |
||||
|
||||
it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { |
||||
const optOutButton = await findElement(driver, By.css('.btn-default')) |
||||
optOutButton.click() |
||||
await delay(largeDelayMs) |
||||
}) |
||||
|
||||
it('imports a seed phrase', async () => { |
||||
const [seedTextArea] = await findElements(driver, By.css('textarea.first-time-flow__textarea')) |
||||
await seedTextArea.sendKeys(testSeedPhrase) |
||||
await delay(regularDelayMs) |
||||
|
||||
const [password] = await findElements(driver, By.id('password')) |
||||
await password.sendKeys('correct horse battery staple') |
||||
const [confirmPassword] = await findElements(driver, By.id('confirm-password')) |
||||
confirmPassword.sendKeys('correct horse battery staple') |
||||
|
||||
const tosCheckBox = await findElement(driver, By.css('.first-time-flow__checkbox')) |
||||
await tosCheckBox.click() |
||||
|
||||
const [importButton] = await findElements(driver, By.xpath(`//button[contains(text(), 'Import')]`)) |
||||
await importButton.click() |
||||
await delay(regularDelayMs) |
||||
}) |
||||
|
||||
it('clicks through the success screen', async () => { |
||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`)) |
||||
const doneButton = await findElement(driver, By.css('button.first-time-flow__button')) |
||||
await doneButton.click() |
||||
await delay(regularDelayMs) |
||||
}) |
||||
|
||||
it('balance renders', async () => { |
||||
const balance = await findElement(driver, By.css('.balance-display .token-amount')) |
||||
await driver.wait(until.elementTextMatches(balance, /25\s*ETH/)) |
||||
await delay(regularDelayMs) |
||||
}) |
||||
}) |
||||
|
||||
describe('updates settings and address book', () => { |
||||
it('goes to the settings screen', async () => { |
||||
await driver.findElement(By.css('.account-menu__icon')).click() |
||||
await delay(regularDelayMs) |
||||
|
||||
const settingsButton = await findElement(driver, By.xpath(`//div[contains(text(), 'Settings')]`)) |
||||
settingsButton.click() |
||||
}) |
||||
|
||||
it('turns on use of blockies', async () => { |
||||
const toggleButton = await findElement(driver, By.css('.toggle-button > div')) |
||||
await toggleButton.click() |
||||
}) |
||||
|
||||
it('adds an address to the contact list', async () => { |
||||
const contactsButton = await findElement(driver, By.xpath(`//div[contains(text(), 'Contacts')]`)) |
||||
await contactsButton.click() |
||||
|
||||
const addressBookAddButton = await findElement(driver, By.css('.address-book-add-button__button')) |
||||
await addressBookAddButton.click() |
||||
await delay(tinyDelayMs) |
||||
|
||||
const addAddressInputs = await findElements(driver, By.css('input')) |
||||
await addAddressInputs[0].sendKeys('Test User Name 11') |
||||
|
||||
await delay(tinyDelayMs) |
||||
|
||||
await addAddressInputs[1].sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970') |
||||
|
||||
await delay(largeDelayMs * 2) |
||||
|
||||
const saveButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Save')]`)) |
||||
await saveButton.click() |
||||
|
||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Test User Name 11')]`)) |
||||
await delay(regularDelayMs) |
||||
}) |
||||
}) |
||||
|
||||
}) |
||||
|
||||
describe('restoration from 3box', () => { |
||||
let driver2 |
||||
|
||||
before(async function () { |
||||
const result = await prepareExtensionForTesting() |
||||
driver2 = result.driver |
||||
await setupFetchMocking(driver2) |
||||
}) |
||||
|
||||
after(async function () { |
||||
await driver2.quit() |
||||
}) |
||||
|
||||
describe('First time flow starting from an existing seed phrase', () => { |
||||
it('turns on the threebox feature flag', async () => { |
||||
await delay(largeDelayMs) |
||||
await driver2.executeScript('window.metamask.setFeatureFlag("threeBox", true)') |
||||
await delay(largeDelayMs) |
||||
}) |
||||
|
||||
it('clicks the continue button on the welcome screen', async () => { |
||||
await findElement(driver2, By.css('.welcome-page__header')) |
||||
const welcomeScreenBtn = await findElement(driver2, By.css('.first-time-flow__button')) |
||||
welcomeScreenBtn.click() |
||||
await delay(largeDelayMs) |
||||
}) |
||||
|
||||
it('clicks the "Import Wallet" option', async () => { |
||||
const customRpcButton = await findElement(driver2, By.xpath(`//button[contains(text(), 'Import Wallet')]`)) |
||||
customRpcButton.click() |
||||
await delay(largeDelayMs) |
||||
}) |
||||
|
||||
it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { |
||||
const optOutButton = await findElement(driver2, By.css('.btn-default')) |
||||
optOutButton.click() |
||||
await delay(largeDelayMs) |
||||
}) |
||||
|
||||
it('imports a seed phrase', async () => { |
||||
const [seedTextArea] = await findElements(driver2, By.css('textarea.first-time-flow__textarea')) |
||||
await seedTextArea.sendKeys(testSeedPhrase) |
||||
await delay(regularDelayMs) |
||||
|
||||
const [password] = await findElements(driver2, By.id('password')) |
||||
await password.sendKeys('correct horse battery staple') |
||||
const [confirmPassword] = await findElements(driver2, By.id('confirm-password')) |
||||
confirmPassword.sendKeys('correct horse battery staple') |
||||
|
||||
const tosCheckBox = await findElement(driver2, By.css('.first-time-flow__checkbox')) |
||||
await tosCheckBox.click() |
||||
|
||||
const [importButton] = await findElements(driver2, By.xpath(`//button[contains(text(), 'Import')]`)) |
||||
await importButton.click() |
||||
await delay(regularDelayMs) |
||||
}) |
||||
|
||||
it('clicks through the success screen', async () => { |
||||
await findElement(driver2, By.xpath(`//div[contains(text(), 'Congratulations')]`)) |
||||
const doneButton = await findElement(driver2, By.css('button.first-time-flow__button')) |
||||
await doneButton.click() |
||||
await delay(regularDelayMs) |
||||
}) |
||||
|
||||
it('balance renders', async () => { |
||||
const balance = await findElement(driver2, By.css('.balance-display .token-amount')) |
||||
await driver2.wait(until.elementTextMatches(balance, /25\s*ETH/)) |
||||
await delay(regularDelayMs) |
||||
}) |
||||
}) |
||||
|
||||
describe('restores 3box data', () => { |
||||
it('confirms the 3box restore notification', async () => { |
||||
const restoreButton = await findElement(driver2, By.css('.home-notification__accept-button')) |
||||
await restoreButton.click() |
||||
}) |
||||
|
||||
it('goes to the settings screen', async () => { |
||||
await driver.findElement(By.css('.account-menu__icon')).click() |
||||
await delay(regularDelayMs) |
||||
|
||||
const settingsButton = await findElement(driver, By.xpath(`//div[contains(text(), 'Settings')]`)) |
||||
settingsButton.click() |
||||
}) |
||||
|
||||
it('finds the blockies toggle turned on', async () => { |
||||
await delay(regularDelayMs) |
||||
const toggleLabel = await findElement(driver, By.css('.toggle-button__status-label')) |
||||
const toggleLabelText = await toggleLabel.getText() |
||||
assert.equal(toggleLabelText, 'ON') |
||||
}) |
||||
|
||||
it('finds the restored address in the contact list', async () => { |
||||
const contactsButton = await findElement(driver, By.xpath(`//div[contains(text(), 'Contacts')]`)) |
||||
await contactsButton.click() |
||||
await delay(regularDelayMs) |
||||
|
||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Test User Name 11')]`)) |
||||
await delay(regularDelayMs) |
||||
}) |
||||
}) |
||||
}) |
||||
}) |
Loading…
Reference in new issue