push everything
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
lib
|
||||
.test
|
||||
phantomjsdriver.log
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
before-install:
|
||||
- export TRAVIS_COMMIT_MSG="$(git log --format=%B --no-merges -n 1)"
|
||||
env:
|
||||
global:
|
||||
- secure: pdkgtWkvLHw9GCLdyOzd2Rl5RVQA5YgcA6gBYscEscrztiEslC6ZvljQszS8Imi3hQtgsvczoJSpAt24L2PAP137VG9n/RYHTj3L5wu3JLqYJOqtxkFDHCSxB7g8m0ESMHc2zXJ2ymbwR2lMValLmPkwn41Dkmcwom5Y2L3OR/nQvi2WSDkN8IMqQH8uRUZIgDjAAVyA+sR0UZyYwQFgvb3fPS4G+1QXiIu1sQ6oOa6c8HAwUlV8umrI4+t5vSJBwNk/Sl0RxTc3f0z36GvFNBxvpGsJXCNdteio633yMvaQnCc6BJpmqvVqveOXEZ8l3myRN0mIs20FM92Sx3Mg4QlvogbKw6fDLFM0+cYeuBwX31YQ7vCw3mazH/v1RUCkfit1Am66Hv+OuJpBgLVR9bPMfKRZlbgnCOBX+YZKTjM4UWl7lF4gSO9ySzC16nbNixgtC0RGt3MHb7JhlOormOqnvbQV7t45Ktm6d+GyREOeXCSi4ncgXF/lwBN+0wubQZEVQlNNzL3Ed1gYSwGvBgYxIadYYgTmHXYhhndRqPIfRw5J5CRNTwlGGat1yC0R6HV1xQMhXjlfo2knTKrHS103myUnjLpGIJS/bJxcNms+CmAXUtS17xDHGe8r6lCrcevFraDwAXWsoffYPEa8yWcKKoT/G/izwtPkAoeqRoI=
|
||||
- secure: JU9gQ+l5Afbou973viwx/jDoCG7HDjwij9N8lZeKeVBptoBPfnWJ6FL6RVtbcAco70g8RsEKHyeHtuS6o83NwZ8yGKMvKn8weErWE5Ftj72VrnGen1ZUEzj38/vLf9N/VWUZMCaynJNF2iKwXqewTLLPW660b6N8EtZTy/IGP7pFgryhe3r0dQMTei27c81542iC/FBVMX5HCrJfVCUH9bFSKcd7aWQbQNBQXi/TUTJ74eM64Pi+IFX012n5jYdewCYXf0LvPyYYL3RrJNI0+/aq4eBeZkVEMnFMNK3FqKKWIiDV4/OhRca4MrQS0ekboIjfI763eJooE7QnGKfHMT8Tenuf1WbjEFaUILs6r5O0gFuVcrZRaYPQdFJI2GmwbFrlSXhjyihgFF2yc7EUxdqKPvy4Ct2Qt40qlKciQRjnlLQwTxU48bC4XqfNzLuJkLSqK55aLWwTn6hsGzm6JEoYGDI6/ysqoGhXDgtKGjRB22pH4ZqyqPo5h8hhZm/iIn44iTgGFlhbHKTBUhdJbrilckuxoakhY5VNNSMJKprs90T98WGwWUOpMsMDa6Eugy9LiElEtfw7n3LWE2oGHRTJvwIZAlk7CFo8uznaGTemaW0KCs5TQo0cTK/RiT3GLrQnDhCP6EcYU9fMojCK9iY09cWBXF9ovTGrhQBvj2I=
|
||||
addons:
|
||||
sauce_connect: true
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.12
|
||||
script: |
|
||||
./node_modules/.bin/shortcake test-ci
|
||||
notifications:
|
||||
email:
|
||||
on_success: change
|
||||
on_failure: always
|
||||
slack:
|
||||
secure: FxW7/9uXX6lydfhe0cbKRu5Aq82FEHSYqNEgUOmPJF5dWej07jtKdu0CuzDgEkMBXvRN3nouEdszl1lqdvb3s6e4UW+y6BhkdQxqEgN/Ch9Mk1LklFh1wk1yRJTHoZCHVk1QWqGzqBgMB0AHXNxe0RZrWqH1sAa4oFn2NIt2b79Wfrh25uPVnWIwl4t+CX/+vRvbBoGTXqhGJy8KQhzOystUsmuunVeOpg5gHSlHE2bc8a1QC9m51XxLcXfMV4rTuhfFHGVqPd4m1dDbhOVQRW1zMhoMkWl18V9qNOtOPT8q8NQwSBBHZ5/5d80BECGFIDF6fWcrqjGzzSTnxYmzRdCtBE7ni+y9f9+91WWNowJDckarW+91BpPi58RY6oSDvEOlD3ycMEGRuAFAXvW4cO0skWsUS0yA7OFv4K//g3Lbx0OEKZvy2zbmreLpmki9/8MkyP3geJNyv8SpxRFmBnF+Cx45amNgNN00Z8AVVJ1ad2hwV7YLJxlDej4PfP6cuyG1mwNO2gzk+n1FhjZgggKWIC8Winm0yEI6PrlEg3rJ5lcyQ3z/935Jy8seGE3mWRDyS/gNLa6vUhSRWNkDLVL9sYnLo/BLXZhtKDkQOSPAtb93eRlFoP4pvmj5BIryaUq7IoQB/QYTvvYHNEaSjWD9hyOBTWIDXTbR1SH/UNo=
|
||||
@@ -0,0 +1,65 @@
|
||||
Iexec = require('shortcake').exec
|
||||
|
||||
option '-b', '--browser [browserName]', 'browser to test with'
|
||||
|
||||
task 'build', 'Build module and bundled crowdcontrol.js', ->
|
||||
exec 'node_modules/.bin/requisite src/index.coffee -o espy.js'
|
||||
|
||||
task 'build-min', 'Build minified espy.min.js', ->
|
||||
exec 'node_modules/.bin/requisite src/index.coffee -m -o espy.min.js'
|
||||
|
||||
task 'watch', 'watch for changes and recompile', ->
|
||||
exec 'node_modules/.bin/bebop'
|
||||
|
||||
task 'static-server', 'Run static server for tests', ->
|
||||
connect = require 'connect'
|
||||
server = connect()
|
||||
server.use (require 'serve-static') './test'
|
||||
server.listen process.env.PORT ? 3333
|
||||
|
||||
task 'selenium-install', 'Install selenium standalone', ->
|
||||
exec 'node_modules/.bin/selenium-standalone install'
|
||||
|
||||
task 'test', 'Run tests', (options) ->
|
||||
browserName = options.browser ? 'phantomjs'
|
||||
|
||||
invoke 'static-server'
|
||||
|
||||
selenium = require 'selenium-standalone'
|
||||
selenium.start (err, child) ->
|
||||
throw err if err?
|
||||
|
||||
exec "NODE_ENV=test
|
||||
BROWSER=#{browserName}
|
||||
node_modules/.bin/mocha
|
||||
--compilers coffee:coffee-script/register
|
||||
--reporter spec
|
||||
--colors
|
||||
--timeout 60000
|
||||
test/test.coffee", (err) ->
|
||||
child.kill()
|
||||
process.exit 1 if err?
|
||||
process.exit 0
|
||||
|
||||
task 'test-ci', 'Run tests on CI server', ->
|
||||
invoke 'static-server'
|
||||
|
||||
browsers = require './test/ci-config'
|
||||
|
||||
tests = for {browserName, platform, version, deviceName, deviceOrientation} in browsers
|
||||
"NODE_ENV=test
|
||||
BROWSER=\"#{browserName}\"
|
||||
PLATFORM=\"#{platform}\"
|
||||
VERSION=\"#{version}\"
|
||||
DEVICE_NAME=\"#{deviceName ? ''}\"
|
||||
DEVICE_ORIENTATION=\"#{deviceOrientation ? ''}\"
|
||||
node_modules/.bin/mocha
|
||||
--compilers coffee:coffee-script/register
|
||||
--reporter spec
|
||||
--colors
|
||||
--timeout 60000
|
||||
test/test.coffee"
|
||||
|
||||
exec tests, (err) ->
|
||||
process.exit 1 if err?
|
||||
process.exit 0
|
||||
@@ -0,0 +1,26 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
|
||||
requisite = 'node_modules/.bin/requisite -g'
|
||||
|
||||
files =
|
||||
js:
|
||||
in: 'src/index.coffee'
|
||||
out: 'espy.js'
|
||||
|
||||
module.exports =
|
||||
port: 4242
|
||||
|
||||
cwd: process.cwd()
|
||||
|
||||
exclude: [
|
||||
/css/
|
||||
/lib/
|
||||
/node_modules/
|
||||
/vendor/
|
||||
]
|
||||
|
||||
compilers:
|
||||
coffee: (src) ->
|
||||
if /^src/.test src
|
||||
return "#{requisite} #{files.js.in} -o #{files.js.out}"
|
||||
@@ -38,6 +38,7 @@
|
||||
"homepage": "https://github.com/crowdstart/espy#readme",
|
||||
"dependencies": {
|
||||
"cookies-js": "^1.2.1",
|
||||
"cuckoo-js": "^1.0.1",
|
||||
"node-uuid": "^1.4.3",
|
||||
"query-string": "^2.3.0",
|
||||
"store": "^1.3.17",
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
store = require 'store'
|
||||
cookie = require 'cookie-js'
|
||||
useragent = require 'useragent'
|
||||
qs = require 'query-string'
|
||||
|
||||
uuid = require 'node-uuid'
|
||||
|
||||
userIdCookie = '__cs-uid'
|
||||
sessionIdCookie = '__cs-sid'
|
||||
|
||||
class Record
|
||||
pageId: ''
|
||||
lastPageId: ''
|
||||
pageViewId: ''
|
||||
lastPageViewId: ''
|
||||
queue: []
|
||||
|
||||
class Event
|
||||
|
||||
do ->
|
||||
# Local Storage Record Management
|
||||
getRecord = ()->
|
||||
return store.get(getSessionId()) ? new Record
|
||||
|
||||
setRecord = (record)->
|
||||
return store.set getSessionId(), record ? new Record
|
||||
|
||||
getTimestamp = ()->
|
||||
return (new Date).getMilliseconds()
|
||||
|
||||
# User/Session Id Management (on cookies)
|
||||
cachedUserId
|
||||
getUserId = ()->
|
||||
if cachedUserId?
|
||||
return cachedUserId
|
||||
|
||||
userId = cookie.get userIdCookie
|
||||
if !userId?
|
||||
userId = uuid.v4()
|
||||
cookies.set userIdCookie, userId,
|
||||
domain: '.' + document.domain
|
||||
|
||||
cachedUserId = userId
|
||||
return userId
|
||||
|
||||
cachedSessionId
|
||||
getSessionId = ()->
|
||||
if cachedSessionId?
|
||||
return cachedSessionId
|
||||
|
||||
sessionId = cookie.get sessionIdCookie
|
||||
if !sessionId?
|
||||
sessionId = getUserId() + '_' + getTimestamp()
|
||||
cookies.set sessionIdCookie, sessionId,
|
||||
domain: '.' + document.domain
|
||||
expires: 1800
|
||||
|
||||
cachedSessionId = sessionId
|
||||
return sessionId
|
||||
|
||||
refreshSession = ()->
|
||||
#cookie needs to be refreshed always
|
||||
sessionId = cookies.get sessionIdCookie
|
||||
cookies.set sessionIdCookie, sessionId,
|
||||
domain: '.' + document.domain
|
||||
expires: 1800
|
||||
|
||||
# Page Transitions (in localstorage)
|
||||
cachedPageId
|
||||
cachedPageViewId
|
||||
getPageId = ()->
|
||||
return cachedPageId
|
||||
|
||||
getPageViewId = ()->
|
||||
return cachedPageViewId
|
||||
|
||||
getQueryParams = ()->
|
||||
return qs.parse window.location.search
|
||||
|
||||
updatePage = ()->
|
||||
newPageId = window.location.pathname + window.location.hash
|
||||
if newPageId != cachedPageId
|
||||
cachedPageId = newPageId
|
||||
cachedPageViewId = cachedPageId + '_' + getTimestamp()
|
||||
|
||||
#fireEventHere!
|
||||
|
||||
record = getRecord()
|
||||
record.lastPageId = record.pageId
|
||||
record.lastPageViewId = record.pageViewId
|
||||
record.pageId = cachedPageId
|
||||
record.pageViewId = cachedPageViewId
|
||||
|
||||
refreshSession()
|
||||
|
||||
window.addEventListener 'hashchange', updatePage
|
||||
window.addEventListener 'popstate', updatePage
|
||||
updatePage()
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
module.exports = [
|
||||
# browserName: 'iphone'
|
||||
# platform: 'OS X 10.10'
|
||||
# version: '8.2'
|
||||
# # deviceName: 'iPhone Simulator'
|
||||
# deviceOrientation: 'portrait'
|
||||
# ,
|
||||
# browserName: 'iphone'
|
||||
# platform: 'OS X 10.10'
|
||||
# version: '7.1'
|
||||
# # deviceName: 'iPhone Simulator'
|
||||
# deviceOrientation: 'portrait'
|
||||
# ,
|
||||
# browserName: 'iphone'
|
||||
# platform: 'OS X 10.10'
|
||||
# version: '6.1'
|
||||
# # deviceName: 'iPhone Simulator'
|
||||
# deviceOrientation: 'portrait'
|
||||
# ,
|
||||
browserName: 'android'
|
||||
platform: 'Linux'
|
||||
version: '5.1'
|
||||
# deviceName: 'Android Emulator'
|
||||
deviceOrientation: 'portrait'
|
||||
,
|
||||
# browserName: 'android'
|
||||
# platform: 'Linux'
|
||||
# version: '4.4'
|
||||
# # deviceName: 'Android Emulator'
|
||||
# deviceOrientation: 'portrait'
|
||||
# ,
|
||||
# browserName: 'android'
|
||||
# platform: 'Linux'
|
||||
# version: '4.3'
|
||||
# # deviceName: 'Android Emulator'
|
||||
# deviceOrientation: 'portrait'
|
||||
# ,
|
||||
# browserName: 'safari'
|
||||
# platform: 'OS X 10.10'
|
||||
# version: '8.0'
|
||||
# ,
|
||||
# browserName: 'internet explorer'
|
||||
# platform: 'Windows 8.1'
|
||||
# version: '11.0'
|
||||
# ,
|
||||
# browserName: 'internet explorer'
|
||||
# platform: 'Windows 8'
|
||||
# version: '10.0'
|
||||
# ,
|
||||
# browserName: 'internet explorer'
|
||||
# platform: 'Windows 7'
|
||||
# version: '9.0'
|
||||
# ,
|
||||
# browserName: 'internet explorer'
|
||||
# platform: 'Windows XP'
|
||||
# version: '8.0'
|
||||
# ,
|
||||
browserName: 'chrome'
|
||||
platform: 'Linux'
|
||||
version: '43.0'
|
||||
,
|
||||
browserName: 'firefox'
|
||||
platform: 'Linux'
|
||||
version: '38.0'
|
||||
]
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../cuckoo.js
|
||||
Vendored
+5
File diff suppressed because one or more lines are too long
@@ -0,0 +1,57 @@
|
||||
assert = require 'assert'
|
||||
should = require('chai').should()
|
||||
|
||||
{getBrowser} = require './util'
|
||||
|
||||
describe "Cuckoo (#{process.env.BROWSER})", ->
|
||||
@timeout 90000
|
||||
browser = getBrowser()
|
||||
testPage = "http://localhost:#{process.env.PORT ? 3333}/test.html"
|
||||
|
||||
describe 'Cuckoo can capture uncaptured events', ->
|
||||
it 'should capture a click on an element without a handler', (done) ->
|
||||
browser
|
||||
.url testPage
|
||||
.waitForExist '#somelink', 5000
|
||||
.click '#somelink'
|
||||
.getText '#result', (err, res) ->
|
||||
res.should.equal 'clicked: somelink'
|
||||
.call done
|
||||
|
||||
it 'should capture window events like hashchange', (done) ->
|
||||
browser
|
||||
.url testPage
|
||||
.waitForExist '#linktobookmark', 5000
|
||||
.click '#linktobookmark'
|
||||
.getText '#result', (err, res) ->
|
||||
res.should.equal 'hashchangeed: undefined'
|
||||
.call done
|
||||
|
||||
it 'should filter events', (done) ->
|
||||
browser
|
||||
.url testPage
|
||||
.setValue '#changeinput', 'somethingelse'
|
||||
.getValue '#changeinput', (err, res) ->
|
||||
res.should.equal('somethingelse')
|
||||
.getText '#rejected', (err, res) ->
|
||||
res.should.equal 'changeed: changeinput'
|
||||
.call done
|
||||
|
||||
describe 'Cuckoo can capture captured events', ->
|
||||
it 'should capture propagated events', (done) ->
|
||||
browser
|
||||
.url testPage
|
||||
.waitForExist '#clickablediv', 5000
|
||||
.click '#clickablediv'
|
||||
.getText '#result', (err, res) ->
|
||||
res.should.equal 'clicked: clickablediv'
|
||||
.call done
|
||||
|
||||
it 'should capture unpropagated events', (done) ->
|
||||
browser
|
||||
.url testPage
|
||||
.waitForExist '#dontstopmenow', 5000
|
||||
.click '#dontstopmenow'
|
||||
.getText '#result', (err, res) ->
|
||||
res.should.equal 'clicked: dontstopmenow'
|
||||
.call done
|
||||
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title></title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
||||
<script src="jquery-1.11.3.min.js"></script>
|
||||
<script src="espy.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,29 @@
|
||||
webdriver = require 'webdriverio'
|
||||
|
||||
exports.getBrowser = ->
|
||||
browserName = process.env.BROWSER
|
||||
|
||||
opts =
|
||||
desiredCapabilities:
|
||||
browserName: browserName ? 'phantomjs'
|
||||
'phantomjs.binary.path': './node_modules/phantomjs/bin/phantomjs'
|
||||
logLevel: 'verbose'
|
||||
|
||||
if process.env.TRAVIS?
|
||||
opts =
|
||||
desiredCapabilities:
|
||||
browserName: browserName
|
||||
name: process.env.TRAVIS_COMMIT
|
||||
tags: [
|
||||
process.env.TRAVIS_PULL_REQUEST
|
||||
process.env.TRAVIS_BRANCH
|
||||
process.env.TRAVIS_BUILD_NUMBER
|
||||
]
|
||||
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER
|
||||
host: 'ondemand.saucelabs.com'
|
||||
port: 80
|
||||
user: process.env.SAUCE_USERNAME
|
||||
key: process.env.SAUCE_ACCESS_KEY
|
||||
logLevel: 'silent'
|
||||
|
||||
webdriver.remote(opts).init()
|
||||
Reference in New Issue
Block a user