mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Merge remote-tracking branch 'roramirez_github/develop' into default-hello-world
This commit is contained in:
66
tests/configs/check_config.js
Normal file
66
tests/configs/check_config.js
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Magic Mirror
|
||||
*
|
||||
* Checker configuration file
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena
|
||||
* https://rodrigoramirez.com
|
||||
*
|
||||
* MIT Licensed.
|
||||
*
|
||||
*/
|
||||
|
||||
var v = require("jshint");
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
var Utils = require(__dirname + "/../../js/utils.js");
|
||||
|
||||
if (process.env.NODE_ENV == "test") { return 0 };
|
||||
|
||||
/* getConfigFile()
|
||||
* Return string with path of configuration file
|
||||
* Check if set by enviroment variable MM_CONFIG_FILE
|
||||
*/
|
||||
function getConfigFile() {
|
||||
// FIXME: This function should be in core. Do you want refactor me ;) ?, be good!
|
||||
rootPath = path.resolve(__dirname + "/../../");
|
||||
var configFileName = path.resolve(rootPath + "/config/config.js");
|
||||
if (process.env.MM_CONFIG_FILE) {
|
||||
configFileName = path.resolve(process.env.MM_CONFIG_FILE);
|
||||
}
|
||||
return configFileName;
|
||||
}
|
||||
|
||||
var configFileName = getConfigFile();
|
||||
// Check if file is present
|
||||
if (fs.existsSync(configFileName) === false) {
|
||||
console.error(Utils.colors.error("File not found: "), configFileName);
|
||||
return;
|
||||
}
|
||||
// check permision
|
||||
try {
|
||||
fs.accessSync(configFileName, fs.F_OK);
|
||||
} catch (e) {
|
||||
console.log(Utils.colors.error(e));
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate syntax of the configuration file.
|
||||
// In case the there errors show messages and
|
||||
// return
|
||||
console.info(Utils.colors.info("Checking file... ", configFileName));
|
||||
// I'm not sure if all ever is utf-8
|
||||
fs.readFile(configFileName, "utf-8", function (err, data) {
|
||||
if (err) { throw err; }
|
||||
v.JSHINT(data); // Parser by jshint
|
||||
|
||||
if (v.JSHINT.errors.length == 0) {
|
||||
console.log("Your configuration file don't containt syntax error :)");
|
||||
return true;
|
||||
} else {
|
||||
errors = v.JSHINT.data().errors;
|
||||
for (idx in errors) {
|
||||
error = errors[idx];
|
||||
console.log("Line", error.line, "col", error.character, error.reason);
|
||||
}
|
||||
}
|
||||
});
|
410
tests/configs/data/feed_test_rodrigoramirez.xml
Normal file
410
tests/configs/data/feed_test_rodrigoramirez.xml
Normal file
@@ -0,0 +1,410 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
||||
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
|
||||
>
|
||||
|
||||
<channel>
|
||||
<title>Rodrigo Ramírez Norambuena</title>
|
||||
<atom:link href="https://rodrigoramirez.com/feed/" rel="self" type="application/rss+xml" />
|
||||
<link>https://rodrigoramirez.com</link>
|
||||
<description>Temas sobre Linux, VoIP, Open Source, tecnología y lo relacionado.</description>
|
||||
<lastBuildDate>Fri, 21 Oct 2016 21:30:22 +0000</lastBuildDate>
|
||||
<language>es-ES</language>
|
||||
<sy:updatePeriod>hourly</sy:updatePeriod>
|
||||
<sy:updateFrequency>1</sy:updateFrequency>
|
||||
<generator>https://wordpress.org/?v=4.7.3</generator>
|
||||
<item>
|
||||
<title>QPanel 0.13.0</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-0-13-0/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-0-13-0/#comments</comments>
|
||||
<pubDate>Tue, 20 Sep 2016 11:16:08 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Software]]></category>
|
||||
<category><![CDATA[app_queue]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[FreeSWITCH]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queue]]></category>
|
||||
<category><![CDATA[spy]]></category>
|
||||
<category><![CDATA[supervision]]></category>
|
||||
<category><![CDATA[templates]]></category>
|
||||
<category><![CDATA[whisper]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1299</guid>
|
||||
<description><![CDATA[<p>Ya está disponible la versión 0.13.0 de QPanel Para instalar esta nueva versión, la debes descargar de https://github.com/roramirez/qpanel/tree/0.13.0 En al README.md puedes encontrar las instrucciones para hacer que funcione en tu sistema. En esta nueva versión cuenta con los siguientes cambios: Se establece un limite para el reciclado del tiempo de conexión a la base […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-13-0/">QPanel 0.13.0</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="aligncenter" src="https://raw.githubusercontent.com/roramirez/qpanel/e55aa16bbd85b579ee82e56469526270c5afa462/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="685" height="385" />Ya está disponible la versión 0.13.0 de QPanel</p>
|
||||
<p>Para instalar esta nueva versión, la debes descargar de</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.13.0">https://github.com/roramirez/qpanel/tree/0.13.0</a></li>
|
||||
</ul>
|
||||
<p>En al README.md puedes encontrar las instrucciones para hacer que funcione en tu sistema.</p>
|
||||
<p>En esta nueva versión cuenta con los siguientes cambios:</p>
|
||||
<ul>
|
||||
<li>Se establece un limite para el reciclado del tiempo de conexión a la base de datos que contenga QueueLog. Esto evita problemas en bases de datos como MySQL que finaliza o da timeout a las conexiones.</li>
|
||||
<li>Ahora la py-asterisk va dentro del archivo requirements.txt y no como submodulo del proyecto.</li>
|
||||
<li>Se remueven la mayoría de las libs externas para Javascript y CSS para manejarlos desde ahora con <a href="https://bower.io/">Bower</a>.</li>
|
||||
<li>Se incluye un script para WSGI que permite su utilización con Apache.</li>
|
||||
<li>Actualización para los idiomas Ruso y Portugues.</li>
|
||||
</ul>
|
||||
<p>Si deseas colaborar con el proyecto puedes agregar nuevas sugerencias mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a> ó colaborar mediante <a href="https://github.com/roramirez/qpanel/blob/dd42cf0f534408505f57b0d387dffee2f3688711/README.md#how-to-contribute">mediante un Pull Request.</a></p>
|
||||
<p>Ahora si necesitas <a href="https://boxtub.com/qpanel/">soporte comercial para instalaciones, personalizaciones o nuevas características lo puedes solicitar en https://boxtub.com/qpanel/</a></p>
|
||||
<p> </p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-13-0/">QPanel 0.13.0</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-0-13-0/feed/</wfw:commentRss>
|
||||
<slash:comments>3</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Problema VirtualBox “starting virtual machine” …</title>
|
||||
<link>https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/</link>
|
||||
<comments>https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/#respond</comments>
|
||||
<pubDate>Sat, 10 Sep 2016 22:50:13 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
<category><![CDATA[no arranca]]></category>
|
||||
<category><![CDATA[Problema]]></category>
|
||||
<category><![CDATA[VirtualBox]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1284</guid>
|
||||
<description><![CDATA[<p>Después de una actualización de Debian, de la rama stretch/sid, tuve un problema con VirtualBox. La versión que se actualizó fue a la virtualbox 5.1.4-dfsg-1+b1. El gran problema era que ninguna maquina virtual quería arrancar, se quedaba en un largo limbo con el mensaje “starting virtual machine”, como el de la imagen de a continuación. […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/">Problema VirtualBox “starting virtual machine” …</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Después de una actualización de Debian, de la rama stretch/sid, tuve un problema con VirtualBox. La versión que se actualizó fue a la virtualbox 5.1.4-dfsg-1+b1. El gran problema era que ninguna maquina virtual quería arrancar, se quedaba en un largo limbo con el mensaje “starting virtual machine”, como el de la imagen de a continuación.</p>
|
||||
<p><a href="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-10-19-25-09.png"><img class="aligncenter wp-image-1290 size-full" src="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-10-19-25-09.png" alt="Starting virtual machine ... VirtualBox" width="648" height="554" srcset="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-10-19-25-09.png 648w, https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-10-19-25-09-300x256.png 300w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
|
||||
<p>Ninguna, pero ninguna maquina arrancó, se quedaban en ese mensaje. Fue de esos instantes en que sudas helado … <img src="https://s.w.org/images/core/emoji/2.2.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
|
||||
<p>Con un poco de investigación fue a parar al archivo<em> ~/.VirtualBox/VBoxSVC.log </em>que indicaba</p>
|
||||
<pre>$ tail -f ~/.VirtualBox/VBoxSVC.log
|
||||
00:08:32.932717 nspr-7 Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE
|
||||
00:08:33.555836 nspr-6 Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE</pre>
|
||||
<p> </p>
|
||||
<p>Fui… algo de donde agarrarse. Mirando un poco mas se trataba de problemas con los permisos al vboxdrvu, mirando indicaba que tenía 0600.</p>
|
||||
<p> </p>
|
||||
<pre>$ ls -lh /dev/vboxdrvu
|
||||
crw------- 1 root root 10, 56 Sep 10 12:47 /dev/vboxdrvu</pre>
|
||||
<p> </p>
|
||||
<p>El tema es que deben estar en 0666, le cambias los permisos y eso soluciona el problema <img src="https://s.w.org/images/core/emoji/2.2.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
|
||||
<pre>
|
||||
$ sudo chmod 0666 /dev/vboxdrvu
|
||||
$ ls -lh /dev/vboxdrvu
|
||||
crw-rw-rw- 1 root root 10, 56 Sep 10 12:47 /dev/vboxdrvu</pre>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/">Problema VirtualBox “starting virtual machine” …</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Mejorando la consola interactiva de Python</title>
|
||||
<link>https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/</link>
|
||||
<comments>https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/#comments</comments>
|
||||
<pubDate>Tue, 06 Sep 2016 04:24:43 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[desarrollo]]></category>
|
||||
<category><![CDATA[Desarrollo]]></category>
|
||||
<category><![CDATA[Python]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1247</guid>
|
||||
<description><![CDATA[<p>Cuando estás desarrollando en Python es muy cool estar utilizando la consola interactiva para ir probando cosas antes de ponerlas dentro del archivo de código fuente. La consola de Python funciona y cumple su cometido. Solo al tipear python te permite entrar en modo interactivo e ir probando cosas. El punto es que a veces […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/">Mejorando la consola interactiva de Python</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Cuando estás desarrollando en Python es muy <em>cool</em> estar utilizando la consola interactiva para ir probando cosas antes de ponerlas dentro del archivo de código fuente.</p>
|
||||
<p>La consola de Python funciona y cumple su cometido. Solo al tipear <em>python </em>te permite entrar en modo interactivo e ir probando cosas.</p>
|
||||
<p>El punto es que a veces uno necesita ir un poco más allá. Como autocomentado de código o resaltado de sintaxis, para eso tengo dos truco que utilizo generalmente.</p>
|
||||
<h2>Truco a)</h2>
|
||||
<p>Este permite añadirle algunos esteriodes a la consolta, en realidad uno, el autocompletado. Esto es de gran ayuda para ir conociendo los metodo que puede tener un objecto, funciones u operaciones.</p>
|
||||
<p>Para esto se ocupo <em>rlcompleter</em> y <em>readline. </em></p>
|
||||
<p> </p>
|
||||
<p>Lo que hace que hacer luego de tipear python es agregar lo siguiente dentro de la consola interativa</p>
|
||||
<p><em>import rlcompleter, readline</em><br />
|
||||
<em>readline.parse_and_bind(‘tab:complete’)</em></p>
|
||||
<p>Ya con esto te permite autocomentar código <img src="https://s.w.org/images/core/emoji/2.2.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
|
||||
<p><a href="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-03-01-14-32.png"><img class="aligncenter wp-image-1279 size-full" src="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-03-01-14-32.png" width="689" height="421" srcset="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-03-01-14-32.png 689w, https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-03-01-14-32-300x183.png 300w" sizes="(max-width: 689px) 100vw, 689px" /></a></p>
|
||||
<p> </p>
|
||||
<h2>Truco b)</h2>
|
||||
<p>Esto es mejorar un poco más. Es utilizar embed de <a href="https://ipython.org/">IPython,</a> ya en la consola digita (copias o pegas) lo siguiente</p>
|
||||
<p><em>from IPython import embed</em><br />
|
||||
<em>embed()</em></p>
|
||||
<p>Y el resultado será lo que se ve a continuación… bueno, no?</p>
|
||||
<p> </p>
|
||||
<p><a href="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-07-25-15-48-39.png"><img class="aligncenter wp-image-1262 size-full" src="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-07-25-15-48-39.png" width="743" height="293" srcset="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-07-25-15-48-39.png 743w, https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-07-25-15-48-39-300x118.png 300w" sizes="(max-width: 743px) 100vw, 743px" /></a></p>
|
||||
<p> </p>
|
||||
<p>Si no quieres estar escribiendo cada vez que entras, agregas estas instrucciones en tu archivo <em>~/.pythonrc.py </em> y lo hará cada vez que entras en el modo interactivo de la consola de Python. Lo que si, tu archivo pythonrc.py debe estar seteado en variable de entorno PYTHONSTARTUP</p>
|
||||
<p>ejemplo</p>
|
||||
<p><em>export PYTHONSTARTUP=~/.pythonrc.py</em></p>
|
||||
<p>O lo agregas a un bashrc, zshrc o la shell que ocupes.</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/">Mejorando la consola interactiva de Python</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/feed/</wfw:commentRss>
|
||||
<slash:comments>4</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>QPanel 0.12.0 con estadísticas</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/#respond</comments>
|
||||
<pubDate>Mon, 22 Aug 2016 04:19:03 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Software]]></category>
|
||||
<category><![CDATA[app_queue]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[FreeSWITCH]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queue]]></category>
|
||||
<category><![CDATA[spy]]></category>
|
||||
<category><![CDATA[supervision]]></category>
|
||||
<category><![CDATA[templates]]></category>
|
||||
<category><![CDATA[whisper]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1268</guid>
|
||||
<description><![CDATA[<p>Ya está disponible una nueva versión de QPanel, esta es la 0.12.0 Para instalar esta nueva versión, debes visitar la siguiente URL https://github.com/roramirez/qpanel/tree/0.12.0 En esta nueva versión las funcionalidades agregadas son: Permite remover los agentes de las cola Posibilidad de cancelar llamadas que están en espera de atención Estadísticas por rango de fecha obtenidas desde […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/">QPanel 0.12.0 con estadísticas</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="aligncenter" src="https://raw.githubusercontent.com/roramirez/qpanel/e55aa16bbd85b579ee82e56469526270c5afa462/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="685" height="385" />Ya está disponible una nueva versión de QPanel, esta es la 0.12.0</p>
|
||||
<p>Para instalar esta nueva versión, debes visitar la siguiente URL</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.12.0">https://github.com/roramirez/qpanel/tree/0.12.0</a></li>
|
||||
</ul>
|
||||
<p>En esta nueva versión las funcionalidades agregadas son:</p>
|
||||
<ul>
|
||||
<li>Permite remover los agentes de las cola</li>
|
||||
<li>Posibilidad de cancelar llamadas que están en espera de atención</li>
|
||||
<li>Estadísticas por rango de fecha obtenidas desde el queue_log de Asterisk</li>
|
||||
<li>Se actualiza a Flask 0.11</li>
|
||||
</ul>
|
||||
<p>Si deseas colaborar con el proyecto puedes agregar nuevas sugerencias mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a> ó colaborar mediante <a href="https://github.com/roramirez/qpanel/blob/dd42cf0f534408505f57b0d387dffee2f3688711/README.md#how-to-contribute">mediante un Pull Request</a></p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/">QPanel 0.12.0 con estadísticas</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>QPanel 0.11.0 con Spy, Whisper y mas</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-spy-supervisor/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-spy-supervisor/#comments</comments>
|
||||
<pubDate>Thu, 21 Jul 2016 01:53:21 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Software]]></category>
|
||||
<category><![CDATA[app_queue]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[FreeSWITCH]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queue]]></category>
|
||||
<category><![CDATA[spy]]></category>
|
||||
<category><![CDATA[supervision]]></category>
|
||||
<category><![CDATA[templates]]></category>
|
||||
<category><![CDATA[whisper]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1245</guid>
|
||||
<description><![CDATA[<p>Ya está disponible una nueva versión de QPanel, esta es la 0.11.0 Para instalar esta nueva versión, debes visitar la siguiente URL https://github.com/roramirez/qpanel/tree/0.11.0 Esta versión hemos agregado algunas funcionalidades que los usuarios han ido solicitando. Para esta versión es posible realizar Spy, Whisper o Barge a un canal para la supervisión de los miembros que […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-spy-supervisor/">QPanel 0.11.0 con Spy, Whisper y mas</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="aligncenter" src="https://raw.githubusercontent.com/roramirez/qpanel/e55aa16bbd85b579ee82e56469526270c5afa462/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="685" height="385" />Ya está disponible una nueva versión de QPanel, esta es la 0.11.0</p>
|
||||
<p>Para instalar esta nueva versión, debes visitar la siguiente URL</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.11.0">https://github.com/roramirez/qpanel/tree/0.11.0</a></li>
|
||||
</ul>
|
||||
<p>Esta versión hemos agregado algunas funcionalidades que los usuarios han ido solicitando.</p>
|
||||
<p>Para esta versión es posible realizar Spy, Whisper o Barge a un canal para la supervisión de los miembros que están en una cola.</p>
|
||||
<p>También el sistema de plantillas se hecho una refactorización para eliminar exceso de codigo HTML usando uno de base.</p>
|
||||
<p>Se han agregado una suite de tests unitarios que al contar del avance del proyecto deberían ir incrementando.</p>
|
||||
<p>Se ha solucionado un bug con la actualización del color del estado del agente cuando es uno nuevo agregado a la cola.</p>
|
||||
<p> </p>
|
||||
<p>El proyecto siempre está abierto a nuevas sugerencias las cuales puedes agregar mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a>.</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-spy-supervisor/">QPanel 0.11.0 con Spy, Whisper y mas</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-spy-supervisor/feed/</wfw:commentRss>
|
||||
<slash:comments>4</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Añadir Swap a un sistema</title>
|
||||
<link>https://rodrigoramirez.com/crear-swap/</link>
|
||||
<comments>https://rodrigoramirez.com/crear-swap/#respond</comments>
|
||||
<pubDate>Fri, 15 Jul 2016 05:07:43 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1234</guid>
|
||||
<description><![CDATA[<p>Algo que me toma generalmente hacer es cuando trabajo con maquina virtuales es asignar una cantidad determinada de Swap. La memoria swap es un espacio de intercambio en disco para cuando el sistema ya no puede utilizar más memoria RAM. El problema para mi es que algunos sistemas de maquinas virtuales no asignan por defecto […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/crear-swap/">Añadir Swap a un sistema</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Algo que me toma generalmente hacer es cuando trabajo con maquina virtuales es asignar una cantidad determinada de Swap.</p>
|
||||
<p>La memoria swap es un espacio de intercambio en disco para cuando el sistema ya no puede utilizar más memoria RAM.</p>
|
||||
<p>El problema para mi es que algunos sistemas de maquinas virtuales no asignan por defecto un espacio para la Swap, lo que te lleva a que el sistema pueda tener crash durante la ejecución.</p>
|
||||
<p>Para comprobar la asignación de memoria, al ejecutar el comando <em>free</em> nos debería mostrar como algo similar a lo siguiente</p>
|
||||
<p> </p>
|
||||
<pre>$ free -m
|
||||
total used free shared buffers cached
|
||||
Mem: 494 488 6 1 54 75
|
||||
-/+ buffers/cache: 357 136
|
||||
Swap: 0 0 0</pre>
|
||||
<p>En la zona de swap indica que no asignada, valor 0.</p>
|
||||
<p>Para asignar swap al sistema se debe un archivo en disco para que sea utilizado como espacio de intercambio, en este caso lo vamos crear uno de 3GB en la raíz del sistema</p>
|
||||
<pre class="code-pre "><code>fallocate -l 3G /swapfile</code></pre>
|
||||
<p>Comprobamos que ha sido creado</p>
|
||||
<pre>$ ls -lh /swapfile
|
||||
-rw-r--r-- 1 root root 3.0G Jul 11 13:10 /swapfile
|
||||
</pre>
|
||||
<h3>Habilitación del archivo Swap</h3>
|
||||
<p>Ahora nos toca habilitar el archivo creado. Para eso le asignaremos los permisos</p>
|
||||
<pre>chmod 600 /swapfile</pre>
|
||||
<p>Lo siguiente es para convertir el archivo para swap</p>
|
||||
<pre>mkswap /swapfile</pre>
|
||||
<p>Para habilitar y asignarla eso como memoria swap al sistema usamos</p>
|
||||
<pre>swapon /swapfile</pre>
|
||||
<p>Ya con esto podrémos ver en nuestro sistema la memoria asignada para swap</p>
|
||||
<pre>$ free -m
|
||||
total used free shared buffers cached
|
||||
Mem: 494 486 7 1 51 77
|
||||
-/+ buffers/cache: 358 136
|
||||
Swap: 3071 0 3071</pre>
|
||||
<p> </p>
|
||||
<p>Para que al reiniciar el sistema esto se mantenga, debemos agregar la siguiente línea al archivo /etc/fstab</p>
|
||||
<pre><span class="pl-s">/swapfile none swap sw 0 0</span></pre>
|
||||
<p> </p>
|
||||
<p>Podemos editar /etc/fstab con algún editor como vim, nano o podemos agregar la linea directamente en la desde la cli de la siguiente manera</p>
|
||||
<pre><span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span>/swapfile none swap sw 0 0<span class="pl-pds">"</span></span> <span class="pl-k">>></span> /etc/fstab</pre>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/crear-swap/">Añadir Swap a un sistema</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/crear-swap/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>QPanel 0.10.0 con vista consolidada</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/#respond</comments>
|
||||
<pubDate>Mon, 20 Jun 2016 19:32:55 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
<category><![CDATA[app_queue]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[FreeSWITCH]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queue]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1227</guid>
|
||||
<description><![CDATA[<p>Ya con la release numero 28 la nueva versión 0.10.0 de QPanel ya está disponible. Para instalar esta nueva versión, debes visitar la siguiente URL https://github.com/roramirez/qpanel/tree/0.10.0 Esta versión versión nos preocupamos de realizar mejoras, refactorizaciones y agregamos una nueva funcionalidad. La nueva funcionalidad incluida es que ahora es posible contar con una vista consolidada para […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/">QPanel 0.10.0 con vista consolidada</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="alignleft" src="https://raw.githubusercontent.com/roramirez/qpanel/0.10.0/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="403" height="227" />Ya con la release numero 28 la nueva versión 0.10.0 de QPanel ya está disponible.</p>
|
||||
<p>Para instalar esta nueva versión, debes visitar la siguiente URL</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.10.0">https://github.com/roramirez/qpanel/tree/0.10.0</a></li>
|
||||
</ul>
|
||||
<p>Esta versión versión nos preocupamos de realizar mejoras, refactorizaciones y agregamos una nueva funcionalidad.</p>
|
||||
<p>La nueva funcionalidad incluida es que ahora es posible contar con una vista consolidada para la información de todas las colas. Que hace tener un mejor control y visualización de lo que está pasando en las colas.</p>
|
||||
<p>El proyecto siempre está abierto a nuevas sugerencias las cuales puedes agregar mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a>.</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/">QPanel 0.10.0 con vista consolidada</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Nerdearla 2016, WebRTC Glue</title>
|
||||
<link>https://rodrigoramirez.com/nerdearla-2016/</link>
|
||||
<comments>https://rodrigoramirez.com/nerdearla-2016/#respond</comments>
|
||||
<pubDate>Wed, 15 Jun 2016 17:55:41 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
<category><![CDATA[baires]]></category>
|
||||
<category><![CDATA[charla]]></category>
|
||||
<category><![CDATA[Computación]]></category>
|
||||
<category><![CDATA[informatica]]></category>
|
||||
<category><![CDATA[tech]]></category>
|
||||
<category><![CDATA[ti]]></category>
|
||||
<category><![CDATA[webrtc]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1218</guid>
|
||||
<description><![CDATA[<p>Días atrás estuve participando en el evento llamado Nerdearla en Buenos Aires. El ambiente era genial si eres de esas personas que desde niño sintio curiosidad por ver como funcionan las cosas, donde desarmabas para volver armar lo juguetes. Habían muchas cosas interesantes tanto en las presentaciones, co-working y workshop que se hubieron. Si te […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/nerdearla-2016/">Nerdearla 2016, WebRTC Glue</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Días atrás estuve participando en el evento llamado <a href="http://nerdear.la/">Nerdearla</a> en Buenos Aires. El ambiente era genial si eres de esas personas que desde niño sintio curiosidad por ver como funcionan las cosas, donde desarmabas para volver armar lo juguetes.</p>
|
||||
<p>Habían muchas cosas interesantes tanto en las presentaciones, co-working y workshop que se hubieron. Si te lo perdiste te recomiendo que estés pendiente para el proximo año.</p>
|
||||
<p> </p>
|
||||
<p>Te podias encontrar con una nuestra como esta<a href="https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS.jpg"><img class="aligncenter size-medium wp-image-1221" src="https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS-300x169.jpg" alt="Kaypro II" width="300" height="169" srcset="https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS-300x169.jpg 300w, https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS-768x432.jpg 768w, https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS-1024x576.jpg 1024w, https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
|
||||
<p>Puedes dar un vistaso a lo registrado por algunos <a href="https://twitter.com/hashtag/nerdearla?f=tweets&vertical=default&src=hash">usuarios en Twitter</a></p>
|
||||
<p>El primer día hice un workshop denominado WebRTC Glue, donde muestra como hacer como unificar la experiencia de atención del centro de contacto directamente en la web. Es una presentación práctica donde puedes ver los ejemplos y usarlos como gustes. Están en <a href="https://gitlab.com/roramirez/webrtc-glue">el repositorio en Gitlab</a>. La presentación <a href="/charlas/webrtc-glue/index.html">la puedes ver aquí</a></p>
|
||||
<p> </p>
|
||||
<p><a href="https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW.jpg"><img class="aligncenter size-medium wp-image-1222" src="https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW-300x169.jpg" alt="WebRTC Glue" width="300" height="169" srcset="https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW-300x169.jpg 300w, https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW-768x432.jpg 768w, https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW-1024x576.jpg 1024w, https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
|
||||
<p>Haber si nos vemos el próximo año.</p>
|
||||
<p> </p>
|
||||
<p><strong>Update</strong>: Puedes ver una parte sin la demostración del workshop</p>
|
||||
<p><iframe src="https://www.youtube.com/embed/qDreeYk-UK4?list=PLTTdzfRyGY1vQukK8L4QeAfYdbURSzFq5" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe><br />
|
||||
</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/nerdearla-2016/">Nerdearla 2016, WebRTC Glue</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/nerdearla-2016/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>QPanel 0.9.0</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-0-9-0/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-0-9-0/#respond</comments>
|
||||
<pubDate>Mon, 09 May 2016 18:40:23 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Software]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[callcenter]]></category>
|
||||
<category><![CDATA[colas]]></category>
|
||||
<category><![CDATA[monitor]]></category>
|
||||
<category><![CDATA[monitoreo]]></category>
|
||||
<category><![CDATA[panel]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queues]]></category>
|
||||
|
||||
<guid isPermaLink="false">http://rodrigoramirez.com/?p=1206</guid>
|
||||
<description><![CDATA[<p>El Panel monitor callcenter para colas de Asterisk ya cuenta con una nueva versión, la 0.9.0 Para instalar esta nueva versión, debes visitar la siguiente URL https://github.com/roramirez/qpanel/tree/0.9.0 Esta versión versión nos preocupamos de realizar mejoras y refactorizaciones en el codigo para dar un mejor rendimiento, como también de la compatibilidad con la versión 11 de […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-9-0/">QPanel 0.9.0</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="alignleft" src="https://raw.githubusercontent.com/roramirez/qpanel/0.9.0/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="403" height="227" />El Panel monitor callcenter para colas de Asterisk ya cuenta con una nueva versión, la 0.9.0</p>
|
||||
<p>Para instalar esta nueva versión, debes visitar la siguiente URL</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.9.0">https://github.com/roramirez/qpanel/tree/0.9.0</a></li>
|
||||
</ul>
|
||||
<p>Esta versión versión nos preocupamos de realizar mejoras y refactorizaciones en el codigo para dar un mejor rendimiento, como también de la compatibilidad con la versión 11 de Asterisk.</p>
|
||||
<p>Dentro de las cosas que podamos mencionar:</p>
|
||||
<ul>
|
||||
<li> Actualización del repositorio y versión de py-asterisk, biblioteca para trabajar con Asterisk. Acá la ocupamos principalmente para uso del Manager.</li>
|
||||
<li>Portación de parche de funcionalidades como pausa, tiempo, razón de una pausa para Asterisk 11.</li>
|
||||
<li>Cambio del comportamiento en el conteo cuando el participante en una cola está ocupado (busy)</li>
|
||||
</ul>
|
||||
<p>El proyecto siempre está abierto a nuevas sugerencias las cuales puedes agregar mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a>.</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-9-0/">QPanel 0.9.0</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-0-9-0/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Mandar un email desde la shell</title>
|
||||
<link>https://rodrigoramirez.com/mandar-un-email-desde-la-shell/</link>
|
||||
<comments>https://rodrigoramirez.com/mandar-un-email-desde-la-shell/#comments</comments>
|
||||
<pubDate>Wed, 13 Apr 2016 13:05:13 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
<category><![CDATA[mini-tips]]></category>
|
||||
<category><![CDATA[bash]]></category>
|
||||
<category><![CDATA[cli]]></category>
|
||||
<category><![CDATA[Email]]></category>
|
||||
<category><![CDATA[mail]]></category>
|
||||
<category><![CDATA[sh]]></category>
|
||||
<category><![CDATA[shell]]></category>
|
||||
|
||||
<guid isPermaLink="false">http://rodrigoramirez.com/?p=1172</guid>
|
||||
<description><![CDATA[<p>Dejo esto por acá ya que es algo que siempre me olvido como es. El tema es enviar un email mediante el comando mail en un servidor con Linux. Si usas mail a secas te va pidiendo los datos para crear el correo, principalmente el body del correo. Para automatizar esto a través de un […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/mandar-un-email-desde-la-shell/">Mandar un email desde la shell</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Dejo esto por acá ya que es algo que siempre me olvido como es. El tema es enviar un email mediante el comando <em>mail</em> en un servidor con Linux.</p>
|
||||
<p>Si usas mail a secas te va pidiendo los datos para crear el correo, principalmente el body del correo. Para automatizar esto a través de un <em>echo</em> le pasas por pipe a <em>mail</em></p>
|
||||
<pre>echo "Cuerpo del mensaje" | mail -s Asunto a@rodrigoramirez.com</pre>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/mandar-un-email-desde-la-shell/">Mandar un email desde la shell</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/mandar-un-email-desde-la-shell/feed/</wfw:commentRss>
|
||||
<slash:comments>4</slash:comments>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
32
tests/configs/modules/clock/clock_showWeek.js
Normal file
32
tests/configs/modules/clock/clock_showWeek.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Magic Mirror Test config for default clock module
|
||||
*
|
||||
* By Johan Hammar
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "clock",
|
||||
position: "middle_center",
|
||||
config: {
|
||||
showWeek: true
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
38
tests/configs/modules/clock/es/clock_showWeek.js
Normal file
38
tests/configs/modules/clock/es/clock_showWeek.js
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
/* Magic Mirror
|
||||
*
|
||||
* Test config for default clock module
|
||||
* Language es for showWeek feature
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena
|
||||
* https://rodrigoramirez.com
|
||||
*
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||
|
||||
language: "es",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "clock",
|
||||
position: "middle_center",
|
||||
config: {
|
||||
showWeek: true
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
@@ -1,4 +1,4 @@
|
||||
/* Magic Mirror Test config for default compliments
|
||||
/* Magic Mirror Test config for default compliments
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
|
38
tests/configs/modules/newsfeed/default.js
Normal file
38
tests/configs/modules/newsfeed/default.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/* Magic Mirror Test config newsfeed module
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
|
||||
module: "newsfeed",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
feeds: [
|
||||
{
|
||||
title: "Rodrigo Ramirez Blog",
|
||||
url: "http://localhost:8080/tests/configs/data/feed_test_rodrigoramirez.xml"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
43
tests/configs/modules/positions.js
Normal file
43
tests/configs/modules/positions.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Magic Mirror Test config for position setters module
|
||||
*
|
||||
* For this case is using helloworld module
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||
ipWhitelist: [],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 24,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
modules:
|
||||
// Using exotic content. This is why dont accept go to JSON configuration file
|
||||
(function() {
|
||||
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
|
||||
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
|
||||
"bottom_bar", "fullscreen_above", "fullscreen_below"];
|
||||
var modules = Array();
|
||||
for (idx in positions) {
|
||||
modules.push({
|
||||
module: "helloworld",
|
||||
position: positions[idx],
|
||||
config: {
|
||||
text: "Text in " + positions[idx]
|
||||
}
|
||||
});
|
||||
}
|
||||
return modules;
|
||||
})(),
|
||||
};
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
25
tests/configs/port_8090.js
Normal file
25
tests/configs/port_8090.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Magic Mirror Test config sample enviroment set por 8090
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8090,
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 24,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
@@ -1,50 +1,65 @@
|
||||
const Application = require("spectron").Application;
|
||||
const helpers = require("./global-setup");
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
const request = require("request");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
|
||||
const expect = require("chai").expect;
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
var appPath = path.join(__dirname, "../../js/electron.js");
|
||||
describe("Development console tests", function() {
|
||||
// This tests fail and crash another tests
|
||||
// Suspect problem with window focus
|
||||
// FIXME
|
||||
return false;
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath
|
||||
});
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
|
||||
describe("Argument 'dev'", function () {
|
||||
this.timeout(20000);
|
||||
var app = null;
|
||||
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
describe("Without 'dev' commandline argument", function() {
|
||||
before(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
it("should not open dev console when absent", function () {
|
||||
app.args = [appPath];
|
||||
after(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
return app.start().then(function() {
|
||||
it("should not open dev console when absent", function() {
|
||||
return expect(app.browserWindow.isDevToolsOpened()).to.eventually.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
it("should open dev console when provided", function () {
|
||||
app.args = [appPath, "dev"];
|
||||
describe("With 'dev' commandline argument", function() {
|
||||
before(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js", "dev"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
return app.start().then(function() {
|
||||
after(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
it("should open dev console when provided", function() {
|
||||
return expect(app.browserWindow.isDevToolsOpened()).to.eventually.equal(true);
|
||||
});
|
||||
});
|
||||
|
@@ -1,40 +1,69 @@
|
||||
const globalSetup = require("./global-setup");
|
||||
const app = globalSetup.app;
|
||||
const helpers = require("./global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
describe("Electron app environment", function () {
|
||||
this.timeout(20000);
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Electron app environment", function() {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
beforeEach(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
afterEach(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
it("is set to open new app window", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getWindowCount().should.eventually.equal(1);
|
||||
it("should open a browserwindow", function() {
|
||||
return app.client
|
||||
.waitUntilWindowLoaded()
|
||||
.browserWindow.focus()
|
||||
.getWindowCount()
|
||||
.should.eventually.equal(1)
|
||||
.browserWindow.isMinimized()
|
||||
.should.eventually.be.false.browserWindow.isDevToolsOpened()
|
||||
.should.eventually.be.false.browserWindow.isVisible()
|
||||
.should.eventually.be.true.browserWindow.isFocused()
|
||||
.should.eventually.be.true.browserWindow.getBounds()
|
||||
.should.eventually.have.property("width")
|
||||
.and.be.above(0)
|
||||
.browserWindow.getBounds()
|
||||
.should.eventually.have.property("height")
|
||||
.and.be.above(0)
|
||||
.browserWindow.getTitle()
|
||||
.should.eventually.equal("MagicMirror²");
|
||||
});
|
||||
|
||||
it("sets correct window title", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getTitle().should.eventually.equal("Magic Mirror");
|
||||
});
|
||||
|
||||
it("get request from http://localhost:8080 should return 200", function (done) {
|
||||
request.get("http://localhost:8080", function (err, res, body) {
|
||||
it("get request from http://localhost:8080 should return 200", function(done) {
|
||||
request.get("http://localhost:8080", function(err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("get request from http://localhost:8080/nothing should return 404", function(done) {
|
||||
request.get("http://localhost:8080/nothing", function(err, res, body) {
|
||||
expect(res.statusCode).to.equal(404);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -9,26 +9,54 @@
|
||||
*/
|
||||
|
||||
const Application = require("spectron").Application;
|
||||
const path = require("path");
|
||||
const assert = require("assert");
|
||||
const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
|
||||
const path = require("path");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
global.before(function() {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
|
||||
exports.app = app;
|
||||
exports.getElectronPath = function() {
|
||||
var electronPath = path.join(__dirname, "..", "..", "node_modules", ".bin", "electron");
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
return electronPath;
|
||||
};
|
||||
|
||||
// Set timeout - if this is run within Travis, increase timeout
|
||||
exports.setupTimeout = function(test) {
|
||||
if (process.env.CI) {
|
||||
test.timeout(30000);
|
||||
} else {
|
||||
test.timeout(10000);
|
||||
}
|
||||
};
|
||||
|
||||
exports.startApplication = function(options) {
|
||||
options.path = exports.getElectronPath();
|
||||
if (process.env.CI) {
|
||||
options.startTimeout = 30000;
|
||||
}
|
||||
|
||||
var app = new Application(options);
|
||||
return app.start().then(function() {
|
||||
assert.equal(app.isRunning(), true);
|
||||
chaiAsPromised.transferPromiseness = app.transferPromiseness;
|
||||
return app;
|
||||
});
|
||||
};
|
||||
|
||||
exports.stopApplication = function(app) {
|
||||
if (!app || !app.isRunning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
return app.stop().then(function() {
|
||||
assert.equal(app.isRunning(), false);
|
||||
});
|
||||
};
|
||||
|
@@ -1,24 +1,31 @@
|
||||
const globalSetup = require("./global-setup");
|
||||
const app = globalSetup.app;
|
||||
const helpers = require("./global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("ipWhitelist directive configuration", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
this.timeout(20000);
|
||||
var app = null;
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
beforeEach(function () {
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; })
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Set ipWhitelist without access", function () {
|
||||
before(function() {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
||||
});
|
||||
@@ -31,7 +38,7 @@ describe("ipWhitelist directive configuration", function () {
|
||||
});
|
||||
|
||||
describe("Set ipWhitelist []", function () {
|
||||
before(function() {
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
|
||||
});
|
||||
|
@@ -1,19 +1,32 @@
|
||||
const globalSetup = require("../global-setup");
|
||||
const serverBasicAuth = require("../../servers/basic-auth.js");
|
||||
const app = globalSetup.app;
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
const helpers = require("../global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
const serverBasicAuth = require("../../servers/basic-auth.js");
|
||||
|
||||
describe("Calendar module", function () {
|
||||
const expect = require("chai").expect;
|
||||
|
||||
this.timeout(20000);
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
describe("Calendar module", function() {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
afterEach(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Default configuration", function() {
|
||||
@@ -22,12 +35,11 @@ describe("Calendar module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function () {
|
||||
it("Should return TestEvents", function() {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("Basic auth", function() {
|
||||
before(function() {
|
||||
serverBasicAuth.listen(8010);
|
||||
@@ -35,12 +47,15 @@ describe("Calendar module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function () {
|
||||
after(function(done) {
|
||||
serverBasicAuth.close(done());
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function() {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("Basic auth by default", function() {
|
||||
before(function() {
|
||||
serverBasicAuth.listen(8011);
|
||||
@@ -48,19 +63,27 @@ describe("Calendar module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function () {
|
||||
after(function(done) {
|
||||
serverBasicAuth.close(done());
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function() {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Basic auth backward compatibilty configuration", function() {
|
||||
describe("Basic auth backward compatibilty configuration: DEPRECATED", function() {
|
||||
before(function() {
|
||||
serverBasicAuth.listen(8012);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function () {
|
||||
after(function(done) {
|
||||
serverBasicAuth.close(done());
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function() {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
@@ -72,10 +95,12 @@ describe("Calendar module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/fail-basic-auth.js";
|
||||
});
|
||||
|
||||
it("Should return No upcoming events", function () {
|
||||
after(function(done) {
|
||||
serverBasicAuth.close(done());
|
||||
});
|
||||
|
||||
it("Should return No upcoming events", function() {
|
||||
return app.client.waitUntilTextExists(".calendar", "No upcoming events.", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
@@ -1,8 +1,32 @@
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
const helpers = require("../global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
|
||||
describe("Clock set to spanish language module", function () {
|
||||
this.timeout(20000);
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Clock set to spanish language module", function() {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("with default 24hr clock config", function() {
|
||||
before(function() {
|
||||
@@ -10,24 +34,14 @@ describe("Clock set to spanish language module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_24hr.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("shows date with correct format", function () {
|
||||
it("shows date with correct format", function() {
|
||||
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .date").should.eventually.match(dateRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
|
||||
});
|
||||
|
||||
it("shows time in 24hr format", function() {
|
||||
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .time").should.eventually.match(timeRegex);
|
||||
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,24 +51,14 @@ describe("Clock set to spanish language module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_12hr.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("shows date with correct format", function () {
|
||||
it("shows date with correct format", function() {
|
||||
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .date").should.eventually.match(dateRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
|
||||
});
|
||||
|
||||
it("shows time in 12hr format", function() {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .time").should.eventually.match(timeRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -64,18 +68,23 @@ describe("Clock set to spanish language module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showPeriodUpper.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("shows 12hr time with upper case AM/PM", function() {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .time").should.eventually.match(timeRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showWeek config enabled", function() {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showWeek.js";
|
||||
});
|
||||
|
||||
it("shows week with correct format", function() {
|
||||
const weekRegex = /^Semana [0-9]{1,2}$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .week").should.eventually.match(weekRegex);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -1,8 +1,32 @@
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
const helpers = require("../global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
|
||||
describe("Clock module", function () {
|
||||
this.timeout(20000);
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Clock module", function() {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("with default 24hr clock config", function() {
|
||||
before(function() {
|
||||
@@ -10,24 +34,14 @@ describe("Clock module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_24hr.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("shows date with correct format", function () {
|
||||
it("shows date with correct format", function() {
|
||||
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .date").should.eventually.match(dateRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
|
||||
});
|
||||
|
||||
it("shows time in 24hr format", function() {
|
||||
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .time").should.eventually.match(timeRegex);
|
||||
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,24 +51,14 @@ describe("Clock module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_12hr.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("shows date with correct format", function () {
|
||||
it("shows date with correct format", function() {
|
||||
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .date").should.eventually.match(dateRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
|
||||
});
|
||||
|
||||
it("shows time in 12hr format", function() {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .time").should.eventually.match(timeRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -64,18 +68,9 @@ describe("Clock module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showPeriodUpper.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("shows 12hr time with upper case AM/PM", function() {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .time").should.eventually.match(timeRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -85,19 +80,29 @@ describe("Clock module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_displaySeconds_false.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("shows 12hr time without seconds am/pm", function() {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[ap]m$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .time").should.eventually.match(timeRegex);
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showWeek config enabled", function() {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showWeek.js";
|
||||
});
|
||||
|
||||
it("shows week with correct format", function() {
|
||||
const weekRegex = /^Week [0-9]{1,2}$/;
|
||||
return app.client.waitUntilWindowLoaded().getText(".clock .week").should.eventually.match(weekRegex);
|
||||
});
|
||||
|
||||
it("shows week with correct number of week of year", function() {
|
||||
it("FIXME: if the day is a sunday this not match");
|
||||
// const currentWeekNumber = require("current-week-number")();
|
||||
// const weekToShow = "Week " + currentWeekNumber;
|
||||
// return app.client.waitUntilWindowLoaded()
|
||||
// .getText(".clock .week").should.eventually.equal(weekToShow);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,77 +1,81 @@
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
const helpers = require("../global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
|
||||
describe("Compliments module", function () {
|
||||
this.timeout(20000);
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
describe("Compliments module", function() {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
afterEach(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
|
||||
describe("parts of days", function() {
|
||||
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_parts_day.js";
|
||||
});
|
||||
|
||||
it("if Morning compliments for that part of day", function () {
|
||||
it("if Morning compliments for that part of day", function() {
|
||||
var hour = new Date().getHours();
|
||||
if (hour >= 3 && hour < 12) {
|
||||
// if morning check
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".compliments").then(function (text) {
|
||||
expect(text).to.be.oneOf(["Hi", "Good Morning", "Morning test"]);
|
||||
})
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Hi", "Good Morning", "Morning test"]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("if Afternoon show Compliments for that part of day", function () {
|
||||
it("if Afternoon show Compliments for that part of day", function() {
|
||||
var hour = new Date().getHours();
|
||||
if (hour >= 12 && hour < 17) {
|
||||
// if morning check
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".compliments").then(function (text) {
|
||||
expect(text).to.be.oneOf(["Hello", "Good Afternoon", "Afternoon test"]);
|
||||
})
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Hello", "Good Afternoon", "Afternoon test"]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("if Evening show Compliments for that part of day", function () {
|
||||
it("if Evening show Compliments for that part of day", function() {
|
||||
var hour = new Date().getHours();
|
||||
if (!(hour >= 3 && hour < 12) && !(hour >= 12 && hour < 17)) {
|
||||
// if evening check
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".compliments").then(function (text) {
|
||||
expect(text).to.be.oneOf(["Hello There", "Good Evening", "Evening test"]);
|
||||
})
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Hello There", "Good Evening", "Evening test"]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe("Feature anytime in compliments module", function() {
|
||||
|
||||
describe("Set anytime and empty compliments for morning, evening and afternoon ", function() {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_anytime.js";
|
||||
});
|
||||
|
||||
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".compliments").then(function (text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
})
|
||||
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function() {
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,15 +85,11 @@ describe("Compliments module", function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_only_anytime.js";
|
||||
});
|
||||
|
||||
it("Show anytime compliments", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".compliments").then(function (text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
})
|
||||
it("Show anytime compliments", function() {
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -1,16 +1,32 @@
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
const helpers = require("../global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
|
||||
describe("Test helloworld module", function () {
|
||||
this.timeout(20000);
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
describe("Test helloworld module", function() {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
|
||||
afterEach(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("helloworld set config text", function () {
|
||||
|
40
tests/e2e/modules/newsfeed_spec.js
Normal file
40
tests/e2e/modules/newsfeed_spec.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const helpers = require("../global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Newsfeed module", function() {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function() {
|
||||
return helpers
|
||||
.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
})
|
||||
.then(function(startedApp) {
|
||||
app = startedApp;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Default configuration", function() {
|
||||
before(function() {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/newsfeed/default.js";
|
||||
});
|
||||
|
||||
it("show title newsfeed", function() {
|
||||
return app.client.waitUntilTextExists(".newsfeed .small", "Rodrigo Ramirez Blog", 10000).should.be.fulfilled;
|
||||
});
|
||||
});
|
||||
});
|
50
tests/e2e/modules_position_spec.js
Normal file
50
tests/e2e/modules_position_spec.js
Normal file
@@ -0,0 +1,50 @@
|
||||
const helpers = require("./global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Position of modules", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function () {
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; })
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Using helloworld", function () {
|
||||
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/positions.js";
|
||||
});
|
||||
|
||||
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
|
||||
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
|
||||
"bottom_bar", "fullscreen_above", "fullscreen_below"];
|
||||
|
||||
var position;
|
||||
var className;
|
||||
for (idx in positions) {
|
||||
position = positions[idx];
|
||||
className = position.replace("_", ".");
|
||||
it("show text in " + position, function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText("." + className).should.eventually.equal("Text in " + position);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
60
tests/e2e/port_config.js
Normal file
60
tests/e2e/port_config.js
Normal file
@@ -0,0 +1,60 @@
|
||||
const helpers = require("./global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("port directive configuration", function () {
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
beforeEach(function () {
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; })
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Set port 8090", function () {
|
||||
before(function () {
|
||||
// Set config sample for use in this test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
|
||||
});
|
||||
|
||||
it("should return 200", function (done) {
|
||||
request.get("http://localhost:8090", function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Set port 8100 on enviroment variable MM_PORT", function () {
|
||||
before(function () {
|
||||
process.env.MM_PORT = 8100;
|
||||
// Set config sample for use in this test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
|
||||
});
|
||||
|
||||
after(function () {
|
||||
delete process.env.MM_PORT;
|
||||
});
|
||||
|
||||
it("should return 200", function (done) {
|
||||
request.get("http://localhost:8100", function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
46
tests/e2e/vendor_spec.js
Normal file
46
tests/e2e/vendor_spec.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const helpers = require("./global-setup");
|
||||
const path = require("path");
|
||||
const request = require("request");
|
||||
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const before = global.before;
|
||||
const after = global.after;
|
||||
|
||||
describe("Vendors", function () {
|
||||
|
||||
return; // Test still getting failed in Travis
|
||||
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
var app = null;
|
||||
|
||||
before(function () {
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; })
|
||||
});
|
||||
|
||||
after(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
describe("Get list vendors", function () {
|
||||
|
||||
before(function () {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||
});
|
||||
|
||||
var vendors = require(__dirname + "/../../vendor/vendor.js");
|
||||
Object.keys(vendors).forEach(vendor => {
|
||||
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
||||
urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
||||
request.get(urlVendor, function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,44 +1,34 @@
|
||||
const Application = require("spectron").Application;
|
||||
const helpers = require("./global-setup");
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
const request = require("request");
|
||||
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
const beforeEach = global.beforeEach;
|
||||
const afterEach = global.afterEach;
|
||||
|
||||
describe("Check configuration without modules", function () {
|
||||
this.timeout(20000);
|
||||
helpers.setupTimeout(this);
|
||||
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
var app = null;
|
||||
|
||||
beforeEach(function () {
|
||||
return helpers.startApplication({
|
||||
args: ["js/electron.js"]
|
||||
}).then(function (startedApp) { app = startedApp; })
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
return helpers.stopApplication(app);
|
||||
});
|
||||
|
||||
before(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/without_modules.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("Show the message MagicMirror title", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2")
|
||||
|
@@ -1,16 +1,21 @@
|
||||
var http = require("http");
|
||||
var path = require("path");
|
||||
var auth = require("http-auth");
|
||||
var express = require("express")
|
||||
var express = require("express");
|
||||
var app = express();
|
||||
|
||||
var basic = auth.basic({
|
||||
realm: "MagicMirror Area restricted."
|
||||
}, (username, password, callback) => {
|
||||
callback(username === "MagicMirror" && password === "CallMeADog");
|
||||
});
|
||||
var server;
|
||||
|
||||
this.server = express();
|
||||
this.server.use(auth.connect(basic));
|
||||
var basic = auth.basic(
|
||||
{
|
||||
realm: "MagicMirror Area restricted."
|
||||
},
|
||||
(username, password, callback) => {
|
||||
callback(username === "MagicMirror" && password === "CallMeADog");
|
||||
}
|
||||
);
|
||||
|
||||
app.use(auth.connect(basic));
|
||||
|
||||
// Set directories availables
|
||||
var directories = ["/tests/configs"];
|
||||
@@ -18,13 +23,13 @@ var directory;
|
||||
rootPath = path.resolve(__dirname + "/../../");
|
||||
for (i in directories) {
|
||||
directory = directories[i];
|
||||
this.server.use(directory, express.static(path.resolve(rootPath + directory)));
|
||||
app.use(directory, express.static(path.resolve(rootPath + directory)));
|
||||
}
|
||||
|
||||
exports.listen = function () {
|
||||
this.server.listen.apply(this.server, arguments);
|
||||
exports.listen = function() {
|
||||
server = app.listen.apply(app, arguments);
|
||||
};
|
||||
|
||||
exports.close = function (callback) {
|
||||
this.server.close(callback);
|
||||
exports.close = function(callback) {
|
||||
server.close(callback);
|
||||
};
|
||||
|
128
tests/unit/functions/calendar_spec.js
Normal file
128
tests/unit/functions/calendar_spec.js
Normal file
@@ -0,0 +1,128 @@
|
||||
const expect = require("chai").expect;
|
||||
|
||||
global.moment = require("moment");
|
||||
|
||||
describe("Functions into modules/default/calendar/calendar.js", function() {
|
||||
|
||||
// Fake for use by calendar.js
|
||||
Module = {}
|
||||
Module.definitions = {};
|
||||
Module.register = function (name, moduleDefinition) {
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
||||
before(function() {
|
||||
// load calendar.js
|
||||
require("../../../modules/default/calendar/calendar.js");
|
||||
});
|
||||
|
||||
describe("capFirst", function() {
|
||||
words = {
|
||||
"rodrigo": "Rodrigo",
|
||||
"123m": "123m",
|
||||
"magic mirror": "Magic mirror",
|
||||
",a": ",a",
|
||||
"ñandú": "Ñandú"
|
||||
};
|
||||
|
||||
Object.keys(words).forEach(word => {
|
||||
it(`for '${word}' should return '${words[word]}'`, function() {
|
||||
expect(Module.definitions.calendar.capFirst(word)).to.equal(words[word]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("getLocaleSpecification", function() {
|
||||
it("Should return a valid moment.LocaleSpecification for a 12-hour format", function() {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification(12)).to.deep.equal({ longDateFormat: {LT: "h:mm A"} });
|
||||
});
|
||||
|
||||
it("Should return a valid moment.LocaleSpecification for a 24-hour format", function() {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification(24)).to.deep.equal({ longDateFormat: {LT: "HH:mm"} });
|
||||
});
|
||||
|
||||
it("Should return the current system locale when called without timeFormat number", function() {
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: moment.localeData().longDateFormat("LT")} } );
|
||||
});
|
||||
|
||||
it("Should return a 12-hour longDateFormat when using the 'en' locale", function() {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("en");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "h:mm A"} });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 12-hour longDateFormat when using the 'au' locale", function() {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("au");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "h:mm A"} });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 12-hour longDateFormat when using the 'eg' locale", function() {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("eg");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "h:mm A"} });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 24-hour longDateFormat when using the 'nl' locale", function() {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("nl");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "HH:mm"} });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 24-hour longDateFormat when using the 'fr' locale", function() {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("fr");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "HH:mm"} });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
|
||||
it("Should return a 24-hour longDateFormat when using the 'uk' locale", function() {
|
||||
var localeBackup = moment.locale();
|
||||
moment.locale("uk");
|
||||
expect(Module.definitions.calendar.getLocaleSpecification()).to.deep.equal({ longDateFormat: {LT: "HH:mm"} });
|
||||
moment.locale(localeBackup);
|
||||
});
|
||||
});
|
||||
|
||||
describe("shorten", function() {
|
||||
strings = {
|
||||
" String with whitespace at the beginning that needs trimming" : { length: 16, return: "String with whit…" },
|
||||
"long string that needs shortening": { length: 16, return: "long string that…" },
|
||||
"short string": { length: 16, return: "short string" },
|
||||
"long string with no maxLength defined": { return: "long string with no maxLength defined" },
|
||||
};
|
||||
|
||||
Object.keys(strings).forEach(string => {
|
||||
it(`for '${string}' should return '${strings[string].return}'`, function() {
|
||||
expect(Module.definitions.calendar.shorten(string, strings[string].length)).to.equal(strings[string].return);
|
||||
});
|
||||
});
|
||||
|
||||
it("should return an empty string if shorten is called with a non-string", function () {
|
||||
expect(Module.definitions.calendar.shorten(100)).to.equal("");
|
||||
});
|
||||
|
||||
it("should not shorten the string if shorten is called with a non-number maxLength", function () {
|
||||
expect(Module.definitions.calendar.shorten("This is a test string", "This is not a number")).to.equal("This is a test string");
|
||||
});
|
||||
|
||||
it("should wrap the string instead of shorten it if shorten is called with wrapEvents = true (with maxLength defined as 20)", function () {
|
||||
expect(Module.definitions.calendar.shorten(
|
||||
"This is a wrapEvent test. Should wrap the string instead of shorten it if called with wrapEvent = true",
|
||||
20,
|
||||
true)).to.equal("This is a <br>wrapEvent test. Should wrap <br>the string instead of <br>shorten it if called with <br>wrapEvent = true");
|
||||
});
|
||||
|
||||
it("should wrap the string instead of shorten it if shorten is called with wrapEvents = true (without maxLength defined, default 25)", function () {
|
||||
expect(Module.definitions.calendar.shorten(
|
||||
"This is a wrapEvent test. Should wrap the string instead of shorten it if called with wrapEvent = true",
|
||||
undefined,
|
||||
true)).to.equal("This is a wrapEvent <br>test. Should wrap the string <br>instead of shorten it if called <br>with wrapEvent = true");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
51
tests/unit/functions/class_spec.js
Normal file
51
tests/unit/functions/class_spec.js
Normal file
@@ -0,0 +1,51 @@
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var jsClass = require("../../../js/class.js");
|
||||
|
||||
describe("File js/class", function() {
|
||||
describe("Test function cloneObject", function() {
|
||||
var cloneObject = jsClass._test.cloneObject;
|
||||
|
||||
it("should be return equals object", function() {
|
||||
var expected = {name: "Rodrigo", web: "https://rodrigoramirez.com", project: "MagicMirror"};
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(expected).to.deep.equal(obj);
|
||||
});
|
||||
|
||||
it("should be return equals int", function() {
|
||||
var expected = 1;
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(expected).to.equal(obj);
|
||||
});
|
||||
|
||||
it("should be return equals string", function() {
|
||||
var expected = "Perfect stranger";
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(expected).to.equal(obj);
|
||||
});
|
||||
|
||||
it("should be return equals undefined", function() {
|
||||
var expected = undefined;
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(undefined).to.equal(obj);
|
||||
});
|
||||
|
||||
// CoverageME
|
||||
/*
|
||||
context("Test lockstring code", function() {
|
||||
it("should be return equals object", function() {
|
||||
var expected = {name: "Module", lockStrings: "stringLock"};
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(expected).to.deep.equal(obj);
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
|
78
tests/unit/functions/currentweather_spec.js
Normal file
78
tests/unit/functions/currentweather_spec.js
Normal file
@@ -0,0 +1,78 @@
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var vm = require("vm");
|
||||
|
||||
|
||||
describe("Functions module currentweather", function() {
|
||||
|
||||
|
||||
// Fake for use by currentweather.js
|
||||
Module = {};
|
||||
config = {};
|
||||
Module.definitions = {};
|
||||
Module.register = function (name, moduleDefinition) {
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
||||
|
||||
before(function(){
|
||||
require("../../../modules/default/currentweather/currentweather.js");
|
||||
Module.definitions.currentweather.config = {};
|
||||
});
|
||||
|
||||
describe("roundValue", function() {
|
||||
|
||||
describe("this.config.roundTemp is true", function() {
|
||||
before(function(){
|
||||
Module.definitions.currentweather.config.roundTemp = true;
|
||||
});
|
||||
|
||||
var values = [
|
||||
// index 0 value
|
||||
// index 1 expect
|
||||
[1 , "1"],
|
||||
[1.0 , "1"],
|
||||
[1.02 , "1"],
|
||||
[10.12 , "10"],
|
||||
[2.0 , "2"],
|
||||
["2.12" , "2"],
|
||||
[10.1 , "10"]
|
||||
]
|
||||
|
||||
values.forEach(value => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function() {
|
||||
expect(Module.definitions.currentweather.roundValue(value[0])).to.equal(value[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("this.config.roundTemp is false", function() {
|
||||
|
||||
before(function(){
|
||||
Module.definitions.currentweather.config.roundTemp = false;
|
||||
});
|
||||
|
||||
var values = [
|
||||
// index 0 value
|
||||
// index 1 expect
|
||||
[1 , "1.0"],
|
||||
[1.0 , "1.0"],
|
||||
[1.02 , "1.0"],
|
||||
[10.12 , "10.1"],
|
||||
[2.0 , "2.0"],
|
||||
["2.12" , "2.1"],
|
||||
[10.1 , "10.1"],
|
||||
[10.10 , "10.1"]
|
||||
]
|
||||
|
||||
values.forEach(value => {
|
||||
it(`for ${value[0]} should be return ${value[1]}`, function() {
|
||||
expect(Module.definitions.currentweather.roundValue(value[0])).to.equal(value[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
37
tests/unit/functions/newsfeed_spec.js
Normal file
37
tests/unit/functions/newsfeed_spec.js
Normal file
@@ -0,0 +1,37 @@
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var vm = require("vm");
|
||||
|
||||
|
||||
describe("Functions into modules/default/newsfeed/newsfeed.js", function() {
|
||||
|
||||
Module = {}
|
||||
Module.definitions = {};
|
||||
Module.register = function (name, moduleDefinition) {
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
||||
// load newsfeed.js
|
||||
require("../../../modules/default/newsfeed/newsfeed.js");
|
||||
|
||||
describe("capitalizeFirstLetter", function() {
|
||||
words = {
|
||||
"rodrigo": "Rodrigo",
|
||||
"123m": "123m",
|
||||
"magic mirror": "Magic mirror",
|
||||
",a": ",a",
|
||||
"ñandú": "Ñandú",
|
||||
".!": ".!"
|
||||
};
|
||||
|
||||
Object.keys(words).forEach(word => {
|
||||
it(`for ${word} should return ${words[word]}`, function() {
|
||||
expect(Module.definitions.newsfeed.capitalizeFirstLetter(word)).to.equal(words[word]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
66
tests/unit/global_vars/defaults_modules_spec.js
Normal file
66
tests/unit/global_vars/defaults_modules_spec.js
Normal file
@@ -0,0 +1,66 @@
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var vm = require("vm");
|
||||
|
||||
before(function() {
|
||||
var basedir = path.join(__dirname, "../../..");
|
||||
|
||||
var fileName = "js/app.js";
|
||||
var filePath = path.join(basedir, fileName);
|
||||
var code = fs.readFileSync(filePath);
|
||||
|
||||
this.sandbox = {
|
||||
module: {},
|
||||
__dirname: path.dirname(filePath),
|
||||
global: {},
|
||||
console: {
|
||||
log: function() { /*console.log("console.log(", arguments, ")");*/ }
|
||||
},
|
||||
process: {
|
||||
on: function() { /*console.log("process.on called with: ", arguments);*/ },
|
||||
env: {}
|
||||
}
|
||||
};
|
||||
|
||||
this.sandbox.require = function(filename) {
|
||||
// This modifies the global slightly,
|
||||
// but supplies vm with essential code
|
||||
return require(filename);
|
||||
};
|
||||
|
||||
vm.runInNewContext(code, this.sandbox, fileName);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
//console.log(global);
|
||||
});
|
||||
|
||||
describe("Default modules set in modules/default/defaultmodules.js", function() {
|
||||
|
||||
var expectedDefaultModules = [
|
||||
"alert",
|
||||
"calendar",
|
||||
"clock",
|
||||
"compliments",
|
||||
"currentweather",
|
||||
"helloworld",
|
||||
"newsfeed",
|
||||
"weatherforecast",
|
||||
"updatenotification"
|
||||
];
|
||||
|
||||
expectedDefaultModules.forEach(defaultModule => {
|
||||
it(`contains default module "${defaultModule}"`, function() {
|
||||
expect(this.sandbox.defaultModules).to.include(defaultModule);
|
||||
});
|
||||
});
|
||||
|
||||
expectedDefaultModules.forEach(defaultModule => {
|
||||
it(`contains a folder for modules/default/${defaultModule}"`, function() {
|
||||
expect(fs.existsSync(path.join(this.sandbox.global.root_path, "modules/default", defaultModule))).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@@ -63,8 +63,8 @@ describe("'global.root_path' set in js/app.js", function() {
|
||||
});
|
||||
|
||||
it("should expect the global.version equals package.json file", function() {
|
||||
version_package = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||
expect(this.sandbox.global.version).to.equal(version_package);
|
||||
versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||
expect(this.sandbox.global.version).to.equal(versionPackage);
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user