Best JavaScript code snippet using appium-xcuitest-driver
localforage.js
Source:localforage.js
1import isIndexedDBValid from './utils/isIndexedDBValid';2import isWebSQLValid from './utils/isWebSQLValid';3import isLocalStorageValid from './utils/isLocalStorageValid';4import idbDriver from './drivers/indexeddb';5import websqlDriver from './drivers/websql';6import localstorageDriver from './drivers/localstorage';7import serializer from './utils/serializer';8import Promise from './utils/promise';9import executeTwoCallbacks from './utils/executeTwoCallbacks';10// Custom drivers are stored here when `defineDriver()` is called.11// They are shared across all instances of localForage.12var CustomDrivers = {};13var DriverType = {14 INDEXEDDB: 'asyncStorage',15 LOCALSTORAGE: 'localStorageWrapper',16 WEBSQL: 'webSQLStorage'17};18var DefaultDriverOrder = [19 DriverType.INDEXEDDB,20 DriverType.WEBSQL,21 DriverType.LOCALSTORAGE22];23var LibraryMethods = [24 'clear',25 'getItem',26 'iterate',27 'key',28 'keys',29 'length',30 'removeItem',31 'setItem'32];33var DefaultConfig = {34 description: '',35 driver: DefaultDriverOrder.slice(),36 name: 'localforage',37 // Default DB size is _JUST UNDER_ 5MB, as it's the highest size38 // we can use without a prompt.39 size: 4980736,40 storeName: 'keyvaluepairs',41 version: 1.042};43var driverSupport = {};44// Check to see if IndexedDB is available and if it is the latest45// implementation; it's our preferred backend library. We use "_spec_test"46// as the name of the database because it's not the one we'll operate on,47// but it's useful to make sure its using the right spec.48// See: https://github.com/mozilla/localForage/issues/12849driverSupport[DriverType.INDEXEDDB] = isIndexedDBValid();50driverSupport[DriverType.WEBSQL] = isWebSQLValid();51driverSupport[DriverType.LOCALSTORAGE] = isLocalStorageValid();52var isArray = Array.isArray || function(arg) {53 return Object.prototype.toString.call(arg) === '[object Array]';54 };55function callWhenReady(localForageInstance, libraryMethod) {56 localForageInstance[libraryMethod] = function() {57 var _args = arguments;58 return localForageInstance.ready().then(function() {59 return localForageInstance[libraryMethod].apply(localForageInstance, _args);60 });61 };62}63function extend() {64 for (var i = 1; i < arguments.length; i++) {65 var arg = arguments[i];66 if (arg) {67 for (var key in arg) {68 if (arg.hasOwnProperty(key)) {69 if (isArray(arg[key])) {70 arguments[0][key] = arg[key].slice();71 } else {72 arguments[0][key] = arg[key];73 }74 }75 }76 }77 }78 return arguments[0];79}80function isLibraryDriver(driverName) {81 for (var driver in DriverType) {82 if (DriverType.hasOwnProperty(driver) &&83 DriverType[driver] === driverName) {84 return true;85 }86 }87 return false;88}89class LocalForage {90 constructor(options) {91 this.INDEXEDDB = DriverType.INDEXEDDB;92 this.LOCALSTORAGE = DriverType.LOCALSTORAGE;93 this.WEBSQL = DriverType.WEBSQL;94 this._defaultConfig = extend({}, DefaultConfig);95 this._config = extend({}, this._defaultConfig, options);96 this._driverSet = null;97 this._initDriver = null;98 this._ready = false;99 this._dbInfo = null;100 this._wrapLibraryMethodsWithReady();101 this.setDriver(this._config.driver);102 }103 // Set any config values for localForage; can be called anytime before104 // the first API call (e.g. `getItem`, `setItem`).105 // We loop through options so we don't overwrite existing config106 // values.107 config(options) {108 // If the options argument is an object, we use it to set values.109 // Otherwise, we return either a specified config value or all110 // config values.111 if (typeof(options) === 'object') {112 // If localforage is ready and fully initialized, we can't set113 // any new configuration values. Instead, we return an error.114 if (this._ready) {115 return new Error("Can't call config() after localforage " +116 'has been used.');117 }118 for (var i in options) {119 if (i === 'storeName') {120 options[i] = options[i].replace(/\W/g, '_');121 }122 this._config[i] = options[i];123 }124 // after all config options are set and125 // the driver option is used, try setting it126 if ('driver' in options && options.driver) {127 this.setDriver(this._config.driver);128 }129 return true;130 } else if (typeof(options) === 'string') {131 return this._config[options];132 } else {133 return this._config;134 }135 }136 // Used to define a custom driver, shared across all instances of137 // localForage.138 defineDriver(driverObject, callback, errorCallback) {139 var promise = new Promise(function(resolve, reject) {140 try {141 var driverName = driverObject._driver;142 var complianceError = new Error(143 'Custom driver not compliant; see ' +144 'https://mozilla.github.io/localForage/#definedriver'145 );146 var namingError = new Error(147 'Custom driver name already in use: ' + driverObject._driver148 );149 // A driver name should be defined and not overlap with the150 // library-defined, default drivers.151 if (!driverObject._driver) {152 reject(complianceError);153 return;154 }155 if (isLibraryDriver(driverObject._driver)) {156 reject(namingError);157 return;158 }159 var customDriverMethods = LibraryMethods.concat('_initStorage');160 for (var i = 0; i < customDriverMethods.length; i++) {161 var customDriverMethod = customDriverMethods[i];162 if (!customDriverMethod || !driverObject[customDriverMethod] ||163 typeof driverObject[customDriverMethod] !== 'function') {164 reject(complianceError);165 return;166 }167 }168 var supportPromise = Promise.resolve(true);169 if ('_support' in driverObject) {170 if (driverObject._support && typeof driverObject._support === 'function') {171 supportPromise = driverObject._support();172 } else {173 supportPromise = Promise.resolve(!!driverObject._support);174 }175 }176 supportPromise.then(function(supportResult) {177 driverSupport[driverName] = supportResult;178 CustomDrivers[driverName] = driverObject;179 resolve();180 }, reject);181 } catch (e) {182 reject(e);183 }184 });185 executeTwoCallbacks(promise, callback, errorCallback);186 return promise;187 }188 driver() {189 return this._driver || null;190 }191 getDriver(driverName, callback, errorCallback) {192 var self = this;193 var getDriverPromise = Promise.resolve().then(() => {194 if (isLibraryDriver(driverName)) {195 switch (driverName) {196 case self.INDEXEDDB:197 return idbDriver;198 case self.LOCALSTORAGE:199 return localstorageDriver;200 case self.WEBSQL:201 return websqlDriver;202 }203 } else if (CustomDrivers[driverName]) {204 return CustomDrivers[driverName];205 } else {206 throw new Error('Driver not found.');207 }208 });209 executeTwoCallbacks(getDriverPromise, callback, errorCallback);210 return getDriverPromise;211 }212 getSerializer(callback) {213 var serializerPromise = Promise.resolve(serializer);214 executeTwoCallbacks(serializerPromise, callback);215 return serializerPromise;216 }217 ready(callback) {218 var self = this;219 var promise = self._driverSet.then(() => {220 if (self._ready === null) {221 self._ready = self._initDriver();222 }223 return self._ready;224 });225 executeTwoCallbacks(promise, callback, callback);226 return promise;227 }228 setDriver(drivers, callback, errorCallback) {229 var self = this;230 if (!isArray(drivers)) {231 drivers = [drivers];232 }233 var supportedDrivers = this._getSupportedDrivers(drivers);234 function setDriverToConfig() {235 self._config.driver = self.driver();236 }237 function initDriver(supportedDrivers) {238 return function() {239 var currentDriverIndex = 0;240 function driverPromiseLoop() {241 while (currentDriverIndex < supportedDrivers.length) {242 var driverName = supportedDrivers[currentDriverIndex];243 currentDriverIndex++;244 self._dbInfo = null;245 self._ready = null;246 return self.getDriver(driverName)247 .then(driver => {248 self._extend(driver);249 setDriverToConfig();250 self._ready = self._initStorage(self._config);251 return self._ready;252 })253 .catch(driverPromiseLoop);254 }255 setDriverToConfig();256 var error = new Error('No available storage method found.');257 self._driverSet = Promise.reject(error);258 return self._driverSet;259 }260 return driverPromiseLoop();261 };262 }263 // There might be a driver initialization in progress264 // so wait for it to finish in order to avoid a possible265 // race condition to set _dbInfo266 var oldDriverSetDone = this._driverSet !== null ?267 this._driverSet.catch(() => Promise.resolve()) :268 Promise.resolve();269 this._driverSet = oldDriverSetDone.then(() => {270 var driverName = supportedDrivers[0];271 self._dbInfo = null;272 self._ready = null;273 return self.getDriver(driverName)274 .then(driver => {275 self._driver = driver._driver;276 setDriverToConfig();277 self._wrapLibraryMethodsWithReady();278 self._initDriver = initDriver(supportedDrivers);279 });280 }).catch(() => {281 setDriverToConfig();282 var error = new Error('No available storage method found.');283 self._driverSet = Promise.reject(error);284 return self._driverSet;285 });286 executeTwoCallbacks(this._driverSet, callback, errorCallback);287 return this._driverSet;288 }289 supports(driverName) {290 return !!driverSupport[driverName];291 }292 _extend(libraryMethodsAndProperties) {293 extend(this, libraryMethodsAndProperties);294 }295 _getSupportedDrivers(drivers) {296 var supportedDrivers = [];297 for (var i = 0, len = drivers.length; i < len; i++) {298 var driverName = drivers[i];299 if (this.supports(driverName)) {300 supportedDrivers.push(driverName);301 }302 }303 return supportedDrivers;304 }305 _wrapLibraryMethodsWithReady() {306 // Add a stub for each driver API method that delays the call to the307 // corresponding driver method until localForage is ready. These stubs308 // will be replaced by the driver methods as soon as the driver is309 // loaded, so there is no performance impact.310 for (var i = 0; i < LibraryMethods.length; i++) {311 callWhenReady(this, LibraryMethods[i]);312 }313 }314 createInstance(options) {315 return new LocalForage(options);316 }317}318// The actual localForage object that we expose as a module or via a319// global. It's extended by pulling in one of our other libraries....
driver.manager.js
Source:driver.manager.js
1/*2Description:The class is used to manage the assembling of the database drivers.3 The script has facilities to load extensions for generating queries provided by the user.4 In order for queryProviders to be loaded they must be placed in a folder matching the5 database type (e.g. h2 ,mysql or oracle) and be named as FILE_QT (refer variable in script below)6Filename: driver.manager.js7Created Date: 15/10/20138 */9var driverManager=function(){10 var config=require('/config/storage.json');11 var utility=require('/modules/utility.js').rxt_utility();12 var bundler=require('/modules/bundler.js').bundle_logic();13 var log=new Log('driver.manager');14 var FILE_QP='query.provider.js';15 var FILE_QT='query.translator.js';16 var FILE_DRIVER='driver.js';17 var DEFAULT_DRIVER='h2';18 var EXTENSIONS_DIR='/modules/data/extensions';19 var dsm=org.wso2.carbon.ndatasource.core.DataSourceManager;20 var DB_DRIVERS={21 MYSQL_DRIVER:{key:'jdbc:mysql',value:'mysql'},22 ORACLE_DRIVER:{key:'jdbc:oracle',value:'oracle'},23 H2_DRIVER:{key:'jdbc:h2',value:'h2'},24 UNSUPPORTED:{key:'none',value:'none'}25 };26 /*27 Paths28 */29 var defaultPath='/modules/data/';30 var driverPath=config.driverPath||'/drivers/';31 function DriverManager(){32 this.defaultBundleManager=new bundler.BundleManager({33 path:defaultPath34 });35 this.driverMap={};36 this.defaultQP=null;37 this.defaultQT=null;38 this.queryProviderMap={};39 this.dataSourceManager=new DataSourceManager();40 //Create the default which will be used to build all other drivers41 this.createDefaultDriver();42 //Load the user defined query providers from the extensions directory43 this.loadExtensions();44 }45 /*46 The function constructs a default driver based on the modules/data implementation47 */48 DriverManager.prototype.createDefaultDriver=function(){49 var defaultRootBundle=this.defaultBundleManager.getRoot();50 //Read the modules/data directory to get the default drivers51 var driverBundle=defaultRootBundle.get({name:FILE_DRIVER}).result();52 if(!driverBundle){53 throw 'unable to create default db driver';54 }55 var driver=require(defaultPath+FILE_DRIVER).driver();56 var driverInstance=new driver.DBDriver();57 //Obtain the default query providers58 var queryProviderBundle=defaultRootBundle.get({name:FILE_QP}).result();59 if(!queryProviderBundle){60 throw 'unable to create a default query provider';61 }62 this.defaultQP=require(defaultPath+FILE_QP).queryProvider();63 var queryTranslatorBundle=defaultRootBundle.get({name:FILE_QT}).result();64 if(!queryTranslatorBundle){65 throw 'unable to create default query translator';66 }67 this.defaultQT=require(defaultPath+FILE_QT).queryTranslator();68 this.driverMap[DEFAULT_DRIVER]=driverInstance;69 };70 /*71 The function loads drivers in the driver directory72 Note: Not used73 */74 DriverManager.prototype.loadDrivers=function(){75 var bundleManager=new bundler.BundleManager({76 path:driverPath77 });78 };79 /*80 The function creates a map of the query providers in the extensions folder.81 */82 DriverManager.prototype.loadExtensions=function(){83 var extensionBundleManager=new bundler.BundleManager({path:EXTENSIONS_DIR});84 //Go through each bundle in the extensions directory85 var extensionRoot=extensionBundleManager.getRoot();86 var that=this;87 //Go through each bundle88 extensionRoot.each(function(bundle){89 //Check if the bundle is a directory90 if(!bundle.isDirectory()){91 return;92 }93 handleQueryProvider(bundle,that.queryProviderMap,that);94 });95 };96 /*97 The function returns the query provider for a given driver type98 */99 DriverManager.prototype.getQueryProvider=function(driverType){100 if(!this.queryProviderMap.hasOwnProperty(driverType)){101 return null;102 }103 if(!this.queryProviderMap[driverType].hasOwnProperty('queryProvider')){104 return null;105 }106 return this.queryProviderMap[driverType]['queryProvider'];107 };108 /*109 The function is used to read a folder defining extensions for a database110 */111 function handleQueryProvider(bundle,map,dm){112 var bundleName=bundle.getName();113 var QUERY_PROVIDER='queryProvider';114 map[bundleName]={};115 var defaultObject=utility.cloneObject(dm.defaultQP);116 //Go through each bundle in the directory117 bundle.each(function(currentScript){118 //Check if the current file matches the query provider119 if(currentScript.getName()==FILE_QP){120 //Load and instaniate script121 var script=require(EXTENSIONS_DIR+'/'+bundle.getName()+'/'+currentScript.getName());122 script=script.queryProvider();123 //Override the default provider with the methods in the script124 utility.extend(defaultObject,script);125 map[bundleName][QUERY_PROVIDER]=defaultObject;126 }127 });128 }129 /*130 The function returns a database driver after calling the drivers initialize method131 @driverType: The type of driver132 @return: A driver instance133 */134 DriverManager.prototype.get=function(source){135 var queryProviderType=this.getDriver(source);136 //Set the driver type to H2137 var driverType=DEFAULT_DRIVER;138 if(!queryProviderType){139 throw 'A driver for the '+queryProviderType+' could not be found.';140 }141 //Obtain the query provider for the driver type142 var queryProvider=this.getQueryProvider(queryProviderType);143 if(!queryProvider){144 throw 'A query provider for '+queryProviderType+' could not be found.';145 }146 //log.debug('source: '+source+' provider '+stringify(queryProvider));147 //Check if the driver is supported148 if(this.driverMap.hasOwnProperty(driverType)){149 this.driverMap[driverType].init({queryProvider:queryProvider, queryTranslator:this.defaultQT});150 return this.driverMap[driverType];151 }152 log.debug('driver for '+driverType+' not found.');153 return null;154 };155 /*156 The function is used to locate a driver that supports the provided datasource157 @name: The name of a datasource to be accessed158 @return: The type of driver (e.g. h2 or mysql)159 */160 DriverManager.prototype.getDriver=function(name){161 //Obain a reference to the datasource162 var datasource=this.dataSourceManager.get(name);163 if(!datasource){164 throw 'Cannot find Datasource: '+name;165 }166 var driverType=datasource.getDriver();167 if(driverType==DB_DRIVERS.UNSUPPORTED){168 throw 'Cannot find a driver for '+name;169 }170 return driverType;171 };172 /*173 The class is used to store information on a DataSource used by a driver174 */175 function DataSource(dsObject){176 this.instance=dsObject;177 }178 /*179 The function returns the type of driver required by the datasource by looking180 at the connection url181 @return: The driver type based on the connection string.If there is no match UNSUPPORTED182 is returned.If there is no connection url the unsupported value is returned.183 */184 DataSource.prototype.getDriver=function(){185 var connectionUrl=this.instance.getUrl();186 if(!connectionUrl){187 return null;188 }189 for(var key in DB_DRIVERS){190 //Check if the url matches one of the DB_DRIVERS191 if(connectionUrl.indexOf(DB_DRIVERS[key].key)!=-1){192 return DB_DRIVERS[key].value;193 }194 }195 log.debug('driver type in '+connectionUrl+' not found.');196 return null;197 };198 /*199 The class is used to access the carbon datasources repository200 */201 function DataSourceManager(){202 this.instance=new dsm();203 }204 /*205 The function is used to obtain a reference to a datasource defined in the206 master.datasources.xml.207 @name: The name of the datasource208 @return: A DataSource object209 */210 DataSourceManager.prototype.get=function(name){211 var server = require('store').server;212 var that = this;213 var datasource = server.privileged(function() {214 return that.instance.getInstance().getDataSourceRepository().getDataSource(name);215 });216 var dsObject=datasource.getDSObject();217 //If the datasource is not found218 if(!datasource){219 return null;220 }221 return new DataSource(dsObject);222 };223 return{224 DriverManager:DriverManager,225 DataSourceManager:DataSourceManager226 }...
report.js
Source:report.js
1$(document).ready(function () {2 initGroup();3});4/***5 * åå§å页é¢6 */7function initGroup() {8 $("#selectDriverType").change(function () {9 var driverType = $("#selectDriverType").find("option:selected").text();10 $("#searchDriverType").val(driverType);11 var date = $("#searchCreateDate").val();12 getReport(driverType);13 getPieChart(date, driverType);14 getDailyReport(date, driverType);15 });16 var driverType = $("#selectDriverType").find("option:selected").text();17 getReportPeriod(driverType);18 Date.prototype.yyyymmdd = function () {19 var mm = this.getMonth() + 1; // getMonth() is zero-based20 var dd = this.getDate();21 return [this.getFullYear(),22 (mm > 9 ? '' : '0') + mm,23 (dd > 9 ? '' : '0') + dd24 ].join('-');25 };26 var date = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);27 console.log(date.yyyymmdd());28 $('#searchCreateDate').val(date.yyyymmdd());29 getDailyReport(date.yyyymmdd(), driverType);30 getPieChart(date.yyyymmdd(), driverType);31 $("#searchCreateDate").change(function () {32 var driverType = $("#selectDriverType").find("option:selected").text();33 var value = $("#searchCreateDate").val();34 getDailyReport(value, driverType);35 getPieChart(value, driverType);36 });37}38/**39 * å®æ¶è·åç³è¯·è®°å½æ°ç®40 */41function getReportPeriod(driverType) {42 getReport(driverType);43 var interval = setInterval(function () {44 getReport(driverType)45 }, 30000);46}47/**48 * æ ¹æ®date(YYYY-MM-DD)è·åæ¥æ¥è¡¨49 * @param date50 */51function getDailyReport(date, driverType) {52 $.ajax({53 url: "../report/getDailyReport",54 dataType: "json",55 type: "POST",56 async: true,57 data: {58 date: date,59 driverType: driverType60 },61 error: function (error) {62 $.gritter.add({63 title: 'æ§è¡å¤±è´¥',64 text: 'æå¡å¨å¼å¸¸',65 class_name: 'danger'66 });67 console.log(error.responseText);68 },69 success: function (e) {70 if (e.code == 0) {71 var obj = JSON.parse(e.data);72 $("#smsDaily").text(obj.smsTotalDaily);73 $("#smsSentDaily").text(obj.smsSentDaily);74 $("#submitDaily").text(obj.submitTotal);75 $("#submitRatioDaily").text(((obj.submitSuccess / obj.submitTotal) * 100).toFixed(0) + "%");76 $("#submitSuccessDaily").text(obj.submitSuccess);77 $("#strategyRatioDaily").text(((obj.strategyCount / obj.submitSuccess) * 100).toFixed(0) + "%");78 $("#strategyDaily").text(obj.strategyCount);79 $("#passRatioDaily").text(((obj.passDaily / obj.strategyCount) * 100).toFixed(0) + "%");80 $("#passDaily").text(obj.passDaily);81 } else {82 $.gritter.add({83 title: 'æ§è¡å¤±è´¥',84 text: e.msg,85 class_name: 'danger'86 });87 }88 }89 });90}91function getReport(driverType) {92 $.ajax({93 url: "../report/getReport",94 dataType: "json",95 type: "POST",96 async: true,97 data: {98 driverType: driverType99 },100 error: function (error) {101 $.gritter.add({102 title: 'æ§è¡å¤±è´¥',103 text: 'æå¡å¨å¼å¸¸',104 class_name: 'danger'105 });106 console.log(error.responseText);107 },108 success: function (e) {109 if (e.code == 0) {110 var obj = JSON.parse(e.data);111 $("#totalCount").text(obj.totalCount);112 $("#submitCount").text(obj.submitCount);113 $("#submitRatio").text(((obj.submitCount / obj.totalCount) * 100).toFixed(0) + "%");114 $("#permitCount").text(obj.permitCount);115 $("#permitRatio").text(((obj.permitCount / obj.submitCount) * 100).toFixed(0) + "%");116 $("#smsSentCount").text(obj.smsSentCount);117 } else {118 $.gritter.add({119 title: 'æ§è¡å¤±è´¥',120 text: e.msg,121 class_name: 'danger'122 });123 }124 }125 });126}127/**128 * æ ¹æ®date(YYYY-MM-DD)è·ååå åå¸é¥¼å½¢å¾129 * @param date130 */131function getPieChart(date, driverType) {132 $.ajax({133 url: "../report/getPieChart",134 dataType: "json",135 type: "POST",136 async: true,137 data: {138 date: date,139 driverType: driverType140 },141 error: function (error) {142 $.gritter.add({143 title: 'æ§è¡å¤±è´¥',144 text: 'æå¡å¨å¼å¸¸',145 class_name: 'danger'146 });147 console.log(error.responseText);148 },149 success: function (e) {150 if (e.code == 0) {151 var obj = JSON.parse(e.data);152 // var data = [];153 // for(i in obj) {154 // data.push({"name":i,"y":obj[i]});155 // }156 setPieChart(obj, date);157 } else {158 $.gritter.add({159 title: 'æ§è¡å¤±è´¥',160 text: e.msg,161 class_name: 'danger'162 });163 }164 }165 });166}167function setPieChart(data, date) {168 Highcharts.chart('pieChart', {169 chart: {170 plotBackgroundColor: null,171 plotBorderWidth: null,172 plotShadow: false,173 type: 'pie'174 },175 title: {176 text: date + ' ä¸éè¿åå åå¸'177 },178 tooltip: {179 pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' +180 '<br>æ°é: <b>{point.y:.0f}</b>'181 },182 plotOptions: {183 pie: {184 allowPointSelect: true,185 cursor: 'pointer',186 dataLabels: {187 enabled: true,188 format: '<b>{point.name}</b>: {point.percentage:.1f} %',189 style: {190 color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'191 }192 }193 }194 },195 series: [{196 name: 'å æ¯',197 colorByPoint: true,198 data: data199 }]200 });...
fits-change-driver-set.js
Source:fits-change-driver-set.js
1'use strict';2module.exports = function(sequelize, DataTypes) {3 return sequelize.define('FitsChangeDriverSet', {4 iD: {5 type: DataTypes.INTEGER,6 field: 'ID',7 allowNull: false,8 primaryKey: true,9 autoIncrement: true10 }11 }, {12 schema: 'public',13 tableName: 'FitsChangeDriverSet',14 timestamps: false15 });16};17module.exports.initRelations = function() {18 delete module.exports.initRelations; // Destroy itself to prevent repeated calls.19 var model = require('../index');20 var FitsChangeDriverSet = model.FitsChangeDriverSet;21 var DepartmentFitsChangeDriverSet = model.DepartmentFitsChangeDriverSet;22 var FitsChangeDriverSetFitsChangeDriverType = model.FitsChangeDriverSetFitsChangeDriverType;23 var Department = model.Department;24 var FitsChangeDriverType = model.FitsChangeDriverType;25 FitsChangeDriverSet.hasMany(DepartmentFitsChangeDriverSet, {26 as: 'FKDepartmentfitschangedriversetFitschangedriverset1s',27 foreignKey: 'FitsChangeDriverSetID',28 onDelete: 'NO ACTION',29 onUpdate: 'NO ACTION'30 });31 FitsChangeDriverSet.hasMany(FitsChangeDriverSetFitsChangeDriverType, {32 as: 'FKFitschangedriversetfitschangedrivertypeFitschangedriversets',33 foreignKey: 'FitsChangeDriverSetId',34 onDelete: 'NO ACTION',35 onUpdate: 'NO ACTION'36 });37 FitsChangeDriverSet.belongsToMany(Department, {38 as: 'DepartmentFitsChangeDriverSetDepartments',39 through: DepartmentFitsChangeDriverSet,40 foreignKey: 'FitsChangeDriverSetID',41 otherKey: 'DepartmentID',42 onDelete: 'NO ACTION',43 onUpdate: 'NO ACTION'44 });45 FitsChangeDriverSet.belongsToMany(FitsChangeDriverType, {46 as: 'FitsChangeDriverSetFitsChangeDriverTypeFitsChangeDriverTypes',47 through: FitsChangeDriverSetFitsChangeDriverType,48 foreignKey: 'FitsChangeDriverSetId',49 otherKey: 'FitsChangeDriverTypeId',50 onDelete: 'NO ACTION',51 onUpdate: 'NO ACTION'52 });...
fits-change-driver-set-fits-change-driver-type.js
Source:fits-change-driver-set-fits-change-driver-type.js
1'use strict';2module.exports = function(sequelize, DataTypes) {3 return sequelize.define('FitsChangeDriverSetFitsChangeDriverType', {4 iD: {5 type: DataTypes.INTEGER,6 field: 'ID',7 allowNull: false,8 primaryKey: true,9 autoIncrement: true10 },11 fitsChangeDriverSetId: {12 type: DataTypes.INTEGER,13 field: 'FitsChangeDriverSetId',14 allowNull: false,15 references: {16 model: 'FitsChangeDriverSet',17 key: 'ID'18 },19 onUpdate: 'NO ACTION',20 onDelete: 'NO ACTION'21 },22 fitsChangeDriverTypeId: {23 type: DataTypes.INTEGER,24 field: 'FitsChangeDriverTypeId',25 allowNull: false,26 references: {27 model: 'FitsChangeDriverType',28 key: 'ID'29 },30 onUpdate: 'NO ACTION',31 onDelete: 'NO ACTION'32 }33 }, {34 schema: 'public',35 tableName: 'FitsChangeDriverSetFitsChangeDriverType',36 timestamps: false37 });38};39module.exports.initRelations = function() {40 delete module.exports.initRelations; // Destroy itself to prevent repeated calls.41 var model = require('../index');42 var FitsChangeDriverSetFitsChangeDriverType = model.FitsChangeDriverSetFitsChangeDriverType;43 var FitsChangeDriverSet = model.FitsChangeDriverSet;44 var FitsChangeDriverType = model.FitsChangeDriverType;45 FitsChangeDriverSetFitsChangeDriverType.belongsTo(FitsChangeDriverSet, {46 as: 'FitsChangeDriverSet',47 foreignKey: 'FitsChangeDriverSetId',48 onDelete: 'NO ACTION',49 onUpdate: 'NO ACTION'50 });51 FitsChangeDriverSetFitsChangeDriverType.belongsTo(FitsChangeDriverType, {52 as: 'FitsChangeDriverType',53 foreignKey: 'FitsChangeDriverTypeId',54 onDelete: 'NO ACTION',55 onUpdate: 'NO ACTION'56 });...
fits-change-driver-type.js
Source:fits-change-driver-type.js
1'use strict';2module.exports = function(sequelize, DataTypes) {3 return sequelize.define('FitsChangeDriverType', {4 iD: {5 type: DataTypes.INTEGER,6 field: 'ID',7 allowNull: false,8 primaryKey: true,9 autoIncrement: true10 },11 name: {12 type: DataTypes.STRING(50),13 field: 'Name',14 allowNull: false15 },16 active: {17 type: DataTypes.BOOLEAN,18 field: 'Active',19 allowNull: false20 }21 }, {22 schema: 'public',23 tableName: 'FitsChangeDriverType',24 timestamps: false25 });26};27module.exports.initRelations = function() {28 delete module.exports.initRelations; // Destroy itself to prevent repeated calls.29 var model = require('../index');30 var FitsChangeDriverType = model.FitsChangeDriverType;31 var FitsChangeDriverSetFitsChangeDriverType = model.FitsChangeDriverSetFitsChangeDriverType;32 var FitsChangeDriverSet = model.FitsChangeDriverSet;33 FitsChangeDriverType.hasMany(FitsChangeDriverSetFitsChangeDriverType, {34 as: 'FKFitschangedriversetfitschangedrivertypeFitschangedrivertypes',35 foreignKey: 'FitsChangeDriverTypeId',36 onDelete: 'NO ACTION',37 onUpdate: 'NO ACTION'38 });39 FitsChangeDriverType.belongsToMany(FitsChangeDriverSet, {40 as: 'FitsChangeDriverSetFitsChangeDriverTypeFitsChangeDriverSets',41 through: FitsChangeDriverSetFitsChangeDriverType,42 foreignKey: 'FitsChangeDriverTypeId',43 otherKey: 'FitsChangeDriverSetId',44 onDelete: 'NO ACTION',45 onUpdate: 'NO ACTION'46 });...
resource-unit-driver-type-filter.js
Source:resource-unit-driver-type-filter.js
1'use strict';2angular.module('peApp').filter('resourceUnitDriverType', ['ListFilterSummary', function (ListFilterSummary) {3 return function (items, filterSettings) {4 if (!items || !filterSettings) {5 return null;6 } 7 /// === variables === ///8 var driverTypeSummary = new ListFilterSummary(filterSettings.driverType);9 var isMatch = function (item) {10 if (!filterSettings.includeAllDrivers)11 if (item.plannerIdentityID != filterSettings.plannerId)12 return false;13 if (driverTypeSummary.shouldCheck) {14 if (!_.contains(driverTypeSummary.toCheck, item.driverType)) return false;15 }16 return true;17 };18 /// === filtering === ///19 return _.filter(items, isMatch);20 }...
group__mci__driver__strength__ctrls.js
Source:group__mci__driver__strength__ctrls.js
1var group__mci__driver__strength__ctrls =2[3 [ "ARM_MCI_DRIVER_TYPE_A", "group__mci__driver__strength__ctrls.html#ga64eb1c4847711a262f084c361b60a912", null ],4 [ "ARM_MCI_DRIVER_TYPE_B", "group__mci__driver__strength__ctrls.html#ga078d3c3bc7c9335b92e6445a0abafc46", null ],5 [ "ARM_MCI_DRIVER_TYPE_C", "group__mci__driver__strength__ctrls.html#ga3da11696d1fcd3930eb7e70fe097d747", null ],6 [ "ARM_MCI_DRIVER_TYPE_D", "group__mci__driver__strength__ctrls.html#ga8185f82b1d8857a3f0eb461d664f2b3d", null ]...
Using AI Code Generation
1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .element('#TextField1')9 .then(function(el) {10 return el.setValue('Hello World!');11 })12 .end();13var webdriverio = require('webdriverio');14var options = {15 desiredCapabilities: {16 }17};18 .remote(options)19 .init()20 .execute('mobile: type', {element: 'TextField1', text: 'Hello World!'})21 .end();
Using AI Code Generation
1(async () => {2 const driver = await wdio.remote({3 capabilities: {4 },5 });6 await driver.pause(5000);
Using AI Code Generation
1const {remote} = require('webdriverio');2const caps = {3};4(async () => {5 const client = await remote({6 });7 await elem.setValue('Hello');8 await client.deleteSession();9})();10const {remote} = require('webdriverio');11const caps = {12};13(async () => {14 const client = await remote({15 });16 await elem.setValue('Hello');17 await client.deleteSession();18})();19const {remote} = require('webdriverio');20const caps = {21};22(async () => {23 const client = await remote({24 });25 await elem.setValue('Hello');26 await client.deleteSession();27})();28const {remote} = require('webdriverio');29const caps = {30};31(async () => {
Using AI Code Generation
1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder()3 .withCapabilities({4 })5 .build();6driver.findElement(webdriver.By.accessibilityId('General')).click();7driver.findElement(webdriver.By.accessibilityId('About')).click();8 console.log(text);9 driver.quit();10});11driver.findElement(webdriver.By.accessibilityId('General')).click();12driver.findElement(webdriver.By.accessibilityId('About')).click();13 console.log(text);14 driver.quit();15});16driver.findElement(webdriver.By.accessibilityId('General')).click();17driver.findElement(webdriver.By.accessibilityId('About')).click();18 console.log(text);19 driver.quit();20});21driver.findElement(webdriver.By.accessibilityId('General')).click();22driver.findElement(webdriver.By.accessibilityId('About')).click();23 console.log(text);24 driver.quit();25});26driver.findElement(webdriver.By.accessibilityId('General')).click();27driver.findElement(web
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!!