demonstrator
Advanced tools
Comparing version 0.0.1 to 0.1.0
42
index.js
@@ -0,38 +1,8 @@ | ||
var Session = require('./session'); | ||
var config = require('./config'); | ||
module.exports = { | ||
record: function(browser, selector){ | ||
var session = { | ||
frames: [], | ||
save: function(){}, | ||
display: function(parentDocument){ | ||
var playback = parentDocument.createElement('div'); | ||
playback.className = 'demonstrator'; | ||
session.frames.forEach(function(frame){ | ||
var frameEl = parentDocument.createElement('div'); | ||
frameEl.className = 'frame'; | ||
var heading = parentDocument.createElement('h1'); | ||
heading.className = 'heading'; | ||
heading.innerHTML = frame.event; | ||
frameEl.appendChild(heading); | ||
var content = parentDocument.createElement('div'); | ||
content.className = 'html'; | ||
content.innerHTML = frame.html; | ||
frameEl.appendChild(content); | ||
playback.appendChild(frameEl); | ||
}) | ||
parentDocument.body.appendChild(playback); | ||
} | ||
} | ||
function capture(eventType){ | ||
setTimeout(function(){ | ||
session.frames.push({ | ||
event: eventType, | ||
html: document.querySelector(selector).innerHTML | ||
}); | ||
}, 0); | ||
} | ||
var session = new Session(selector); | ||
session.auth = config.getAuth(); | ||
session.browser = browser.on(function(e){ | ||
@@ -43,7 +13,7 @@ if (e.element && e.text != undefined){ | ||
capture(e.type); | ||
session.capture(e.type); | ||
}); | ||
capture('initial'); | ||
session.capture('initial'); | ||
return session; | ||
} | ||
} |
@@ -6,2 +6,3 @@ module.exports = function(config) { | ||
files: [ | ||
'test/global.js', | ||
'test/**/*Spec.js' | ||
@@ -13,3 +14,3 @@ ], | ||
preprocessors: { | ||
'test/**/*Spec.js': ['browserify'] | ||
'test/**/*.js': ['browserify'] | ||
}, | ||
@@ -16,0 +17,0 @@ browserify: { |
{ | ||
"name": "demonstrator", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Catpure progress of user tests and share it with your team", | ||
@@ -14,2 +14,3 @@ "main": "index.js", | ||
"chai": "^3.4.1", | ||
"debug": "^2.2.0", | ||
"karma": "^0.13.15", | ||
@@ -20,2 +21,3 @@ "karma-browserify": "^4.4.0", | ||
"mocha": "^2.3.4", | ||
"mock-xhr-router": "^1.7.0", | ||
"plastiq": "^1.24.6", | ||
@@ -28,2 +30,3 @@ "plastiq-jsxify": "^1.0.0" | ||
"dependencies": { | ||
"httpism": "^1.8.1" | ||
}, | ||
@@ -30,0 +33,0 @@ "repository": { |
@@ -1,2 +0,1 @@ | ||
var expect = require('chai').expect; | ||
var browser = require('browser-monkey'); | ||
@@ -27,2 +26,9 @@ var demonstrator = require('../'); | ||
describe('recorder', function(){ | ||
beforeEach(function(){ | ||
window.__env__ = { | ||
DEMONSTRATOR_API_KEY: '123', | ||
DEMONSTRATOR_USER: 'dereke', | ||
DEMONSTRATOR_APP: 'demonstrator' | ||
}; | ||
}); | ||
it('records a browser-monkey test', function(){ | ||
@@ -55,2 +61,11 @@ mountApp(); | ||
}); | ||
it('sets auth data for a session', function(){ | ||
var recorder = demonstrator.record(browser, 'body'); | ||
expect(recorder.auth).to.eql({ | ||
api_key: '123', | ||
user: 'dereke', | ||
app: 'demonstrator' | ||
}); | ||
}); | ||
}); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
10599
12
264
1
11
2
+ Addedhttpism@^1.8.1
+ Addedagent-base@2.1.1(transitive)
+ Addeddebug@2.2.0(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedhttpism@1.14.0(transitive)
+ Addedhttps-proxy-agent@1.0.0(transitive)
+ Addedms@0.7.1(transitive)
+ Addedqs@0.6.6(transitive)
+ Addedsemver@5.0.3(transitive)
+ Addedtough-cookie@2.2.0(transitive)
+ Addedunderscore@1.13.7(transitive)