aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-09-23 05:12:41 +0800
committerDan Finlay <dan@danfinlay.com>2017-09-23 05:12:41 +0800
commitf9d2f523c628228a77c28e7d46d08151453a47bc (patch)
treea6fbca183622486f2107a885d5e6d3158f20a35a /test
parentd2a747e57e591af5beb2e7cef7fc73a363d9c742 (diff)
parent73d9434ad63e18a87bd3ed13a285eb37c9c6ae7c (diff)
downloadtangerine-wallet-browser-f9d2f523c628228a77c28e7d46d08151453a47bc.tar
tangerine-wallet-browser-f9d2f523c628228a77c28e7d46d08151453a47bc.tar.gz
tangerine-wallet-browser-f9d2f523c628228a77c28e7d46d08151453a47bc.tar.bz2
tangerine-wallet-browser-f9d2f523c628228a77c28e7d46d08151453a47bc.tar.lz
tangerine-wallet-browser-f9d2f523c628228a77c28e7d46d08151453a47bc.tar.xz
tangerine-wallet-browser-f9d2f523c628228a77c28e7d46d08151453a47bc.tar.zst
tangerine-wallet-browser-f9d2f523c628228a77c28e7d46d08151453a47bc.zip
Merge branch 'master' into AddBalanceController
Diffstat (limited to 'test')
-rw-r--r--test/base.conf.js59
-rw-r--r--test/flat.conf.js8
-rw-r--r--test/integration/lib/first-time.js27
-rw-r--r--test/mascara.conf.js17
4 files changed, 94 insertions, 17 deletions
diff --git a/test/base.conf.js b/test/base.conf.js
new file mode 100644
index 000000000..122392822
--- /dev/null
+++ b/test/base.conf.js
@@ -0,0 +1,59 @@
+// Karma configuration
+// Generated on Mon Sep 11 2017 18:45:48 GMT-0700 (PDT)
+
+module.exports = function(config) {
+ return {
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: process.cwd(),
+
+ browserConsoleLogOptions: {
+ terminal: false,
+ },
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['qunit'],
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'test/integration/jquery-3.1.0.min.js',
+ { pattern: 'dist/chrome/images/**/*.*', watched: false, included: false, served: true },
+ { pattern: 'dist/chrome/fonts/**/*.*', watched: false, included: false, served: true },
+ ],
+
+ proxies: {
+ '/images/': '/base/dist/chrome/images/',
+ '/fonts/': '/base/dist/chrome/fonts/',
+ },
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['progress'],
+
+ // web server port
+ port: 9876,
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: false,
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: ['Chrome', 'Firefox'],
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: true,
+
+ // Concurrency level
+ // how many browser should be started simultaneous
+ concurrency: Infinity
+ }
+}
diff --git a/test/flat.conf.js b/test/flat.conf.js
new file mode 100644
index 000000000..cd2dbdcdc
--- /dev/null
+++ b/test/flat.conf.js
@@ -0,0 +1,8 @@
+const getBaseConfig = require('./base.conf.js')
+
+module.exports = function(config) {
+ const settings = getBaseConfig(config)
+ settings.files.push('development/bundle.js')
+ settings.files.push('test/integration/bundle.js')
+ config.set(settings)
+}
diff --git a/test/integration/lib/first-time.js b/test/integration/lib/first-time.js
index 38a94e551..cedb14f6e 100644
--- a/test/integration/lib/first-time.js
+++ b/test/integration/lib/first-time.js
@@ -10,19 +10,12 @@ QUnit.test('render init screen', (assert) => {
})
})
-// QUnit.testDone(({ module, name, total, passed, failed, skipped, todo, runtime }) => {
-// if (failed > 0) {
-// const app = $('iframe').contents()[0].documentElement
-// console.warn('Test failures - dumping DOM:')
-// console.log(app.innerHTML)
-// }
-// })
-
async function runFirstTimeUsageTest(assert, done) {
+ let waitTime = 0
+ if (window.METAMASK_PLATFORM_TYPE === 'mascara') waitTime = 4000
+ await timeout(waitTime)
- await timeout()
-
- const app = $('#app-content .mock-app-root')
+ const app = $('#app-content')
// recurse notices
while (true) {
@@ -32,10 +25,12 @@ async function runFirstTimeUsageTest(assert, done) {
const termsPage = app.find('.markdown')[0]
termsPage.scrollTop = termsPage.scrollHeight
await timeout()
+ console.log('Clearing notice')
button.click()
await timeout()
} else {
// exit loop
+ console.log('No more notices...')
break
}
}
@@ -58,7 +53,7 @@ async function runFirstTimeUsageTest(assert, done) {
const createButton = app.find('button.primary')[0]
createButton.click()
- await timeout(1500)
+ await timeout(3000)
const created = app.find('h3')[0]
assert.equal(created.textContent, 'Vault Created', 'Vault created screen')
@@ -129,10 +124,8 @@ async function runFirstTimeUsageTest(assert, done) {
assert.ok(children2, 'All network options present')
}
-function timeout(time) {
- return new Promise(function (resolve, reject) {
- setTimeout(function () {
- resolve()
- }, time * 3 || 1500)
+function timeout (time) {
+ return new Promise((resolve, reject) => {
+ setTimeout(resolve, time || 1500)
})
} \ No newline at end of file
diff --git a/test/mascara.conf.js b/test/mascara.conf.js
new file mode 100644
index 000000000..97e53fc2b
--- /dev/null
+++ b/test/mascara.conf.js
@@ -0,0 +1,17 @@
+const getBaseConfig = require('./base.conf.js')
+
+module.exports = function(config) {
+ const settings = getBaseConfig(config)
+
+ // ui and tests
+ settings.files.push('dist/mascara/ui.js')
+ settings.files.push('dist/mascara/tests.js')
+ // service worker background
+ settings.files.push({ pattern: 'dist/mascara/background.js', watched: false, included: false, served: true }),
+ settings.proxies['/background.js'] = '/base/dist/mascara/background.js'
+
+ // use this to keep the browser open for debugging
+ settings.browserNoActivityTimeout = 10000000
+
+ config.set(settings)
+}