commit
aef707a12f
@ -0,0 +1,2 @@ |
||||
bower_components/ |
||||
node_modules/ |
@ -0,0 +1,15 @@ |
||||
{ |
||||
"name": "glowing-bear", |
||||
"description": "A webclient for WeeChat", |
||||
"version": "0.4.0", |
||||
"homepage": "https://github.com/glowing-bear/glowing-bear", |
||||
"license": "GPLv3", |
||||
"private": true, |
||||
"dependencies": { |
||||
"angular": "1.3.x", |
||||
"angular-route": "1.3.x", |
||||
"angular-loader": "1.3.x", |
||||
"angular-mocks": "~1.3.x", |
||||
"html5-boilerplate": "~4.3.0" |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
{ |
||||
"name": "glowing-bear", |
||||
"private": true, |
||||
"version": "0.4.0", |
||||
"description": "A web client for Weechat", |
||||
"repository": "https://github.com/glowing-bear/glowing-bear", |
||||
"license": "GPLv3", |
||||
"devDependencies": { |
||||
"karma": "~0.10", |
||||
"protractor": "~0.20.1", |
||||
"http-server": "^0.6.1", |
||||
"bower": "^1.3.1", |
||||
"shelljs": "^0.2.6", |
||||
"jshint": "^2.5.2", |
||||
"karma-junit-reporter": "^0.2.2" |
||||
}, |
||||
"scripts": { |
||||
"postinstall": "bower install", |
||||
|
||||
"prestart": "npm install", |
||||
"start": "http-server -a localhost -p 8000", |
||||
|
||||
"pretest": "npm install", |
||||
"test": "karma start test/karma.conf.js", |
||||
"test-single-run": "karma start test/karma.conf.js --single-run", |
||||
|
||||
"preupdate-webdriver": "npm install", |
||||
"update-webdriver": "webdriver-manager update", |
||||
|
||||
"preprotractor": "npm run update-webdriver", |
||||
"protractor": "protractor test/protractor-conf.js", |
||||
|
||||
"update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\"" |
||||
} |
||||
} |
@ -0,0 +1,2 @@ |
||||
./node_modules/.bin/jshint js/*.js test/unit/*.js |
||||
npm test |
@ -0,0 +1,26 @@ |
||||
'use strict'; |
||||
|
||||
/* https://github.com/angular/protractor/blob/master/docs/getting-started.md */ |
||||
|
||||
describe('Auth', function() { |
||||
|
||||
browser.get('index.html'); |
||||
var ptor = protractor.getInstance(); |
||||
it('auth should fail when trying to connect to an unused port', function() { |
||||
var host = ptor.findElement(protractor.By.model('host')); |
||||
var password = ptor.findElement(protractor.By.model('password')); |
||||
var port = ptor.findElement(protractor.By.model('port')); |
||||
var submit = ptor.findElement(protractor.By.tagName('button')); |
||||
// Fill out the form?
|
||||
host.sendKeys('localhost'); |
||||
password.sendKeys('password'); |
||||
port.sendKeys(2462); |
||||
submit.click(); |
||||
|
||||
var error = ptor.findElement( |
||||
protractor.By.css('.alert.alert-danger > strong') |
||||
) |
||||
|
||||
expect(error.getText()).toBeDefined(); |
||||
}); |
||||
}); |
@ -0,0 +1,34 @@ |
||||
module.exports = function(config){ |
||||
config.set({ |
||||
|
||||
basePath : '../', |
||||
|
||||
files : [ |
||||
'bower_components/angular/angular.js', |
||||
'bower_components/angular-route/angular-route.js', |
||||
'bower_components/angular-mocks/angular-mocks.js', |
||||
'js/**/*.js', |
||||
'test/unit/**/*.js' |
||||
], |
||||
|
||||
autoWatch : true, |
||||
|
||||
frameworks: ['jasmine'], |
||||
|
||||
browsers : ['PhantomJS'], |
||||
|
||||
singleRun: true, |
||||
|
||||
plugins : [ |
||||
'karma-phantomjs-launcher', |
||||
'karma-jasmine', |
||||
'karma-junit-reporter' |
||||
], |
||||
|
||||
junitReporter : { |
||||
outputFile: 'test_out/unit.xml', |
||||
suite: 'unit' |
||||
} |
||||
|
||||
}); |
||||
}; |
@ -0,0 +1,19 @@ |
||||
exports.config = { |
||||
allScriptsTimeout: 11000, |
||||
|
||||
specs: [ |
||||
'e2e/*.js' |
||||
], |
||||
|
||||
capabilities: { |
||||
'browserName': 'firefox' |
||||
}, |
||||
|
||||
baseUrl: 'http://localhost:8000/', |
||||
|
||||
framework: 'jasmine', |
||||
|
||||
jasmineNodeOpts: { |
||||
defaultTimeoutInterval: 30000 |
||||
} |
||||
}; |
@ -0,0 +1,140 @@ |
||||
/* plugins go here */ |
||||
|
||||
var msg = function(msg) { |
||||
return {'text': msg }; |
||||
}; |
||||
|
||||
var metadata_name = function(message) { |
||||
if (message.metadata && message.metadata[0] && message.metadata[0].name) { |
||||
return message.metadata[0].name; |
||||
} |
||||
return null; |
||||
}; |
||||
|
||||
var expectTheseMessagesToContain = function(urls, pluginType, plugins) { |
||||
for (var i = 0; i < urls.length; i++) { |
||||
expect( |
||||
metadata_name( |
||||
plugins.PluginManager.contentForMessage(msg(urls[i])) |
||||
) |
||||
).toEqual(pluginType); |
||||
} |
||||
}; |
||||
|
||||
describe('filter', function() { |
||||
beforeEach(module('plugins')); |
||||
|
||||
describe('Plugins', function() { |
||||
beforeEach(module(function($provide) { |
||||
$provide.value('version', 'TEST_VER'); |
||||
})); |
||||
|
||||
it('should recognize spotify tracks', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'spotify:track:6JEK0CvvjDjjMUBFoXShNZ', |
||||
'https://open.spotify.com/track/6JEK0CvvjDjjMUBFoXShNZ' |
||||
], |
||||
'Spotify track', |
||||
plugins); |
||||
})); |
||||
|
||||
|
||||
it('should recognize youtube videos', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'https://www.youtube.com/watch?v=dQw4w9WgXcQ', |
||||
'http://www.youtube.com/watch?v=dQw4w9WgXcQ', |
||||
'http://youtu.be/J6vIS8jb6Fs', |
||||
'https://youtu.be/J6vIS8jb6Fs', |
||||
'http://www.youtube.com/embed/dQw4w9WgXcQ', |
||||
'https://www.youtube.com/embed/dQw4w9WgXcQ', |
||||
'youtu.be/dQw4w9WgXcQ' |
||||
], |
||||
'YouTube video', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize dailymotion videos', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'dailymotion.com/video/test', |
||||
'dailymotion.com/video/#video=asdf', |
||||
'dai.ly/sfg' |
||||
], |
||||
'Dailymotion video', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize allocine videos', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'allocine.fr/videokast/video-12', |
||||
'allocine.fr/cmedia=234' |
||||
], |
||||
'AlloCine video', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize images', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'http://i.imgur.com/BTNIDBR.gif', |
||||
'https://i.imgur.com/1LmDmct.jpg', |
||||
'http://i.imgur.com/r4FKrnu.jpeg', |
||||
'https://4z2.de/gb-mobile-new.png', |
||||
'http://static.weechat.org/images/screenshots/relay/medium/glowing-bear.png', |
||||
'http://foo.bar/baz.php?img=trololo.png&dummy=yes', |
||||
'https://tro.lo.lo/images/rick.png?size=123x45' |
||||
], |
||||
'image', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize cloud music', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'http://soundcloud.com/', |
||||
'https://sadf.mixcloud.com/', |
||||
], |
||||
'cloud music', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize google map', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'https://www.google.com/maps/@48.0034139,-74.9129088,6z', |
||||
], |
||||
'Google Map', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize google map', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'https://asciinema.org/a/10625', |
||||
], |
||||
'ascii cast', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize meteograms', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'http://www.yr.no/sted/Canada/Quebec/Montreal/', |
||||
], |
||||
'meteogram', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize gists', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'https://gist.github.com/lorenzhs/e8c1a7d56fa170320eb8', |
||||
'https://gist.github.com/e8c1a7d56fa170320eb8', |
||||
], |
||||
'Gist', |
||||
plugins); |
||||
})); |
||||
|
||||
it('should recognize tweets', inject(function(plugins) { |
||||
expectTheseMessagesToContain([ |
||||
'https://twitter.com/DFB_Team_EN/statuses/488436782959448065', |
||||
], |
||||
'Tweet', |
||||
plugins); |
||||
})); |
||||
|
||||
}); |
||||
}); |
Loading…
Reference in new issue