aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/scripts/metamask-controller.js2
-rw-r--r--test/e2e/beta/from-import-beta-ui.spec.js47
2 files changed, 48 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 575c591fa..dc5c24b1b 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -579,7 +579,7 @@ module.exports = class MetamaskController extends EventEmitter {
'Trezor Hardware'
)[0]
if (!keyring) {
- throw new Error('MetamaskController:checkHardwareStatus - Trezor Hardware keyring not found')
+ return false
}
return keyring.isUnlocked()
default:
diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js
index b396dc5b9..938d22cd9 100644
--- a/test/e2e/beta/from-import-beta-ui.spec.js
+++ b/test/e2e/beta/from-import-beta-ui.spec.js
@@ -321,4 +321,51 @@ describe('Using MetaMask with an existing account', function () {
})
})
+ describe('Connects to a Hardware wallet', () => {
+ it('choose Connect Hardware Wallet from the account menu', async () => {
+ await driver.findElement(By.css('.account-menu__icon')).click()
+ await delay(regularDelayMs)
+
+ const [connectAccount] = await findElements(driver, By.xpath(`//div[contains(text(), 'Connect Hardware Wallet')]`))
+ await connectAccount.click()
+ await delay(regularDelayMs)
+ })
+
+ it('should open the TREZOR Connect popup', async () => {
+ const connectButtons = await findElements(driver, By.xpath(`//button[contains(text(), 'Connect to Trezor')]`))
+ await connectButtons[0].click()
+ await delay(regularDelayMs)
+ const allWindows = await driver.getAllWindowHandles()
+ switch (process.env.SELENIUM_BROWSER) {
+ case 'chrome':
+ assert.equal(allWindows.length, 2)
+ break
+ default:
+ assert.equal(allWindows.length, 1)
+ }
+ })
+
+ it('should show the "Browser not supported" screen for non Chrome browsers', async () => {
+ if (process.env.SELENIUM_BROWSER !== 'chrome') {
+ const title = await findElements(driver, By.xpath(`//h3[contains(text(), 'Bummer! Your Browser is not supported...')]`))
+ assert.equal(title.length, 1)
+
+ const downloadChromeButtons = await findElements(driver, By.xpath(`//button[contains(text(), 'Download Google Chrome')]`))
+ assert.equal(downloadChromeButtons.length, 1)
+
+ await downloadChromeButtons[0].click()
+ await delay(regularDelayMs)
+
+ const [newUITab, downloadChromeTab] = await driver.getAllWindowHandles()
+
+ await driver.switchTo().window(downloadChromeTab)
+ await delay(regularDelayMs)
+ const tabUrl = await driver.getCurrentUrl()
+ assert.equal(tabUrl, 'https://www.google.com/chrome/')
+ await driver.close()
+ await delay(regularDelayMs)
+ await driver.switchTo().window(newUITab)
+ }
+ })
+ })
})