1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

update drizzle tests

This commit is contained in:
brunobar79 2018-11-06 19:08:23 -05:00
parent 5272073f4f
commit 6daf749251

View File

@ -19,6 +19,7 @@ const {
openNewPage, openNewPage,
verboseReportOnFailure, verboseReportOnFailure,
waitUntilXWindowHandles, waitUntilXWindowHandles,
switchToWindowWithTitle,
} = require('./helpers') } = require('./helpers')
describe('MetaMask', function () { describe('MetaMask', function () {
@ -266,18 +267,32 @@ describe('MetaMask', function () {
}) })
describe('Drizzle', () => { describe('Drizzle', () => {
it('should be able to detect our eth address', async () => { let windowHandles
let extension
let popup
let dapp
it('be able to connect the account', async () => {
await openNewPage(driver, 'http://127.0.0.1:3000/') await openNewPage(driver, 'http://127.0.0.1:3000/')
await delay(regularDelayMs) await delay(regularDelayMs)
await waitUntilXWindowHandles(driver, 2) await waitUntilXWindowHandles(driver, 3)
const windowHandles = await driver.getAllWindowHandles() windowHandles = await driver.getAllWindowHandles()
const dapp = windowHandles[1]
extension = windowHandles[0]
popup = await switchToWindowWithTitle(driver, 'MetaMask Notification', windowHandles)
dapp = windowHandles.find(handle => handle !== extension && handle !== popup)
await delay(regularDelayMs)
const approveButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Connect')]`))
await approveButton.click()
})
it('should be able to detect our eth address', async () => {
// Check if address exposed
await driver.switchTo().window(dapp) await driver.switchTo().window(dapp)
await delay(regularDelayMs) await delay(regularDelayMs)
const addressElement = await findElement(driver, By.css(`.pure-u-1-1 h4`)) const addressElement = await findElement(driver, By.css(`.pure-u-1-1 h4`))
const addressText = await addressElement.getText() const addressText = await addressElement.getText()
assert(addressText.match(/^0x[a-fA-F0-9]{40}$/)) assert(addressText.match(/^0x[a-fA-F0-9]{40}$/))