Fix 3Box sync and e2e tests (#9422)

Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
feature/default_network_editable
Patryk Łucka 4 years ago committed by GitHub
parent b00cd344d9
commit f6d0deb80b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      app/scripts/controllers/threebox.js
  2. 19
      test/e2e/threebox.spec.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()
}

@ -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)
})
})
})

Loading…
Cancel
Save