From aa5a987765677b4945e9eefe03cae8dcc93318cd Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Tue, 17 Jul 2018 21:54:04 -0400 Subject: added some e2e tests --- test/e2e/beta/from-import-beta-ui.spec.js | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'test/e2e') 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) + } + }) + }) }) -- cgit v1.2.3 From cbb14f1d5e50c10865838a98452ecfb4b6cb8d6a Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Tue, 17 Jul 2018 21:57:19 -0400 Subject: fix browser not supported screen --- test/e2e/beta/from-import-beta-ui.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/e2e') diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js index 938d22cd9..32f57b157 100644 --- a/test/e2e/beta/from-import-beta-ui.spec.js +++ b/test/e2e/beta/from-import-beta-ui.spec.js @@ -347,7 +347,7 @@ describe('Using MetaMask with an existing account', function () { 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...')]`)) + const title = await findElements(driver, By.xpath(`//h3[contains(text(), 'Your Browser is not supported...')]`)) assert.equal(title.length, 1) const downloadChromeButtons = await findElements(driver, By.xpath(`//button[contains(text(), 'Download Google Chrome')]`)) -- cgit v1.2.3