How to use dtls method in wpt

Best JavaScript code snippet using wpt

AirportAlternateAirportsController.js

Source:AirportAlternateAirportsController.js Github

copy

Full Screen

1app.controller("AirportAlternateAirportsController", ['$scope', '$http', '$location', 'ngEncryption', '$rootScope', '$route', '$linq', '$filter', 'DataService', '$confirm', '$timeout',2function ($scope, $http, $location, ngEncryption, $rootScope, $route, $linq, $filter, DataService, $confirm, $timeout) {3 $scope.openModuleChange = function () {4 $location.path('/Airport')5 }6 $scope.resizeModuleSub = function () {7 $rootScope.$broadcast('resizeModuleSubChild');8 }9 window.onresize = $scope.resizeModuleSub;10 $scope.HideValidationDiv = function () {11 angular.element('#idReqValidation').hide();12 angular.element('#errorid').hide();13 angular.element('#formerrorid').hide();14 }15 function isEmpty(val) {16 return (val === undefined || val == null || val.length <= 0 || val == "") ? true : false;17 }18 onLoad();19 function onLoad() {20 $scope.AlternateAirportDtls = {};21 $scope.AlternateAirportList = [];22 $scope.AlternateAirportDtls.AirportAltId = 0;23 $("#txtalternateairport").focus();24 $scope.NotActiveFlag = false;25 $scope.IsOnEditDetail = false;26 $scope.GetRecordStatus = "Active";27 $scope.AirportId = DataService.GetServiceData();28 angular.element('#success').hide();29 BindAlternateAirportDtls();30 }31 $scope.rdBtnChange = function (value) {32 if (value == 'Deleted' || value == 'All') {33 $scope.NotActiveFlag = true;34 }35 else {36 $scope.NotActiveFlag = false;37 }38 $scope.GetRecordStatus = value;39 $scope.AlternateAirportDtls = {};40 $scope.HideValidationDiv();41 $scope.SuccessMsg = '';42 angular.element('#success').hide();43 $scope.AlternateAirportList = [];44 $scope.AlternateAirportDtls.AirportAltId = 0;45 $("#txtalternateairport").focus();46 BindAlternateAirportDtls();47 }48 $scope.NewId = "IdAlternateAirportGD";49 function BindAlternateAirportDtls() {50 $scope.IsPagerVisible = false;51 $scope.Height = "200";52 $scope.sorting = true;53 $scope.VirtualMode = false;54 $scope.AlternateAirportList.PageSize = "10";55 $scope.ColumnList = [56 {57 dataField: "AltAirportId", allowSorting: true, caption: "Alternate Airport", cellTemplate: function myfunction(container, options) {58 $('<a/>').addClass('dx-link')59 .text(options.data.AltAirportId)60 .on('dxclick', function () {61 $scope.EditAlternateAirportDtls(options.data.AirportAltId);62 })63 .appendTo(container);64 }65 },66 {67 dataField: "Selected", allowSorting: true, caption: "Selected"68 },69 ];70 $scope.SummaryInfo = [{71 showInColumn: "Selected",72 summaryType: "count",73 displayFormat: "Total Count(s): {0}",74 alignByColumn: true,75 showInGroupFooter: true76 }];77 var ReqObj = {78 "AirportId": $scope.AirportId,79 "AirportAltId": $scope.AlternateAirportDtls.AirportAltId,80 "GetRecordStatus": $scope.GetRecordStatus81 };82 var data = ngEncryption.encrypt(JSON.stringify(ReqObj));83 var requestcombo = $http({84 method: "GET",85 url: "api/Airport/GetAlternateAirportList",86 params: {87 RequestText: data88 }89 }).then(function successresult(successdata) {90 if (successdata.status != "202") {91 if (!isEmpty(successdata.data) && successdata.data.length > 0) {92 var obj = JSON.parse(successdata.data);93 if ($scope.AlternateAirportDtls.AirportAltId == 0) {94 $scope.AlternateAirportList = $linq.Enumerable().From(obj)95 .Select(function (x) {96 if (x.Selected != "Y")97 x.Selected = "N";98 return x;99 }).ToArray();100 $scope.resizeModuleSub();101 $scope.$broadcast('DataSourceUpdate', $scope.AlternateAirportList);102 OnAdd();103 }104 else {105 $scope.AlternateAirportDtls = angular.copy(obj[0]);106 $scope.AlternateAirportDtls.Mode = "Edit";107 $("#chkbSelect").focus();108 } 109 }110 else {111 $scope.$broadcast('DataSourceUpdate', []);112 OnAdd();113 }114 ControlEnableDisableBasedonStatus($scope.AlternateAirportDtls.Mode);115 }116 else {117 $scope.ErrorMsg = successdata.data;118 }119 }, function myfunction() {120 });121 }122 function ControlEnableDisableBasedonStatus(Mode) {123 if ($scope.GetRecordStatus != "Active") {124 $("#ImgAdd").addClass('disabled');125 $("#ImgSave").addClass('disabled');126 $("#ImgDelete").addClass('disabled');127 $scope.IsOnEditDetail = true;128 }129 else if ($scope.GetRecordStatus == "Active" && Mode == "Edit") {130 $("#ImgAdd").removeClass('disabled');131 $("#ImgSave").removeClass('disabled');132 $("#ImgDelete").removeClass('disabled');133 $scope.IsOnEditDetail = true;134 $timeout(function myfunction() {135 $("#txtalternateairport").focus();136 }, 0);137 }138 else if ($scope.GetRecordStatus == "Active" && Mode == "Add") {139 $("#ImgAdd").removeClass('disabled');140 $("#ImgSave").removeClass('disabled');141 $("#ImgDelete").addClass('disabled');142 $scope.IsOnEditDetail = false;143 $timeout(function myfunction() {144 $("#txtalternateairport").focus();145 }, 0);146 }147 else {148 $("#ImgAdd").removeClass('disabled');149 $("#ImgSave").removeClass('disabled');150 $("#ImgDelete").addClass('disabled');151 $scope.IsOnEditDetail = false;152 $timeout(function myfunction() {153 $("#txtalternateairport").focus();154 }, 0);155 }156 }157 $scope.AddAlternateAirportDtls = function () {158 $scope.ErrorMsg = "";159 $scope.HideValidationDiv();160 angular.element('#success').hide();161 OnAdd();162 }163 function OnAdd() {164 $scope.AlternateAirportDtls = {};165 $scope.AlternateAirportDtls.Mode = "Add";166 $timeout(function myfunction() {167 $("#txtalternateairport").focus();168 }, 0);169 $scope.IsOnEditDetail = false;170 $("#ImgSave").removeClass('disabled');171 $("#ImgDelete").addClass('disabled');172 $scope.FinalObjAirportId = [];173 }174 //For Airport Auto-suggestion175 $scope.FinalObjAirportId = [];176 $scope.SearchAirportAutoSuggest = function (value) {177 if (value != undefined && value != '' && value != null) {178 var FinalObj = [];179 var CheckDataIsExist = $linq.Enumerable().From($scope.FinalObjAirportId)180 .Where(function (x) {181 return (strStartsWith(x.Name, value));182 })183 .Select(function (x) {184 return x;185 }).ToArray();186 if (CheckDataIsExist.length == 0) {187188 var objAirportId = {189 "AirportId": value190 };191 var data = ngEncryption.encrypt(JSON.stringify(objAirportId));192 return $http({193 method: "POST",194 url: "/api/AddItinerary/AirportSearch",195 params: {196 AirportSearch: data197 }198 }).then(function (response) {199 FinalObj = JSON.parse(response.data);200 if ($("#txtalternateairport").keydown(function () {201 }));202 else {203 }204 $scope.FinalObjAirportId = FinalObj;205206 return FinalObj;207 });208 }209 else {210211 FinalObj = CheckDataIsExist;212 return FinalObj;213 }214 }215 }216217 function strStartsWith(str, prefix) {218 if (((str + "").toLowerCase().indexOf(prefix.toLowerCase()) === 0) == true) {219 return str;220 };221 }222223 $scope.onSelectAirport = function myfunction($item) {224 if ($item.AirportId != 'No matches found') {225 $scope.AlternateAirportDtls.AltAirportId = $item.AirportId; 226 }227 };228 $scope.CheckAirportId = function () { 229 if (isEmpty($scope.FinalObjAirportId) || (!isEmpty($scope.AlternateAirportDtls) && (!isEmpty($scope.AlternateAirportDtls.AltAirportId) && $scope.AlternateAirportDtls.AltAirportId.length <= 4))) {230 if (!isEmpty($scope.FinalObjAirportId)) {231 var CheckDataIsExist = $linq.Enumerable().From($scope.FinalObjAirportId)232 .Where(function (x) {233 return (x.AirportId == $scope.AlternateAirportDtls.AltAirportId);234 })235 .Select(function (x) {236 return x;237 }).ToArray();238 if (CheckDataIsExist.length == 0) {239 $scope.AlternateAirportDtls.AltAirportId = undefined;240 }241 else242 {243 $scope.FinalObjAirportId = [];244 }245 }246 else {247 $scope.AlternateAirportDtls.AltAirportId = undefined;248 }249250 }251 }252 $scope.EditAlternateAirportDtls = function (AirportAltId) {253 $scope.ErrorMsg = "";254 $scope.HideValidationDiv();255 angular.element('#success').hide();256 $("#txtalternateairport").focus();257 $scope.IsOnEditDetail = true;258 $("#ImgSave").removeClass('disabled');259 $("#ImgDelete").removeClass('disabled');260 $scope.AlternateAirportDtls.AirportAltId = AirportAltId;261 $scope.AlternateAirportDtls.Mode = "Edit";262 BindAlternateAirportDtls();263 }264 $scope.DeleteAlternateAirportDtls = function () {265 $scope.ErrorMsg = "";266 angular.element('#success').hide();267 $scope.HideValidationDiv();268 $confirm({ text: 'Are you sure you want to Delete this record?', title: 'Delete', ok: 'Yes', cancel: 'No' })269 .then(function (yes) {270 $scope.AlternateAirportDtls.Mode = "Delete";271 $scope.SaveAlternateAirportDtls();272 }, function (no) {273 return;274 });275 }276 $scope.SaveAlternateAirportDtls = function () {277 $scope.ErrorMsg = "";278 $scope.HideValidationDiv();279 angular.element('#success').hide();280 if (isEmpty($scope.AlternateAirportDtls.AltAirportId)) {281 angular.element('#formerrorid').show();282 }283 if ($scope.AirportAlternateAirportsForm.$valid || $scope.AlternateAirportDtls.Mode == "Delete") {284 if (isEmpty($scope.AlternateAirportDtls.AltAirportId)) {285 $scope.AlternateAirportDtls.Mode = "Add";286 }287 if ($scope.ErrorMsg != "")288 return;289 var ReqObj =290 {291 "AirportAltId": $scope.AlternateAirportDtls.AirportAltId,292 "AirportId": DataService.GetServiceData(),293 "AltAirportId": $scope.AlternateAirportDtls.AltAirportId,294 "Selected": !isEmpty($scope.AlternateAirportDtls.Selected) ? $scope.AlternateAirportDtls.Selected : 'N',295 "Mode": $scope.AlternateAirportDtls.Mode,296 "ModifiedOn": $scope.AlternateAirportDtls.ModifiedOn297 };298 var data = ngEncryption.encrypt(JSON.stringify(ReqObj));299 var requestCombo = $http({300 method: "POST",301 url: "api/Airport/TransAlternateAirport",302 params: { "RequestText": data }303 }).then(function successResult(successData) {304 if (successData.status != "202") {305 if (!isEmpty(successData.data) && successData.data.length > 0) {306 var obj = JSON.parse(successData.data);307 $scope.IsOnEditDetail = false;308 if ($scope.AlternateAirportDtls.Mode == "Add" || $scope.AlternateAirportDtls.Mode == "Edit") {309 $scope.addClass = 'success';310 $scope.SuccessMsg = "Record Saved Successfully.";311 angular.element('#success').show();312 }313 else {314 $scope.addClass = 'deletedmsg';315 $scope.SuccessMsg = "Record deleted successfully.";316 angular.element('#success').show();317 }318 $scope.AlternateAirportList = $linq.Enumerable().From(obj)319 .Select(function (x) {320 if (x.Selected != "Y")321 x.Selected = "N";322 return x;323 }).ToArray();324 $scope.resizeModuleSub();325 $scope.$broadcast('DataSourceUpdate', $scope.AlternateAirportList);326 $timeout(function () {327 $scope.AlternateAirportDtls = angular.copy($scope.AlternateAirportList[0]);328 if (!isEmpty($scope.AlternateAirportList[0])) {329 $scope.IsOnEditDetail = true;330 $scope.AlternateAirportDtls.Mode = "Edit";331 if ($scope.AlternateAirportDtls.Selected != "Y")332 $scope.AlternateAirportDtls.Selected = "N"; 333 $("#chkbSelect").focus();334 $("#ImgSave").removeClass('disabled');335 $("#ImgDelete").removeClass('disabled');336 }337 else {338 OnAdd();339 }340 }, 0);341 }342 else {343 if ($scope.AlternateAirportDtls.Mode == "Delete") {344 $scope.addClass = 'deletedmsg';345 $scope.SuccessMsg = "Record deleted successfully.";346 angular.element('#success').show();347 $("#ImgDelete").addClass('disabled');348 }349 $scope.AlternateAirportList = [];350 $scope.resizeModuleSub();351 $scope.$broadcast('DataSourceUpdate', $scope.AlternateAirportList);352 OnAdd();353 }354 ControlEnableDisableBasedonStatus($scope.AlternateAirportDtls.Mode);355 }356 else {357 $scope.ErrorMsg = successData.data;358 angular.element('#idReqValidation').show();359 angular.element('#errorid').show();360 }361 }, function myfunction() {362 });363 }364 else {365 angular.element('#idReqValidation').show();366 angular.element('#errorid').show();367 angular.element('#formerrorid').show();368 }369 } ...

Full Screen

Full Screen

CourierDelayController.js

Source:CourierDelayController.js Github

copy

Full Screen

1app.controller("CourierDelayController", ['$scope', '$http', '$location', 'ngEncryption', 'DataService', '$filter', '$rootScope', '$linq', '$confirm', '$modal',2 function ($scope, $http, $location, ngEncryption, DataService, $filter, $rootScope, $linq, $confirm, $modal) {3 $scope.IsPagerVisible = true;4 $scope.openModuleChange = function () {5 $location.path('/Courier')6 }7 $scope.resizeModuleSub = function () {8 $rootScope.$broadcast('resizeModuleSubChild');9 }10 window.onresize = $scope.resizeModuleSub;11 $scope.HideValidationDiv = function () {12 angular.element('#idReqValidation').hide();13 angular.element('#errorid').hide();14 angular.element('#formerrorid').hide();15 }1617 function isEmpty(val) {18 return (val === undefined || val == null || val.length <= 0 || val == "") ? true : false;19 }20 $scope.BindCourierDelay = function () {21 $scope.ErrorMsg = "";22 angular.element('#success').hide();23 if (isEmpty($scope.CourierDelayDtls.ValidFrom) || isEmpty($scope.CourierDelayDtls.ValidTo)) {24 angular.element('#idReqValidation').show();25 angular.element("#errorid").show();26 $scope.CourierDelayList = [];27 $scope.resizeModuleSub();28 $scope.$broadcast('DataSourceUpdate', $scope.CourierDelayList);29 return false;30 }3132 if ($scope.ErrorMsg != "")33 return;34 $scope.NewId = "IdCourierDelayGD";35 $scope.PageSize = 100; 36 $scope.NewId = "IdCourierAlertGD";37 $scope.Height = "250";38 $scope.sorting = true;39 $scope.VirtualMode = false;40 $scope.ColumnList = [4142 {43 dataField: "JobId", allowSorting: true, caption: "Job #", width: "100",44 },45 {46 dataField: "SchpuDttm", allowSorting: true, caption: "Schedule Time", width: "150",47 },48 {49 dataField: "ActpuDttm", allowSorting: true, caption: "ActualTime", width: "150",50 },51 {52 dataField: "DelayTime", allowSorting: true, caption: "Delay Time", width: "100",53 },54 {55 dataField: "Note", allowSorting: true, caption: "Note", cssClass: "wraplabelDXGrid",56 },57 ];58 var ReqObj = {59 "CourierId": $scope.CourierId,60 "ValidFrom": $scope.CourierDelayDtls.ValidFrom,61 "ValidTo": $scope.CourierDelayDtls.ValidTo62 };6364 var data = ngEncryption.encrypt(JSON.stringify(ReqObj));65 var requestCombo = $http({66 method: "POST",67 url: "api/Courier/GetCourierDelayDetails",68 params: { "RequestText": data }69 }).then(function successresult(successdata) {70 if (successdata.status != "202") {71 if (!isEmpty(successdata.data) && successdata.data.length > 0) {72 var obj = JSON.parse(successdata.data);73 if (!isEmpty(obj) && !isEmpty(obj[0].JobId)) {74 $scope.CourierDelayList = $linq.Enumerable().From(obj)75 .Select(function (x) {76 x.ActpuDttm = !isEmpty(x.ActpuDttm) ? x.ActpuDttm : "01/01/0001 12:00:00 AM";77 x.DelayTime = isEmpty(x.DelayTime) ? 0 : x.DelayTime;78 return x;79 }).ToArray();8081 if (isEmpty($scope.CourierDelayList[0].QualityIdx)) {82 $scope.CourierDelayDtls.QualityIdx = 0;83 }84 else {85 $scope.CourierDelayDtls.QualityIdx = $scope.CourierDelayList[0].QualityIdx;86 }8788 $scope.$broadcast('DataSourceUpdate', $scope.CourierDelayList);8990 }9192 else {93 if (!isEmpty(obj) && !isEmpty(obj[0].QualityIdx)) {94 $scope.CourierDelayDtls.QualityIdx = obj[0].QualityIdx;95 }96 else {97 $scope.CourierDelayDtls.QualityIdx = 0;98 }99 $scope.CourierDelayList = [];100 $scope.$broadcast('DataSourceUpdate', $scope.CourierDelayList);101 }102 $scope.resizeModuleSub();103 }104 else {105 $scope.CourierDelayList = [];106 if (isEmpty($scope.CourierDelayDtls.QualityIdx)) {107 $scope.CourierDelayDtls.QualityIdx = 0;108 }109 $scope.$broadcast('DataSourceUpdate', $scope.CourierDelayList);110111 }112 }113 else {114 $scope.ErrorMsg = successdata.data;115 }116 }117 )118 }119 $scope.onLoad = function (value) {120 var QualityId = value == 'reset' && !isEmpty($scope.CourierDelayDtls) && !isEmpty($scope.CourierDelayDtls.QualityIdx) ? $scope.CourierDelayDtls.QualityIdx : 0;121 $scope.CourierDelayDtls = {};122 $scope.CourierDelayList = [];123 $scope.$broadcast('DataSourceUpdate', $scope.CourierDelayList);124 $scope.CourierId = DataService.GetServiceData();125 $scope.CourierDelayDtls.QualityIdx = !isEmpty(QualityId) ? QualityId : 0;126 var today = new Date();127 var priorDate = new Date().setDate(today.getDate() - 30);128 $scope.CourierDelayDtls.ValidTo = $filter('date')(today, "MM/dd/yyyy");129 $scope.CourierDelayDtls.ValidFrom = $filter('date')(priorDate, "MM/dd/yyyy");130131 if (value != 'reset') {132 $scope.BindCourierDelay();133 }134 }135 $scope.onLoad();136 $scope.ChangeQualityIdx = function () {137 if (isEmpty($scope.CourierDelayDtls.QualityIdx)) {138 $scope.CourierDelayDtls.QualityIdx = 0;139 }140 if ($scope.CourierDelayDtls.QualityIdx > 100) {141 $scope.CourierDelayDtls.QualityIdx = 100;142 }143 }144 $scope.UpdateCourierRating = function () {145 $scope.ErrorMsg = "";146 if (isEmpty($scope.CourierDelayDtls.QualityIdx)) {147 $scope.CourierDelayDtls.QualityIdx = 0;148 }149 if ($scope.CourierDelayDtls.QualityIdx > 100) {150 $scope.CourierDelayDtls.QualityIdx = 100;151 }152 var ReqObj =153 {154 "CourierId": $scope.CourierId,155 "QualityIdx": $scope.CourierDelayDtls.QualityIdx156 };157 var data = ngEncryption.encrypt(JSON.stringify(ReqObj));158 var requestCombo = $http({159 method: "POST",160 url: "api/Courier/TransCourierUpdateRating",161 params: { "RequestText": data }162 }).then(function successResult(successData) {163 if (successData.status != "202") {164 $scope.addClass = 'success';165 $scope.SuccessMsg = "Rating Updated Successfully.";166 angular.element('#success').show();167 }168 else {169 $scope.ErrorMsg = successData.data;170 }171 })172 } ...

Full Screen

Full Screen

session.detail.component.test.js

Source:session.detail.component.test.js Github

copy

Full Screen

1(function() {2 'use strict';3 let session = {4 pa2 :0,5 p1 :10000,6 no :'node',7 pa1 :1,8 p2 :2948,9 pr :17,10 lp :0,11 fp :0,12 a1 :16843009,13 a2 :33686018,14 pa :1,15 db1 :437,16 db2 :0,17 by :445,18 by2 :0,19 by1 :445,20 db :437,21 index :'sessions-',22 id :'sessionid'23 };24 let userSettings = {25 timezone : 'local',26 detailFormat : 'last',27 showTimestamps : 'last',28 sortColumn : 'start',29 sortDirection : 'asc',30 spiGraph : 'no',31 connSrcField : 'a1',32 connDstField : 'ip.dst:port',33 numPackets : 'last'34 };35 describe('Session Detail Component ->', function() {36 // load the module37 beforeEach(angular.mock.module('moloch'));38 let scope, sessionDtlsComponent, $httpBackend, templateAsHtml;39 let sessionDtlsEndpoint = 'node/session/sessionid/detail';40 let configEndpoint = 'molochRightClick';41 let fieldEndpoint = 'fields';42 let decodingsEndpoint = 'decodings';43 // Initialize and a mock scope44 beforeEach(inject(function(45 _$httpBackend_,46 $compile,47 $sce,48 SessionService,49 ConfigService,50 FieldService,51 $controller,52 $rootScope) {53 $httpBackend = _$httpBackend_;54 // query for user settings55 $httpBackend.expectGET('user/settings')56 .respond(200, userSettings);57 // initial query for session detail58 $httpBackend.expectGET(sessionDtlsEndpoint)59 .respond(200, '');60 // query for moloch clickable values61 $httpBackend.expectGET(configEndpoint)62 .respond(200, {});63 // query for moloch fields64 $httpBackend.expectGET(fieldEndpoint)65 .respond(200, {});66 // query for other decodings67 $httpBackend.expectGET(decodingsEndpoint)68 .respond(200, {});69 scope = $rootScope.$new();70 scope.session = session;71 let htmlString = '<session-detail session="session"></session-detail>';72 let element = angular.element(htmlString);73 let template = $compile(element)(scope);74 scope.$digest();75 sessionDtlsComponent = element.controller('sessionDetail');76 templateAsHtml = template.html();77 spyOn(sessionDtlsComponent.$scope, '$emit').and.callThrough();78 $httpBackend.flush();79 }));80 afterEach(function() {81 $httpBackend.verifyNoOutstandingExpectation();82 $httpBackend.verifyNoOutstandingRequest();83 });84 it('should render html with session info', function() {85 expect(templateAsHtml).toBeDefined();86 expect(scope.session).toBeDefined();87 });88 it('should issue query for all sessions with new start time', function() {89 sessionDtlsComponent.allSessions('rootId', 0);90 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalled();91 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalledWith('add:to:search',92 {expression:'rootId == "rootId"' });93 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalled();94 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalledWith('change:time',95 { start:0 });96 });97 it('should issue query for all sessions with current start time', function() {98 sessionDtlsComponent.allSessions('rootId', 1476102172);99 sessionDtlsComponent.$routeParams.startTime = 1476102173;100 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalled();101 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalledWith('add:to:search',102 { expression:'rootId == "rootId"' });103 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalled();104 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalledWith('change:time',105 { start:1476102172 });106 });107 it('should issue query for all sessions with "-" in rootId', function() {108 sessionDtlsComponent.allSessions('rootId-1234567890', 0);109 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalled();110 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalledWith('add:to:search',111 { expression:'rootId == "rootId-1234567890"' });112 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalled();113 expect(sessionDtlsComponent.$scope.$emit).toHaveBeenCalledWith('change:time',114 { start:0 });115 });116 it('should set promise for packet request', function() {117 sessionDtlsComponent.getPackets();118 expect(sessionDtlsComponent.packetPromise).toBeDefined();119 expect(sessionDtlsComponent.packetPromise).not.toBeNull();120 });121 it('should cancel a query for packets', function() {122 sessionDtlsComponent.getPackets();123 expect(sessionDtlsComponent.packetPromise).toBeDefined();124 expect(sessionDtlsComponent.packetPromise).not.toBeNull();125 sessionDtlsComponent.cancelPacketLoad();126 expect(sessionDtlsComponent.packetPromise).toBeNull();127 });128 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var page = wptools.page('Albert Einstein');3page.get(function(err, info) {4 if(err) {5 console.log(err);6 } else {7 console.log(info);8 }9});10### page(name, options)11### page.get(callback)12* `callback` - a function with the signature `function(err, info) { ... }` where:13 * `infobox` - an object with the page's infobox properties, e.g. `{ birth_date: 'March 14, 1879', birth_place: 'Ulm, Kingdom of Württemberg, German Confederation' }`14 * `coordinates` - an array of objects with the page's coordinates, e.g. `[ { lat: 48.19889, lon: 16.3725, primary: '' } ]`15 * `abstract` - the page's abstract, e.g. `Albert Einstein was a German-born theoretical physicist. He developed the theory of relativity, one of the two pillars of modern physics (alongside quantum mechanics).`

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var fs = require('fs');3var options = {4 key: fs.readFileSync('certs/key.pem'),5 cert: fs.readFileSync('certs/cert.pem'),6 ca: fs.readFileSync('certs/cert.pem')7};8var wpt = new WebPageTest('www.webpagetest.org', options);9 if (err) return console.error(err);10 console.log('Test submitted to WebPagetest for %s', data.data.testUrl);11});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var fs = require('fs');3var options = {4 key: fs.readFileSync('client.key'),5 cert: fs.readFileSync('client.crt'),6 ca: fs.readFileSync('ca.crt'),7};8var wpt = new wpt('www.webpagetest.org', 'A.3a3e9a9f9e6d1e1b1a6b2c2b2a1a1a1');9 if (err) return console.error(err);10 console.log(data);11 console.log(data.data.median.firstView.SpeedIndex);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt-api');2var fs = require('fs');3var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };4var server = wpt.createServer(options);5server.listen(8080);6var wpt = require('wpt-api');7var fs = require('fs');8var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };9var server = wpt.createServer(options);10server.listen(8080);11var wpt = require('wpt-api');12var fs = require('fs');13var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };14var server = wpt.createServer(options);15server.listen(8080);16var wpt = require('wpt-api');17var fs = require('fs');18var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };19var server = wpt.createServer(options);20server.listen(8080);21var wpt = require('wpt-api');22var fs = require('fs');23var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };24var server = wpt.createServer(options);25server.listen(8080);26var wpt = require('wpt-api');27var fs = require('fs');28var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };29var server = wpt.createServer(options);30server.listen(8080);31var wpt = require('wpt-api');32var fs = require('fs');33var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };34var server = wpt.createServer(options);35server.listen(8080);36var wpt = require('wpt-api');37var fs = require('fs');38var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };39var server = wpt.createServer(options);40server.listen(8080);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var fs = require('fs');3var path = require('path');4var async = require('async');5var util = require('util');6var http = require('http');7var url = require('url');8var exec = require('child_process').exec;9var child;

Full Screen

Using AI Code Generation

copy

Full Screen

1var request = require('request');2var fs = require('fs');3var path = require('path');4var url = require('url');5var dtls = require('dtls');6var options = {7 key: fs.readFileSync(path.join(__dirname, 'client-key.pem')),8 cert: fs.readFileSync(path.join(__dirname, 'client-crt.pem')),9 ca: fs.readFileSync(path.join(__dirname, 'ca-crt.pem')),10};11 if (err) {12 console.log(err);13 return;14 }15 console.log(res.statusCode);16 res.pipe(process.stdout);17});18req.on('socket', function (socket) {19 socket.on('secureConnect', function () {20 var cipher = socket.getCipher();21 console.log('connected to %s using %s', socket.authorized ? 'authorized' : 'unauthorized', cipher.name);22 });23});

Full Screen

Using AI Code Generation

copy

Full Screen

1var dtls = require('dtls');2var fs = require("fs");3var port = 10000;4var options = {5 key: fs.readFileSync('certs/server-key.pem'),6 cert: fs.readFileSync('certs/server-cert.pem'),7 ca: [ fs.readFileSync('certs/ca-cert.pem') ],8};9var server = dtls.createServer(options, function(socket) {10 socket.on('message', function(data, rinfo) {11 socket.send(data, rinfo);12 });13 socket.on('error', function(err) {14 console.log('error', err);15 });16}).listen(port, function() {17 console.log('server listening', port);18});

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require("wptools");2const fs = require("fs");3const path = require("path");4const data = {5};6 .page(data)7 .then(page => {8 return page.get();9 })10 .then(response => {11 console.log(response);12 fs.writeFileSync(13 path.join(__dirname, "data.json"),14 JSON.stringify(response, null, 2)15 );16 })17 .catch(error => {18 console.log(error);19 });

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful