Best JavaScript code snippet using appium-xcuitest-driver
services.js
Source:services.js
...18// /movie19//20cinefms.factory('MovieService', [ 'ServiceService', 21 function(serviceService) {22 return serviceService.createService('movies/movies');23 }24]);25cinefms.factory('MovieVersionService', [ 'ServiceService', 26 function(serviceService) {27 return serviceService.createService('movies/versions');28 }29]);30//31// /mediaclip32//33cinefms.factory('MediaclipService', [ 'ServiceService', 34 function(serviceService) {35 return serviceService.createService('mediaclips/clips');36 }37]);38cinefms.factory('MediaclipTypeService', [ 'ServiceService',39 function(serviceService) {40 return serviceService.createService('mediaclips/types');41 }42]);43cinefms.factory('MediaclipFramerateService', [ 'ServiceService', 44 function(serviceService) {45 return serviceService.createService('mediaclips/framerates');46 }47]);48cinefms.factory('MediaclipMediaAspectService', [ 'ServiceService', 49 function(serviceService) {50 return serviceService.createService('mediaclips/mediaaspects');51 }52]);53cinefms.factory('MediaclipScreenAspectService', [ 'ServiceService', 54 function(serviceService) {55 return serviceService.createService('mediaclips/screenaspects');56 }57]);58//59// /mediaclips/tasks60//61cinefms.factory('MediaclipTaskService', [ 'ServiceService', 'Restangular', 62 function(serviceService, restangular) {63 var out = serviceService.createService('mediaclips/tasks');64 out.getProgress = function(id) {65 return restangular.all('mediaclips/tasks').one(id).all('progress').getList();66 }67 out.saveProgress = function(id,p) {68 return restangular.all('mediaclips/tasks').one(id).all('progress').customPOST(p);69 }70 return out;71 }72]);73cinefms.factory('MediaclipTaskTypeService', [ 'ServiceService', 74 function(serviceService) {75 return serviceService.createService('mediaclips/tasktypes');76 }77]);78//79// /packages80//81cinefms.factory('PackageService', [ 'ServiceService', 82 function(serviceService) {83 return serviceService.createService('packages/packages');84 }85]);86cinefms.factory('PackageFileService', [ 'ServiceService', 87 function(serviceService) {88 return serviceService.createService('packages/files');89 }90]);91cinefms.factory('PackageCopyService', [ 'ServiceService', 92 function(serviceService) {93 return serviceService.createService('packages/packagecopies');94 }95]);96cinefms.factory('PackageFileCopyService', [ 'ServiceService', 97 function(serviceService) {98 return serviceService.createService('packages/filecopies');99 }100]);101cinefms.factory('PackageTypeService', [ 'ServiceService', 102 function(serviceService) {103 return serviceService.createService('packages/packagetypes');104 }105]);106cinefms.factory('StorageSystemService', [ 'ServiceService', 107 function(serviceService) {108 return serviceService.createService('packages/storagesystems');109 }110]);111//112// /crypto113//114cinefms.factory('KeyService', [ 'ServiceService', 115 function(serviceService) {116 return serviceService.createService('crypto/keys');117 }118]);119cinefms.factory('CertificateService', [ 'ServiceService', 120 function(serviceService) {121 return serviceService.createService('crypto/certificates');122 }123]);124cinefms.factory('KeyRequestService', [ 'ServiceService', 125 function(serviceService) {126 return serviceService.createService('crypto/keyrequests');127 }128]);129//130// /playback131//132cinefms.factory('EventService', [ 'ServiceService',133 function(serviceService) {134 return serviceService.createService('playback/events');135 }136]);137cinefms.factory('ScheduleOverviewService' ['EventService','LocationService','SiteService',138 function(eventService,locationService,siteService) {139 return {140 141 };142 }143]);144cinefms.factory('LocationService', [ 'ServiceService',145 function(serviceService) {146 return serviceService.createService('playback/locations');147 }148]);149cinefms.factory('SiteService', [ 'ServiceService',150 function(serviceService) {151 return serviceService.createService('playback/sites');152 }153]);154cinefms.factory('DeviceService', [ 'ServiceService',155 function(serviceService) {156 return serviceService.createService('playback/devices');157 }158]);159cinefms.factory('DevicetypeService', [ 'ServiceService',160 function(serviceService) {161 return serviceService.createService('playback/devices_types');162 }163]);164cinefms.factory('DeviceStatusService', [ 'ServiceService', 'Restangular',165 function(serviceService,restangular) {166 return {167 list : function(deviceId) {168 return restangular.one("playback/devices",deviceId).all("status").getList({max:100});169 },170 get : function(deviceId,statusId) {171 return restangular.one("playback/devices",deviceId).one("status/"+statusId,"details").get();172 }173 }174 }175]);176cinefms.factory('DeviceProtocolService', [ 'ServiceService',177 function(serviceService) {178 return serviceService.createService('playback/deviceprotocols');179 }180]);181cinefms.factory('ProjectSettingsService', [ 'DebounceService', 'Restangular', '$http', '$q',182 function(debounceService, restangular, $http, $q) {183 var a = {184 getDateConfig : debounceService.debounce(185 function() {186 var d = $q.defer();187 restangular.one("project","settings").get().then(188 function(ps) {189 a.dateConfig = {190 timezone : ps.timezone || "Europe/Berlin",191 timeFormat : ps.timeFormat || "HH:mm",192 dateFormat : ps.dateFormat || "YYYY-MM-DD",193 };194 d.resolve(a.dateConfig);195 }196 );197 return d.promise;198 },100)199 };200 return {201 get : function(id) {202 return restangular.one("project","settings").get();203 },204 save : function(object) {205 var def = $q.defer();206 return object.save();207 },208 getMailSettings : function(id) {209 return restangular.one("project","mailserver").get();210 },211 saveMailSettings : function(mailSettings) {212 var def = $q.defer();213 return restangular.one("project","mailserver").customPUT(mailSettings);214 },215 updateCredentials : function(credentials) {216 return restangular.one("project/mailserver/credentials").customPUT(credentials);217 },218 getDateConfig : function() {219 var d = $q.defer();220 if(!angular.isUndefined(a.dateConfig)) {221 d.resolve(a.dateConfig);222 } else {223 a.getDateConfig().then(d.resolve);224 }225 return d.promise;226 }227 }228 }229]);230cinefms.factory('DateFormattingService', [ '$q', 'ProjectSettingsService', 231 function($q,projectSettingsService) {232 var s = $q.defer();233 projectSettingsService.getDateConfig().then(234 function(dateConfig) {235 a = {236 formatTime : function(x) {237 var m =moment(x).tz(dateConfig.timezone);238 return m.format(dateConfig.timeFormat);239 },240 formatDate : function(x) {241 var m =moment(x).tz(dateConfig.timezone);242 return m.format(dateConfig.dateFormat);243 }244 }245 s.resolve(a);246 }247 )248 return s.promise;249 }250]);251//252// /admin253//254cinefms.factory('MailTemplateService', [ 'ServiceService', 'Restangular', 255 function(serviceService, restangular) {256 var out = serviceService.createService('project/mailtemplates');257 out.sendTest = function(id,tokens,recipient) {258 console.log(tokens);259 return restangular.one("project/mailtemplates/"+id,"test").customPOST(tokens,undefined,{"recipient" :recipient});260 };261 return out;262 }263]);264cinefms.factory('ProjectService', [ 'DebounceService', 'ServiceService', 'Restangular', '$q', 265 function(debounceService,serviceService,restangular,$q) {266 var s = serviceService.createService('admin/projects');267 s.currentProject = undefined;268 s.getCurrentProjectInternal = debounceService.debounce(function(){ 269 var d = $q.defer();270 if(angular.isUndefined(s.currentProject)) {271 restangular.all('admin').one('currentproject').get().then(272 function(cp) {273 s.currentProject = cp;274 d.resolve(cp);275 }276 );277 } else {278 d.resolve(s.currentProject);279 }280 return d.promise;281 },200);282 s.getCurrentProject = function() {283 if(s.currentProject) {284 var d = $q.defer();285 d.resolve(s.currentProject);286 return d.promise;287 } else {288 return s.getCurrentProjectInternal();289 }290 }291 s.dateFormat = {292 };293 return s;294 }295]);296cinefms.factory('ScheduledJobService', [ 'ServiceService', 'Restangular', 297 function(serviceService, restangular) {298 var out = serviceService.createService('global/scheduledjobs');299 out.getLogs = function(id) {300 return restangular.all('global/scheduledjobs/'+id+'/logs').getList();301 };302 out.getLogDetails = function(id,detailId) {303 return restangular.all('global/scheduledjobs/'+id+'/logs/'+detailId).one("details").get();304 };305 return out;306 }307]);308cinefms.factory('ScheduledJobTypeService', [ 'ServiceService', 309 function(serviceService) {310 return serviceService.createService('global/scheduledjobtypes');311 }312]);313cinefms.factory('UserService', [ 'ServiceService', 'Restangular', 314 function(serviceService, restangular) {315 var s = serviceService.createService('global/users');316 s.getCurrentUser = function() {317 return restangular.one('admin/authentication/login').customGET();318 }319 s.reset = function(username,oldPassword,newPassword) {320 var ppp = {321 username : username,322 password : oldPassword,323 newPassword : newPassword324 };325 restangular.one('global/users/1/reset').customPOST(ppp);326 }327 return s;328 }329]);330cinefms.factory('GroupService', [ 'ServiceService', 'Restangular', 331 function(serviceService, restangular) {332 out = serviceService.createService('global/groups');333 out.getEntityGroups = function() {334 return restangular.all('global/entitygroups').getList();335 }336 out.getAccessTypes = function() {337 return restangular.all('global/accesstypes').getList();338 }339 return out;340 }341]);342cinefms.factory('AccessTypeService', [ 'ServiceService', 'Restangular', 343 function(serviceService, restangular) {344 out = serviceService.createService('global/accesstypes');345 return out;346 }347]);348cinefms.factory('EntityGroupService', [ 'ServiceService', 'Restangular', 349 function(serviceService, restangular) {350 out = serviceService.createService('global/entitygroups');351 return out;352 }353]);354cinefms.factory('MOTDService', [ 'ServiceService', 'Restangular', 355 function(serviceService, restangular) {356 out = serviceService.createService('global/motd');357 return out;358 }359]);360cinefms.factory('LanguageService', [ 'ServiceService', 361 function(serviceService) {362 return serviceService.createService('global/languages');363 }364]);365cinefms.factory('TagService', [ 'ServiceService', 366 function(serviceService) {367 return serviceService.createService('global/tags');368 }369]);370cinefms.factory('MediaClipTypeService', [ 'ServiceService', 371 function(serviceService) {372 return serviceService.createService('mediaclips/types');373 }374]);375cinefms.factory('FramerateService', [ 'ServiceService', 376 function(serviceService) {377 return serviceService.createService('mediaclips/framerates');378 }379]);380cinefms.factory('PackagetypeService', [ 'ServiceService', 381 function(serviceService) {382 return serviceService.createService('packages/packagetypes');383 }384]);385cinefms.factory('ScreenAspectService', [ 'ServiceService', 386 function(serviceService) {387 return serviceService.createService('mediaclips/screenaspects');388 }389]);390cinefms.factory('MediaAspectService', [ 'ServiceService', 391 function(serviceService) {392 return serviceService.createService('mediaclips/mediaaspects');393 }394]);395cinefms.factory('AudioFormatService', [ 'ServiceService', 396 function(serviceService) {397 return serviceService.createService('mediaclips/audioformats');398 }399]);400cinefms.factory('CountryService', [ 'ServiceService', 401 function(serviceService) {402 return serviceService.createService('global/countries');403 }404]);405cinefms.factory('CommentService', [ 'ServiceService', 406 function(serviceService) {407 return serviceService.createService('global/comments');408 }409]);410cinefms.factory('NotificationService', [ 'ServiceService', 411 function(serviceService) {412 return serviceService.createService('global/notifications');413 }...
locales.js
Source:locales.js
1export default {2 fr: {3 "app.name": "RQRSDA",4 "banner.title": "Portail web de la ",5 "MainView.text" : "Vue principale (acceuil)",6 "dev.first": "Site développé par ",7 "dev.name": "Alexandre Laroche",8 "dev.second": " de lâÃTS à Montréal.",9 "home.request": "Demande d'accès",10 "header.homepage" : "Accueil",11 "header.profile" : "Mon Profil",12 "header.display" : "Afficher",13 "header.create" : "Créer",14 "header.login" : "Connexion",15 "header.logout" : "Deconnexion",16 "show.user" : "Usagers",17 "show.referents" : "Référents",18 "show.organismereferents" : "Organismes Référents",19 "show.organismes" : "Organismes",20 "show.services" : "Services",21 "show.pointservices" : "Points de services",22 "show.demandeservices" : "Demande de services",23 "login.title" : "Connexion",24 "login.email" : "Ecrivez votre email ici",25 "login.password" : "Ecrivez votre mot de passe ici",26 "login.checkbox" : " Rester connecté",27 "login.button" : "Connexion",28 "role.directeur" : "Directeur",29 "role.coordonateur" : "Coordonateur",30 "role.adjointcoordonateur" : "Adjoint-Coordonateur",31 "role.intervenant" : "Intervenant",32 "profile.title" : "Mon Profil",33 "profile.modify" : "Modifier Profil",34 "profile.username" : "Nom: ",35 "profile.email" : "Email: ",36 "profile.role" : "Rôle: ",37 "settings.title" : "Modifier votre profil",38 "settings.firstname" : "Prénom",39 "settings.lastname" : "Nom de famille",40 "settings.password" : "Nouveau mot de passe",41 "settings.update" : "Mettre à jour",42 "settings.selectrole" : "Veuillez choisir un rôle dans la liste",43 "register.title" : "Créer Usager",44 "register.role" : "Rôle usager",45 "register.password" : "Mot de passe",46 "register.button" : "Créer Usager",47 "listusers.title" : "Répertoire des Usagers",48 "listusers.modify" : "Modifier",49 "listusers.search" : "Rechercher par email :",50 "edituserdetails.title" : "Paramètres de l'Utilisateur",51 "userdetails.title" : "Profil Utilisateur",52 "userdetails.modify" : "Modifier",53 "userdetails.desactivate" : "Désactiver",54 "userdetails.reactivate" : "Réactiver",55 "createorganisme.title" : "Créer un Organisme",56 "createorganisme.name" : "Nom",57 "createorganisme.email" : "Email",58 "createorganisme.tel" : "Numéro de téléphone",59 "createorganisme.fax" : "Numéro de fax",60 "createorganisme.civnum" : "Numéro civique",61 "createorganisme.street" : "Rue",62 "createorganisme.city" : "Ville",63 "createorganisme.province" : "Province",64 "createorganisme.postalcode" : "Code postal",65 "createorganisme.address" : "Adresse",66 "listorganismes.title" : "Répertoire des Organismes",67 "listorganismes.search" : "Rechercher par nom :",68 "organismedetails.title" : "Profil de l'Organisme",69 "editorganisme.active.text" : "Statut d'activité de l'organisme",70 "editorganisme.active" : "Actif",71 "editorganisme.inactive" : "Inactif",72 "listservices.title" : "Liste des Services",73 "servicedetails.title" : "Profil du Service",74 "createservice.title" : "Créer un Service",75 "createservice.description" : "Description: ",76 "createservice.des" : "Description",77 "createservice.subvention" : "Subvention: ",78 "createservice.state" : "Etat: ",79 "createservice.vigueur" : "En vigueur depuis le: ",80 "createservice.tarpar" : "Tarif parent: ",81 "createservice.tarpa" : "Tarif parent",82 "createservice.tarcis" : "Tarif CISSS: ",83 "createservice.tarci" : "Tarif CISSS",84 "servicedetails.sub" : "Subventionné",85 "servicedetails.nonsub" : "Non-subventionné",86 "createservice.tar" : "Tarifs ($)",87 "createservice.autho" : "Autorisations",88 "createservice.grant" : "Selectionner la subvention du service",89 "createservice.activity" : "Selectionner l'activité du service",90 "createservice.pdeser" : "Point de service"91 },92 en: {93 "app.name": "ASQRDR",94 "banner.title": "Web portal of the ",95 "MainView.text" : "Main view (home)",96 "dev.first": "Site developped by ",97 "dev.name": "Alexandre Laroche",98 "dev.second": " from the ÃTS in Montréal.",99 "home.request": "Request access",100 "header.homepage" : "Home",101 "header.profile" : "My Profile",102 "header.display" : "Display",103 "header.create" : "Create",104 "header.login" : "Log in",105 "header.logout" : "Log out",106 "show.user" : "Users",107 "show.referents" : "Referents",108 "show.organismereferents" : "Referring organizations",109 "show.organismes" : "Organizations",110 "show.services" : "Services",111 "show.pointservices" : "Service points",112 "show.demandeservices" : "Request for services",113 "login.title" : "Login",114 "login.email" : "Write your email here",115 "login.password" : "Write your password here",116 "login.checkbox" : " Remember me",117 "login.button" : "Log in",118 "role.directeur" : "Director",119 "role.coordonateur" : "Coordinator",120 "role.adjointcoordonateur" : "Deputy-Coordinator",121 "role.intervenant" : "Patrol Officer",122 "profile.title" : "My Profile",123 "profile.modify" : "Modify Profile",124 "profile.username" : "Name: ",125 "profile.email" : "Email: ",126 "profile.role" : "Role: ",127 "settings.title" : "Modify your profile",128 "settings.firstname" : "First name",129 "settings.lastname" : "Last name",130 "settings.password" : "New password",131 "settings.update" : "Update",132 "settings.selectrole" : "Please select a role from the list",133 "register.title" : "Create User",134 "register.role" : "User role",135 "register.password" : "Password",136 "register.button" : "Create User",137 "listusers.title" : "List of Users",138 "listusers.modify" : "Modify",139 "listusers.search" : "Search by email :",140 "edituserdetails.title" : "User's details",141 "userdetails.title" : "User's profile",142 "userdetails.modify" : "Modify",143 "userdetails.desactivate" : "Desactivate",144 "userdetails.reactivate" : "Reactivate",145 "createorganisme.title" : "Create an Organization",146 "createorganisme.name" : "Name",147 "createorganisme.email" : "Email",148 "createorganisme.tel" : "Phone number",149 "createorganisme.fax" : "Fax number",150 "createorganisme.civnum" : "Civic number",151 "createorganisme.street" : "Street",152 "createorganisme.city" : "City",153 "createorganisme.province" : "Province",154 "createorganisme.postalcode" : "Postal code",155 "createorganisme.address" : "Address",156 "listorganismes.title" : "List of Organizations",157 "listorganismes.search" : "Search by name :",158 "organismedetails.title" : "Organization's profile",159 "editorganisme.active.text" : "Organization's activity status",160 "editorganisme.active" : "Active",161 "editorganisme.inactive" : "Inactive",162 "listservices.title" : "List of Services",163 "servicedetails.title" : "Service's profile",164 "createservice.title" : "Create a Service",165 "createservice.description" : "Description: ",166 "createservice.des" : "Description",167 "createservice.subvention" : "Grant: ",168 "createservice.state" : "State: ",169 "createservice.vigueur" : "In effect since: ",170 "createservice.tarpar" : "Parent's rate: ",171 "createservice.tarpa" : "Parent's rate",172 "createservice.tarcis" : "CISSS' rate: ",173 "createservice.tarci" : "CISSS' rate",174 "servicedetails.sub" : "Subsidised",175 "servicedetails.nonsub" : "Unsubsidised",176 "createservice.tar" : "Rates ($)",177 "createservice.autho" : "Authorizations",178 "createservice.grant" : "Select service's grant from the list",179 "createservice.activity" : "Select service's activity from the list",180 "createservice.pdeser" : "Service's Point"181 }...
grimm-pusher.test.js
Source:grimm-pusher.test.js
...36 subject.throttledProcess.cancel();37 }38 });39 it('should add event', () => {40 subject = createService(options);41 const event = {42 name: 'SomeEvent',43 time: Date.now(),44 tags: {45 service: 'foo-service'46 },47 fields: {48 msec: 1249 }50 };51 subject.add(event);52 assert.lengthOf(subject.events, 1, 'Event should be added to subject.events');53 });54 describe('date handling', () => {55 it('should set time to now when time is not provided', () => {56 subject = createService(options);57 const event = {58 name: 'SomeEvent'59 };60 subject.add(event);61 assert.match(subject.events[0].time, validTimestampRegex);62 });63 it('should convert javascript timestamp to date string', () => {64 subject = createService(options);65 const event = {66 name: 'SomeEvent',67 time: Date.now()68 };69 subject.add(event);70 assert.match(subject.events[0].time, validTimestampRegex);71 });72 it('should convert javascript date to date string', () => {73 subject = createService(options);74 const event = {75 name: 'SomeEvent',76 time: new Date()77 };78 subject.add(event);79 assert.match(subject.events[0].time, validTimestampRegex);80 });81 });82 describe('batch processing', () => {83 it('should default to a batch size of 1', () => {84 subject = createService(optionsWithoutMaxBatchSize);85 mockGrimmTransportSendOK();86 subject.add({name: 'foo'});87 assert.lengthOf(subject.events, 0);88 });89 it('should trigger process if max batch size is reached', () => {90 subject = createService(Object.assign({}, optionsWithoutThrottling, {maxBatchSize: 2}));91 subject.events.push({name: 'bar'});92 mockGrimmTransportSendOK();93 subject.add({name: 'foo'});94 assert.lengthOf(subject.events, 0);95 });96 it('should not trigger process if max batch size is not reached', () => {97 subject = createService(options);98 subject.add({name: 'foo'});99 assert.lengthOf(subject.events, 1);100 });101 });102 describe('throttling', () => {103 it('should not trigger processing before throttle delay has passed', () => {104 subject = createService(Object.assign({}, options, {throttleMs: 1000, maxBatchSize: 2}));105 subject.add({name: 'foo'});106 assert.lengthOf(subject.events, 1);107 });108 it('should trigger processing when throttle delay has passed', (done) => {109 subject = createService(Object.assign({}, options, {throttleMs: 5, maxBatchSize: 2}));110 mockGrimmTransportSendOK();111 subject.add({name: 'foo'});112 setTimeout(() => {113 assert.lengthOf(subject.events, 0);114 done();115 }, 10);116 });117 it('should trigger processing when throttling is set to 0 ms', () => {118 subject = createService(Object.assign({}, options, {throttleMs: 0, maxBatchSize: 2}));119 mockGrimmTransportSendOK();120 subject.add({name: 'foo'});121 assert.lengthOf(subject.events, 0);122 });123 it('should trigger processing when max batch size is reached, even when throttling is enabled', () => {124 subject = createService(Object.assign({}, options, {throttleMs: 100, maxBatchSize: 1}));125 mockGrimmTransportSendOK();126 subject.add({name: 'foo'});127 assert.lengthOf(subject.events, 0);128 });129 });130});131describe('process()', () => {132 afterEach(() => {133 td.reset();134 });135 it('should emit success event when there are no pending events', (done) => {136 const subject = createService(options);137 const expected = 'No pending Grimm events';138 subject.on('success', (actual) => {139 assert.equal(actual, expected);140 done();141 });142 subject.process();143 });144 it('should emit error event when apikey is missing', (done) => {145 const subject = createService(Object.assign({}, options, {apikey: null}));146 subject.events.push({name: 'foo'});147 subject.on('error', () => {148 done();149 });150 subject.process();151 });152 it('should send events and emit success when there are pending events', (done) => {153 const subject = createService(options);154 const event = {name: 'foo'};155 subject.add(event);156 td.when(grimmTransport.send(grimmEventUrl, options.apikey, [subject.events[0]])).thenReturn(Promise.resolve(''));157 subject.on('success', (actual) => {158 assert.equal(actual, 'Pushed 1 events to Grimm');159 done();160 });161 subject.process();162 });163 it('should emit error event when backend fails', (done) => {164 const subject = createService(options);165 subject.on('error', (err) => {166 assert.equal('Error occured', err.message);167 assert.lengthOf(err.data.events, 1);168 done();169 });170 const event = {name: 'foo'};171 subject.events.push(event);172 td.when(grimmTransport.send(grimmEventUrl, options.apikey, [subject.events[0]])).thenReturn(Promise.reject(Error('Error occured')));173 subject.process();174 });...
dataservice.js
Source:dataservice.js
...5 DataserviceBase,6 howie7) {8 "use strict";9 function createService(name, subPaths) {10 var serviceDomain = howie.fetch("config").serviceDomain + "/" + name,11 result = {};12 subPaths.forEach(function(collectionName) {13 result[collectionName] = new DataserviceBase(collectionName, serviceDomain);14 });15 return result;16 }17 return {18 base: new DataserviceBase(null, howie.fetch("config").serviceDomain),19 // user: new UserDataservice(),20 // session: new SessionDataservice(),21 //22 // with /api23 //24 api_auth: createService("api/auth", [25 "user",26 ]),27 api_ac: createService("api/ac", [28 "actionRequests",29 "types",30 ]),31 api_contractAdmin: createService("api/contractAdmin", [32 "accounts",33 "helpers",34 ]),35 api_ms: createService("api/ms", [36 "accounts",37 "holds",38 "invoices",39 "packages",40 "types",41 ]),42 api_qualify: createService("api/qualify", [43 "customerMasterFiles",44 ]),45 api_ticket: createService("api/ticket", [46 "teams",47 ]),48 api_admin: createService("api/admin", [49 "actions",50 "applications",51 "groupActionItems",52 "users",53 ]),54 api_hr: createService("api/hr", [55 "recruits",56 ]),57 api_inv: createService("api/inv", [58 "audits",59 "locations",60 "locationTypes",61 "productBarcodes",62 ]),63 //64 // no /api65 //66 accountingengine: createService("accountingenginesrv", [67 "aging",68 "billingInfoSummary",69 "billingHistory",70 "invoices",71 "invoiceItems",72 "customerSearches",73 "customerCardInfos",74 "customers",75 ]),76 fundingsrv: createService("fundingsrv", [77 "criterias",78 "packets",79 "packetItems",80 "bundles",81 "bundleItems"82 ]),83 humanresourcesrv: createService("humanresourcesrv", [84 "RuTeamLocationList",85 "RuTechnician",86 "RuTechnicianList",87 ]),88 hr: createService("humanresourcesrv", [89 "RuTechnicianList",90 //91 "payscales",92 "phoneCellCarriers",93 "recruits",94 "roleLocations",95 "schools",96 "seasons",97 "skills",98 "teams",99 "teamLocations",100 "userEmployeeTypes",101 "userTypes",102 "users",103 ]),104 inventoryenginesrv: createService("inventoryenginesrv", [105 "PurchaseOrder",106 "PurchaseOrderItems",107 "PackingSlip",108 "ProductBarcode",109 "PackingSlipItem",110 "ProductBarcodeTracking",111 "WarehouseSiteList",112 "LocationTypeList",113 "Locations",114 "ProductBarcodeLocations",115 "VendorList",116 ]),117 invoicesrv: createService("invoicesrv", [118 "invoices",119 "invoiceItems",120 "items",121 ]),122 maincore: createService("maincoresrv", [123 "departments",124 "notes",125 "notecategory1",126 "notecategory2",127 "notetypes",128 "localizations",129 ]),130 monitoringstationsrv: createService("monitoringStationSrv", [131 "msAccounts",132 "msIndustryAccounts",133 "accounts",134 "msAccountSalesInformations",135 "dispatchAgencies",136 "accountDispatchAgencyAssignments",137 "premiseAddress",138 "dispatchAgencyTypes",139 "msAccountStatusInformations"140 ]),141 msaccountsetupsrv: createService("msaccountsetupsrv", [142 "accounts",143 "emergencyContacts",144 "emergencyContactPhoneTypes",145 "emergencyContactRelationships",146 "monitoringStationOS",147 "equipments",148 "equipmentExistings",149 "systemDetails",150 "techDetails",151 "serviceTypes",152 "panelTypes",153 "dslSeizureTypes",154 "alarmcom",155 ]),156 qualify: createService("qualifysrv", [157 "salesrep",158 "technician",159 "address",160 "addressValidation",161 "premiseAddressValidation",162 "runCredit",163 "qualifyCustomerInfos",164 "insideSales",165 "customerMasterFiles",166 "leads",167 ]),168 salessummary: createService("msaccountsetupsrv", [169 "pointSystems",170 "activationfees",171 "surveytypes",172 "panelTypes",173 "cellularTypes",174 "vendorAlarmcomPacakges",175 "equipmentbypointsget",176 "contractLengthsGet",177 "frequentlyInstalledEquipmentGet",178 "invoiceRefresh",179 "invoiceMsIsntalls",180 ]),181 scheduleenginesrv: createService("scheduleenginesrv", [182 "TicketStatusCodeList",183 "TicketTypeList",184 "SeTicketList",185 "SeTicket",186 "SeScheduleTicket",187 "SeScheduleTicketList",188 "SeScheduleBlockList",189 "SeScheduleBlock",190 "SeTechnicianAvailability",191 "SeTicketList",192 "SeTechnicianAvailabilityList",193 "SeZipCode",194 "SeTicketReScheduleList",195 ]),196 survey: createService("surveysrv", [197 "tokens",198 "possibleAnswers",199 "surveyTypes",200 "questionMeanings",201 "surveys",202 "surveyTranslations",203 "questions",204 "questionTranslations",205 "questionMeaningTokenMaps",206 "questionPossibleAnswerMaps",207 "results",208 ]),209 swingaccountsrv: createService("swingaccountsrv", [210 // "accounts",211 "CustomerSwingInfo",212 "CustomerSwingPremiseAddress",213 "CustomerSwingEmergencyContact",214 "CustomerSwingEquipmentInfo",215 "CustomerSwingSystemDetails",216 "CustomerSwungInfo",217 "CustomerSwingInterim",218 "CustomerSwingAddDnc",219 /* "msAccount",220 "msAccountCustomer",221 "msAccountPremiseAddress",222 "msAccountEmergencyContact",223 "msAccountInventory",224 "msAccountEquipment",225 "msZoneType",226 "msEquipmentLocation",*/227 ]),228 ticketsrv: createService("ticketsrv", [229 "appointments",230 "serviceTickets",231 "serviceTypes",232 "skills",233 "statusCodes",234 "techs",235 ]),236 };...
service.js
Source:service.js
...15 VIEWALLSERVICE_REQUEST: 'VIEWALLSERVICE_REQUEST',16 VIEWALLSERVICE_SUCCESS: 'VIEWALLSERVICE_SUCCESS',17 VIEWALLSERVICE_FAILURE: 'VIEWALLSERVICE_FAILURE'18}19function _createService(data) {20 let body = JSON.stringify(data)21 return {22 [CALL_API]: {23 method: "POST",24 types: [25 CREATESERVICE_ACTION_TYPE.CREATESERVICE_REQUEST,26 CREATESERVICE_ACTION_TYPE.CREATESERVICE_SUCCESS,27 CREATESERVICE_ACTION_TYPE.CREATESERVICE_FAILURE28 ],29 endpoint: Settings.api.services.create,30 schema: Schemas.USER,31 settings: {32 method: "POST",33 headers: {34 'Accept': 'application/json',35 'Content-Type': 'application/json'36 },37 body: body,38 credentials: 'include'39 }40 }41 }42}43function createService(serviceInfo, requiredFields = []) {44 return (dispatch, getState) => {45 return dispatch(_createService(serviceInfo))46 }47}48function _viewService(data) {49 let body = JSON.stringify(data)50 return {51 [CALL_API]: {52 method: "POST",53 types: [54 VIEWSERVICE_ACTION_TYPE.VIEWSERVICE_REQUEST,55 VIEWSERVICE_ACTION_TYPE.VIEWSERVICE_SUCCESS,56 VIEWSERVICE_ACTION_TYPE.VIEWSERVICE_FAILURE57 ],58 endpoint: Settings.api.services.view,59 schema: Schemas.USER,...
index.js
Source:index.js
...26 /**27 * Service created lifecycle event handler28 */29 async created() {30 this.broker.createService(metadata);31 this.broker.createService(packages);32 this.broker.createService(apps);33 this.broker.createService(objects);34 this.broker.createService(layouts);35 this.broker.createService(permissionsets);36 this.broker.createService(tabs);37 this.broker.createService(translations);38 this.broker.createService(triggers);39 this.broker.createService(queriesService);40 this.broker.createService(chartsService);41 this.broker.createService(pagesService);42 this.broker.createService(shareRulesService);43 this.broker.createService(restrictionRulesService);44 this.broker.createService(permissionFieldsService);45 this.broker.createService(processService);46 },47 async started() {48 await this.broker.waitForServices(['metadata', 'apps', 'objects', 'permissionsets', 'translations', 'triggers'], null, 10);49 }...
start.js
Source:start.js
...14const broker = new ServiceBroker({15 transporter: "TCP",16 cacher: "Memory"17});18broker.createService(Config);19broker.createService(Facebook);20broker.createService(GitHub);21broker.createService(GitLab);22broker.createService(Instagram);23broker.createService(Reddit);24broker.createService(Twitter);25broker.createService(Events);26broker.createService(Stories);27broker.createService({28 mixins: [Gateway],29 settings: {30 cors: {31 origin: "*",32 methods: ["GET", "OPTIONS", "POST", "PUT", "DELETE"],33 allowedHeaders: [],34 exposedHeaders: [],35 credentials: false,36 maxAge: 360037 }38 }39});...
rating-service.test.js
Source:rating-service.test.js
1import RatingService from '~/services/rating-service/rating-service';2describe(`RatingService tests`, () => {3 const createService = (rating) => new RatingService(rating);4 it(`getLevel method work correctly`, () => {5 expect(createService(0).getLevel()).toEqual(`Bad`);6 expect(createService(2.9).getLevel()).toEqual(`Bad`);7 expect(createService(3).getLevel()).toEqual(`Normal`);8 expect(createService(4.9).getLevel()).toEqual(`Normal`);9 expect(createService(5).getLevel()).toEqual(`Good`);10 expect(createService(7.9).getLevel()).toEqual(`Good`);11 expect(createService(8).getLevel()).toEqual(`Very good`);12 expect(createService(9.9).getLevel()).toEqual(`Very good`);13 expect(createService(10).getLevel()).toEqual(`Awesome`);14 expect(createService(99).getLevel()).toEqual(`Awesome`);15 });16 it(`getConvertRating method work correctly`, () => {17 expect(createService(8.4).getConvertRating()).toEqual(`8,4`);18 expect(createService(5.4445).getConvertRating()).toEqual(`5,4`);19 });...
Using AI Code Generation
1const { remote } = require('webdriverio');2const opts = {3 capabilities: {4 }5};6(async () => {7 const client = await remote(opts);8 const app = await client.$('~<accessibility id>');9 await app.click();10 const service = await client.createService('com.apple.mobilesafari');11 await service.start();12 await service.stop();13 await client.deleteSession();14})();15[0-0] 2021-01-20T06:29:11.565Z INFO webdriver: DATA {16[0-0] capabilities: {17[0-0] alwaysMatch: {18[0-0] },19[0-0] firstMatch: [ {} ]20[0-0] },21[0-0] desiredCapabilities: {
Using AI Code Generation
1driver.init({2})3.then(function () {4 return driver.createService('com.apple.mobilesafari', 'com.apple.mobilesafari.WebContent', 'com.apple.mobilesafari.WebContent');5})6.then(function () {7 console.log("Service Created");8})9.catch(function (err) {10 console.log("Error: " + err);11});12driver.init({13})14.then(function () {15 return driver.createService('com.apple.mobilesafari', 'com.apple.mobilesafari.WebContent', 'com.apple.mobilesafari.WebContent');16})17.then(function () {18 console.log("Service Created");19})20.catch(function (err) {21 console.log("Error: " + err);22});23driver.init({24})25.then(function () {26 return driver.createService('com.apple.mobilesafari', 'com.apple.mobilesafari.WebContent', 'com.apple.mobilesafari.WebContent');27})28.then(function () {29 console.log("Service Created");30})31.catch(function (err) {32 console.log("Error: " + err);33});34driver.init({
Using AI Code Generation
1var wd = require('wd');2var caps = {3};4var driver = wd.promiseChainRemote('localhost', 4723);5 .init(caps)6 .setImplicitWaitTimeout(10000)7 .createService('com.apple.mobilesafari', 'com.apple.mobilesafari.WebKit2.WebContent')8 .then(function (service) {9 console.log(service);10 });
Using AI Code Generation
1import { createService } from 'appium-xcuitest-driver';2createService();3import { createSession } from 'appium-xcuitest-driver';4createSession();5import { deleteSession } from 'appium-xcuitest-driver';6deleteSession();7import { executeCommand } from 'appium-xcuitest-driver';8executeCommand();9import { executeCommand } from 'appium-xcuitest-driver';10executeCommand();11import { executeCommand } from 'appium-xcuitest-driver';12executeCommand();13import { executeCommand } from 'appium-xcuitest-driver';14executeCommand();15import { executeCommand } from 'appium-xcuitest-driver';16executeCommand();17import { executeCommand } from 'appium-xcuitest-driver';18executeCommand();19import { executeCommand } from 'appium-xcuitest-driver';20executeCommand();21import { executeCommand } from 'appium-xcuitest-driver';22executeCommand();23import { executeCommand } from 'appium-xcuitest-driver';24executeCommand();25import { executeCommand } from 'appium-xcuitest-driver';26executeCommand();
Using AI Code Generation
1let driver = new iosDriver();2driver.createService();3driver.startService();4driver.stopService();5driver.deleteService();6driver.isServiceRunning();7driver.startSession();8driver.deleteSession();9driver.getStatus();10driver.getSessions();11driver.setImplicitWaitTimeout();12driver.setTimeout();13driver.getTimeout();14driver.getTimeouts();15driver.setAsyncScriptTimeout();16driver.setOrientation();17driver.getOrientation();18driver.getGeoLocation();19driver.setGeoLocation();20driver.getLogTypes();21driver.getLogs();22driver.logEvent();23driver.logPerformance();24driver.logTypes();25driver.log();
Using AI Code Generation
1const { remote } = require('webdriverio');2const opts = {3 capabilities: {4 }5};6(async () => {7 const driver = await remote(opts);8 const service = await driver.createService('com.apple.mobilecal');9 console.log(service);10 await driver.deleteSession();11})();12(async () => {13 const driver = await remote(opts);14 const service = await driver.createService('com.apple.mobilecal');15 console.log(service);16 await driver.deleteSession();17})();18(async () => {19 const driver = await remote(opts);20 const service = await driver.createService('com.apple.mobilecal');21 console.log(service);22 await driver.deleteSession();23})();24(async () => {25 const driver = await remote(opts);26 const service = await driver.createService('com.apple.mobilecal');27 console.log(service);28 await driver.deleteSession();29})();30(async () => {31 const driver = await remote(opts);32 const service = await driver.createService('com.apple.mobilecal');33 console.log(service);34 await driver.deleteSession();35})();36(async () => {37 const driver = await remote(opts);38 const service = await driver.createService('com.apple.mobilecal');39 console.log(service);40 await driver.deleteSession();41})();42(async () => {43 const driver = await remote(opts);44 const service = await driver.createService('com.apple.mobilecal');
Using AI Code Generation
1const { createService } = require('appium-xcuitest-driver');2const service = createService();3service.start();4const { createService } = require('appium-xcuitest-driver');5const service = createService();6service.start();7I am using the latest version of Appium (1.13.0) and Node (v10.16.0)
Using AI Code Generation
1const wd = require('webdriverio');2const options = {3 desiredCapabilities: {4 }5};6const client = wd.remote(options);7client.init()8 .then(() => {9 console.log('Appium session created');10 return client.createSession();11 })12 .then((res) => {13 console.log('WDA session created');14 return client.deleteSession();15 })16 .then(() => {17 console.log('Appium session deleted');18 })19 .catch((err) => {20 console.log(err);21 });22const wd = require('webdriverio');23const options = {24 desiredCapabilities: {25 }26};27const client = wd.remote(options);28client.init()29 .then(() => {30 console.log('Appium session created');31 return client.startWdaSession();32 })33 .then((res) => {34 console.log('WDA session created');35 return client.deleteSession();36 })37 .then(() => {38 console.log('Appium session deleted');39 })40 .catch((err) => {41 console.log(err);42 });
Using AI Code Generation
1const { AppiumDriver } = require('appium-base-driver');2const caps = {3};4const driver = new AppiumDriver();5driver.createSession(caps);6const { AppiumDriver } = require('appium-base-driver');7const caps = {8};9const driver = new AppiumDriver();10driver.createSession(caps);11const { createService } = require('appium-xcuitest-driver');12const opts = {
Using AI Code Generation
1const { driver } = require('appium-xcuitest-driver');2const session = await driver.createSession({3 capabilities: {4 }5});6const service = await driver.createService({7 capabilities: {8 }9});10await driver.deleteSession();11await driver.deleteService();12await driver.deleteSessionAndService();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!