2017-07-24 22:08:12 +02:00
const helpers = require ( "../global-setup" );
const describe = global . describe ;
const it = global . it ;
const beforeEach = global . beforeEach ;
const afterEach = global . afterEach ;
2020-05-11 22:22:32 +02:00
describe ( "Clock set to spanish language module" , function () {
2017-07-24 22:08:12 +02:00
helpers . setupTimeout ( this );
var app = null ;
2020-05-11 22:22:32 +02:00
beforeEach ( function () {
2017-07-24 22:08:12 +02:00
return helpers
. startApplication ({
args : [ "js/electron.js" ]
})
2020-05-11 22:22:32 +02:00
. then ( function ( startedApp ) {
2017-07-24 22:08:12 +02:00
app = startedApp ;
});
});
2017-02-01 14:10:12 -03:00
2020-05-11 22:22:32 +02:00
afterEach ( function () {
2017-07-24 22:08:12 +02:00
return helpers . stopApplication ( app );
});
2017-02-01 14:10:12 -03:00
2020-05-11 22:22:32 +02:00
describe ( "with default 24hr clock config" , function () {
before ( function () {
2017-02-01 14:10:12 -03:00
// Set config sample for use in test
process . env . MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_24hr.js" ;
});
2020-05-11 22:22:32 +02:00
it ( "shows date with correct format" , function () {
2017-02-11 13:41:00 +01:00
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}$/ ;
2017-07-24 22:08:12 +02:00
return app . client . waitUntilWindowLoaded (). getText ( ".clock .date" ). should . eventually . match ( dateRegex );
2017-02-01 14:10:12 -03:00
});
2020-05-11 22:22:32 +02:00
it ( "shows time in 24hr format" , function () {
2017-07-24 22:08:12 +02:00
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/ ;
return app . client . waitUntilWindowLoaded (). getText ( ".clock .time" ). should . eventually . match ( timeRegex );
2017-02-01 14:10:12 -03:00
});
});
2020-05-11 22:22:32 +02:00
describe ( "with default 12hr clock config" , function () {
before ( function () {
2017-02-01 14:10:12 -03:00
// Set config sample for use in test
process . env . MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_12hr.js" ;
});
2020-05-11 22:22:32 +02:00
it ( "shows date with correct format" , function () {
2017-02-11 13:41:00 +01:00
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}$/ ;
2017-07-24 22:08:12 +02:00
return app . client . waitUntilWindowLoaded (). getText ( ".clock .date" ). should . eventually . match ( dateRegex );
2017-02-01 14:10:12 -03:00
});
2020-05-11 22:22:32 +02:00
it ( "shows time in 12hr format" , function () {
2017-02-01 14:10:12 -03:00
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/ ;
2017-07-24 22:08:12 +02:00
return app . client . waitUntilWindowLoaded (). getText ( ".clock .time" ). should . eventually . match ( timeRegex );
2017-02-01 14:10:12 -03:00
});
});
2020-05-11 22:22:32 +02:00
describe ( "with showPeriodUpper config enabled" , function () {
before ( function () {
2017-02-01 14:10:12 -03:00
// Set config sample for use in test
process . env . MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showPeriodUpper.js" ;
});
2020-05-11 22:22:32 +02:00
it ( "shows 12hr time with upper case AM/PM" , function () {
2017-02-01 14:10:12 -03:00
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/ ;
2017-07-24 22:08:12 +02:00
return app . client . waitUntilWindowLoaded (). getText ( ".clock .time" ). should . eventually . match ( timeRegex );
2017-02-01 14:10:12 -03:00
});
});
2017-04-09 15:32:15 -03:00
2020-05-11 22:22:32 +02:00
describe ( "with showWeek config enabled" , function () {
before ( function () {
2017-04-09 15:32:15 -03:00
// Set config sample for use in test
process . env . MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showWeek.js" ;
});
2020-05-11 22:22:32 +02:00
it ( "shows week with correct format" , function () {
2017-04-09 15:32:15 -03:00
const weekRegex = /^Semana [0-9]{1,2}$/ ;
2020-05-11 22:22:32 +02:00
return app . client . waitUntilWindowLoaded (). getText ( ".clock .week" ). should . eventually . match ( weekRegex );
2017-04-09 15:32:15 -03:00
});
});
2017-02-01 14:10:12 -03:00
});