aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-09-19 09:13:15 +0800
committerGitHub <noreply@github.com>2017-09-19 09:13:15 +0800
commita67d3ecd46ac2b9932d1a4181bb76631b27629c2 (patch)
treed96b262074f506a1a7a48975dbf85e1374207851 /test
parent190330db921d5549a3e4363308545fb702e0089c (diff)
parent7094d965291fa19f96145d122cb9f0f76da053c0 (diff)
downloadtangerine-wallet-browser-a67d3ecd46ac2b9932d1a4181bb76631b27629c2.tar
tangerine-wallet-browser-a67d3ecd46ac2b9932d1a4181bb76631b27629c2.tar.gz
tangerine-wallet-browser-a67d3ecd46ac2b9932d1a4181bb76631b27629c2.tar.bz2
tangerine-wallet-browser-a67d3ecd46ac2b9932d1a4181bb76631b27629c2.tar.lz
tangerine-wallet-browser-a67d3ecd46ac2b9932d1a4181bb76631b27629c2.tar.xz
tangerine-wallet-browser-a67d3ecd46ac2b9932d1a4181bb76631b27629c2.tar.zst
tangerine-wallet-browser-a67d3ecd46ac2b9932d1a4181bb76631b27629c2.zip
Merge branch 'master' into NewUI-flat
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)
+}