From 5484e688961624b41fe8850d578ff47e023fa8a1 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Tue, 3 Oct 2017 14:43:11 -0700 Subject: Add Integration Tests --- test/integration/lib/mascara-first-time.js | 59 +++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/integration/lib/mascara-first-time.js b/test/integration/lib/mascara-first-time.js index 7dff33657..3398a5511 100644 --- a/test/integration/lib/mascara-first-time.js +++ b/test/integration/lib/mascara-first-time.js @@ -1,6 +1,5 @@ const PASSWORD = 'password123' - -window.testUtils = require('react-dom/test-utils') +const reactTriggerChange = require('react-trigger-change') async function runFirstTimeUsageTest (assert, done) { await timeout(4000) @@ -36,20 +35,20 @@ async function runFirstTimeUsageTest (assert, done) { const confBox = app.find('.first-time-flow__input')[1] pwBox.value = PASSWORD confBox.value = PASSWORD - $(pwBox).change() - $(confBox).change() + reactTriggerChange(pwBox) + reactTriggerChange(confBox) await timeout() - // create vault + // Create Password const createButton = app.find('button.first-time-flow__button')[0] createButton.click() await timeout(3000) - const created = app.find('h3')[0] - assert.equal(created.textContent, 'Vault Created', 'Vault created screen') + const created = app.find('.unique-image__title')[0] + assert.equal(created.textContent, 'Your unique account image', 'unique image screen') // Agree button const button = app.find('button')[0] @@ -58,8 +57,50 @@ async function runFirstTimeUsageTest (assert, done) { await timeout(1000) - const detail = app.find('.account-detail-section')[0] - assert.ok(detail, 'Account detail section loaded.') + // Privacy Screen + const detail = app.find('.tou__title')[0] + assert.equal(detail.textContent, 'Privacy Notice', 'privacy notice screen') + app.find('button').click() + + await timeout(1000) + + + // terms of service screen + const tou = app.find('.tou__title')[0] + assert.equal(tou.textContent, 'Terms of Use', 'terms of use screen') + app.find('.tou__body').scrollTop(100000) + await timeout(1000) + + app.find('.first-time-flow__button').click() + await timeout(1000) + + // secret backup phrase + const seedTitle = app.find('.backup-phrase__title')[0] + assert.equal(seedTitle.textContent, 'Secret Backup Phrase', 'seed phrase screen') + app.find('.backup-phrase__reveal-button').click() + + await timeout(1000) + const seedPhrase = app.find('.backup-phrase__secret-words').text().split(' ') + app.find('.first-time-flow__button').click() + + const selectPhrase = text => { + const option = $('.backup-phrase__confirm-seed-option') + .filter((i, d) => d.textContent === text)[0] + + $(option).click() + } + + await timeout(1000) + + seedPhrase.forEach(sp => selectPhrase(sp)) + app.find('.first-time-flow__button').click() + await timeout(1000) + + // Deposit Ether Screen + const buyEthTitle = app.find('.buy-ether__title')[0] + assert.equal(buyEthTitle.textContent, 'Deposit Ether', 'deposit ether screen') + app.find('.buy-ether__do-it-later').click() + await timeout(1000) const sandwich = app.find('.sandwich-expando')[0] sandwich.click() -- cgit v1.2.3