2017-10-03 03:11:27 +02:00
|
|
|
const PASSWORD = 'password123'
|
2017-10-03 23:43:11 +02:00
|
|
|
const reactTriggerChange = require('react-trigger-change')
|
2018-03-12 03:29:35 +01:00
|
|
|
const {
|
|
|
|
timeout,
|
|
|
|
findAsync,
|
|
|
|
queryAsync,
|
|
|
|
} = require('../../lib/util')
|
2017-10-03 03:11:27 +02:00
|
|
|
|
|
|
|
async function runFirstTimeUsageTest (assert, done) {
|
|
|
|
await timeout(4000)
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const app = await queryAsync($, '#app-content')
|
2017-10-03 03:11:27 +02:00
|
|
|
|
2017-12-05 17:41:59 +01:00
|
|
|
await skipNotices(app)
|
2017-10-03 03:11:27 +02:00
|
|
|
|
|
|
|
// Scroll through terms
|
2018-03-12 05:39:46 +01:00
|
|
|
const title = (await findAsync(app, '.create-password__title')).text()
|
2017-10-03 03:11:27 +02:00
|
|
|
assert.equal(title, 'Create Password', 'create password screen')
|
|
|
|
|
|
|
|
// enter password
|
2018-03-12 03:29:35 +01:00
|
|
|
const pwBox = (await findAsync(app, '.first-time-flow__input'))[0]
|
|
|
|
const confBox = (await findAsync(app, '.first-time-flow__input'))[1]
|
2017-10-03 03:11:27 +02:00
|
|
|
pwBox.value = PASSWORD
|
|
|
|
confBox.value = PASSWORD
|
2017-10-03 23:43:11 +02:00
|
|
|
reactTriggerChange(pwBox)
|
|
|
|
reactTriggerChange(confBox)
|
2017-10-03 03:11:27 +02:00
|
|
|
|
2017-10-03 23:43:11 +02:00
|
|
|
// Create Password
|
2018-03-12 03:29:35 +01:00
|
|
|
const createButton = (await findAsync(app, 'button.first-time-flow__button'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
createButton.click()
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const created = (await findAsync(app, '.unique-image__title'))[0]
|
2017-10-03 23:43:11 +02:00
|
|
|
assert.equal(created.textContent, 'Your unique account image', 'unique image screen')
|
2017-10-03 03:11:27 +02:00
|
|
|
|
|
|
|
// Agree button
|
2018-03-12 03:29:35 +01:00
|
|
|
let button = (await findAsync(app, 'button'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
assert.ok(button, 'button present')
|
|
|
|
button.click()
|
|
|
|
|
2017-12-05 17:41:59 +01:00
|
|
|
await skipNotices(app)
|
2017-10-03 23:43:11 +02:00
|
|
|
|
|
|
|
// secret backup phrase
|
2018-03-12 03:29:35 +01:00
|
|
|
const seedTitle = (await findAsync(app, '.backup-phrase__title'))[0]
|
2017-10-03 23:43:11 +02:00
|
|
|
assert.equal(seedTitle.textContent, 'Secret Backup Phrase', 'seed phrase screen')
|
2018-03-12 03:29:35 +01:00
|
|
|
;(await findAsync(app, '.backup-phrase__reveal-button')).click()
|
|
|
|
const seedPhrase = (await findAsync(app, '.backup-phrase__secret-words')).text().split(' ')
|
|
|
|
;(await findAsync(app, '.first-time-flow__button')).click()
|
2017-10-03 23:43:11 +02:00
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
await timeout()
|
2017-10-03 23:43:11 +02:00
|
|
|
const selectPhrase = text => {
|
|
|
|
const option = $('.backup-phrase__confirm-seed-option')
|
|
|
|
.filter((i, d) => d.textContent === text)[0]
|
|
|
|
$(option).click()
|
|
|
|
}
|
|
|
|
|
|
|
|
seedPhrase.forEach(sp => selectPhrase(sp))
|
2018-03-12 03:29:35 +01:00
|
|
|
;(await findAsync(app, '.first-time-flow__button')).click()
|
2017-10-03 23:43:11 +02:00
|
|
|
|
|
|
|
// Deposit Ether Screen
|
2018-03-26 20:57:19 +02:00
|
|
|
const depositEthTitle = (await findAsync(app, '.page-container__title'))[0]
|
|
|
|
assert.equal(depositEthTitle.textContent, 'Deposit Ether', 'deposit ether screen')
|
|
|
|
;(await findAsync(app, '.page-container__header-close')).click()
|
2017-10-03 03:11:27 +02:00
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const menu = (await findAsync(app, '.account-menu__icon'))[0]
|
2017-11-02 20:45:45 +01:00
|
|
|
menu.click()
|
2017-10-03 03:11:27 +02:00
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const lock = (await findAsync(app, '.account-menu__logout-button'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
assert.ok(lock, 'Lock menu item found')
|
|
|
|
lock.click()
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const pwBox2 = (await findAsync(app, '#password-box'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
pwBox2.value = PASSWORD
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const createButton2 = (await findAsync(app, 'button.primary'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
createButton2.click()
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const detail2 = (await findAsync(app, '.wallet-view'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
assert.ok(detail2, 'Account detail section loaded again.')
|
|
|
|
|
|
|
|
// open account settings dropdown
|
2018-03-12 03:29:35 +01:00
|
|
|
const qrButton = (await findAsync(app, '.wallet-view__details-button'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
qrButton.click()
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const qrHeader = (await findAsync(app, '.editable-label__value'))[0]
|
|
|
|
const qrContainer = (await findAsync(app, '.qr-wrapper'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
assert.equal(qrHeader.textContent, 'Account 1', 'Should show account label.')
|
|
|
|
assert.ok(qrContainer, 'QR Container found')
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const networkMenu = (await findAsync(app, '.network-component'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
networkMenu.click()
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const networkMenu2 = (await findAsync(app, '.network-indicator'))[0]
|
2017-10-03 03:11:27 +02:00
|
|
|
const children2 = networkMenu2.children
|
|
|
|
children2.length[3]
|
|
|
|
assert.ok(children2, 'All network options present')
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = runFirstTimeUsageTest
|
|
|
|
|
2017-12-05 17:41:59 +01:00
|
|
|
async function skipNotices (app) {
|
|
|
|
while (true) {
|
2018-03-12 03:29:35 +01:00
|
|
|
const button = await findAsync(app, 'button')
|
2017-12-05 17:41:59 +01:00
|
|
|
if (button && button.html() === 'Accept') {
|
|
|
|
// still notices to accept
|
2018-03-12 03:29:35 +01:00
|
|
|
const termsPage = (await findAsync(app, '.markdown'))[0]
|
2017-12-05 17:41:59 +01:00
|
|
|
if (!termsPage) {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
termsPage.scrollTop = termsPage.scrollHeight
|
|
|
|
await timeout()
|
|
|
|
button.click()
|
|
|
|
await timeout()
|
|
|
|
} else {
|
|
|
|
console.log('No more notices...')
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|