diff --git a/app/scripts/controllers/threebox.js b/app/scripts/controllers/threebox.js index 080fac6cc..be6c2fa0a 100644 --- a/app/scripts/controllers/threebox.js +++ b/app/scripts/controllers/threebox.js @@ -178,16 +178,16 @@ export default class ThreeBoxController { async migrateBackedUpState (backedUpState) { const migrator = new Migrator({ migrations }) - + const { preferences, addressBook } = JSON.parse(backedUpState) const formattedStateBackup = { - PreferencesController: backedUpState.preferences, - AddressBookController: backedUpState.addressBook, + PreferencesController: preferences, + AddressBookController: addressBook, } const initialMigrationState = migrator.generateInitialState(formattedStateBackup) const migratedState = await migrator.migrateData(initialMigrationState) return { - preferences: migratedState.PreferencesController, - addressBook: migratedState.AddressBookController, + preferences: migratedState.data.PreferencesController, + addressBook: migratedState.data.AddressBookController, } } @@ -198,8 +198,8 @@ export default class ThreeBoxController { addressBook, } = await this.migrateBackedUpState(backedUpState) this.store.updateState({ threeBoxLastUpdated: backedUpState.lastUpdated }) - preferences && this.preferencesController.store.updateState(JSON.parse(preferences)) - addressBook && this.addressBookController.update(JSON.parse(addressBook), true) + preferences && this.preferencesController.store.updateState(preferences) + addressBook && this.addressBookController.update(addressBook, true) this.setShowRestorePromptToFalse() } diff --git a/test/e2e/threebox.spec.js b/test/e2e/threebox.spec.js index 3ba7c060e..3254d8cb9 100644 --- a/test/e2e/threebox.spec.js +++ b/test/e2e/threebox.spec.js @@ -213,27 +213,26 @@ describe('MetaMask', function () { await driver2.clickElement(By.css('.home-notification__accept-button')) }) - // TODO: Fix tests from here forward; they're using the wrong driver it('goes to the settings screen', async function () { - await driver.clickElement(By.css('.account-menu__icon')) - await driver.delay(regularDelayMs) + await driver2.clickElement(By.css('.account-menu__icon')) + await driver2.delay(regularDelayMs) - await driver.clickElement(By.xpath(`//div[contains(text(), 'Settings')]`)) + await driver2.clickElement(By.xpath(`//div[contains(text(), 'Settings')]`)) }) it('finds the blockies toggle turned on', async function () { - await driver.delay(regularDelayMs) - const toggleLabel = await driver.findElement(By.css('.toggle-button__status')) + await driver2.delay(regularDelayMs) + const toggleLabel = await driver2.findElement(By.css('.toggle-button__status')) const toggleLabelText = await toggleLabel.getText() assert.equal(toggleLabelText, 'ON') }) it('finds the restored address in the contact list', async function () { - await driver.clickElement(By.xpath(`//div[contains(text(), 'Contacts')]`)) - await driver.delay(regularDelayMs) + await driver2.clickElement(By.xpath(`//div[contains(text(), 'Contacts')]`)) + await driver2.delay(regularDelayMs) - await driver.findElement(By.xpath(`//div[contains(text(), 'Test User Name 11')]`)) - await driver.delay(regularDelayMs) + await driver2.findElement(By.xpath(`//div[contains(text(), 'Test User Name 11')]`)) + await driver2.delay(regularDelayMs) }) }) })