How to use pending method in wpt

Best JavaScript code snippet using wpt

pendingSignForms.js

Source:pendingSignForms.js Github

copy

Full Screen

1/*************************************************************************2 *3 * ADOBE CONFIDENTIAL4 * ___________________5 *6 * Copyright 2014 Adobe Systems Incorporated7 * All Rights Reserved.8 *9 * NOTICE: All information contained herein is, and remains10 * the property of Adobe Systems Incorporated and its suppliers,11 * if any. The intellectual and technical concepts contained12 * herein are proprietary to Adobe Systems Incorporated and its13 * suppliers and are protected by trade secret or copyright law.14 * Dissemination of this information or reproduction of this material15 * is strictly forbidden unless prior written permission is obtained16 * from Adobe Systems Incorporated.17 **************************************************************************/18(function(document, $) {19 var pendingSignGuidePanelMaxHeight = null, pageCount = 1, pendingSignToShow, responsePendingSignGlobal, totalResult = $("#tabs").data("totalresults"),cutPoints=[];20 var pendingSignTemplateString = $("#pendingSignCustomTemplate").html().split('&quote;').join('\"');21 for(var i = 1; i< pendingSignTemplateString.replace(/[\r\t\n]/g, " ").split("\${").length;i++) {22 cutPoints.push((pendingSignTemplateString.replace(/[\r\t\n]/g, " ").split("\${")[i].split("}")[0]));23 }24 var reqCutPoints = jQuery.unique(cutPoints.toString().split(",")).toString();25 var servletPath = $("#tabs").data("servletpath");26 var urlToGetPendingSign = Granite.HTTP.externalize(servletPath + ".fp.draft.json?func=getPendingSignInstances");27 var urlToCancelPendingSign = Granite.HTTP.externalize(servletPath + ".fp.draft.json?func=cancelAgreement");28 var getPendingSignForms = function(){29 $.ajax({30 type: "GET",31 url: urlToGetPendingSign,32 dataType: "json",33 cache: false,34 data:{35 cutPoints:reqCutPoints36 },37 success: function(response) {38 responsePendingSignGlobal = response.reverse();39 pendingSignToShow = responsePendingSignGlobal;40 $("#pendingSignFormsTitle").text($("#pendingSignFormsTitle").data("pendingsignformstitle")+"("+(responsePendingSignGlobal.length) + ")");41 checkForPendingSignView();42 },43 error:function(){44 }45 });46 };47 $("#morePendingSignForm").click(function() {48 showMorePendingSignForms(pendingSignToShow,pageCount);49 });50 $("#morePendingSignForm").keypress(function(e) {51 var eventCode = e.keyCode || e.charCode || e.which;52 if (eventCode == 13 || eventCode == 32) {53 showMorePendingSignForms(pendingSignToShow, pageCount);54 }55 });56 var showPendingSignForms = function(){57 var pendingSignTextSearchBox = $("#pendingSignTextSearchBox");58 pendingSignTextSearchBox.val("");59 pendingSignTextSearchBox.keyup();60 $("#pendingSignLister").css("display","block");61 };62 $("#pendingSignTextSearchBox").keyup(function(){63 pageCount = 1;64 if($("#pendingSignTextSearchBox").val())65 $("#morePendingSignForm").hide();66 else67 $("#morePendingSignForm").show();68 pendingSignToShow = responsePendingSignGlobal.filter(function(item){ return item.name.toLowerCase().search($("#pendingSignTextSearchBox").val().trim().replace(/ +(?= )/g,'').toLowerCase()) >= 0;});69 showFirstPendingSignFormsPage(pendingSignToShow);70 });71 var showMorePendingSignForms = function(response,pageNumber){72 var pendingSignPanel = $("._FP_pendingSignFormPanel");73 if(pendingSignGuidePanelMaxHeight == null){74 pendingSignGuidePanelMaxHeight = pendingSignPanel.height()+parseInt(pendingSignPanel.css("border-top-width"))+parseInt(pendingSignPanel.css("border-bottom-width"));75 pendingSignPanel.css("max-height",pendingSignGuidePanelMaxHeight);76 }77 var customTemplate = $.parseHTML($("#pendingSignCustomTemplate").html());78 var totalPendingSignForms = response.length, i = (pageNumber-1)*totalResult, j= 0, morePendingSignForms = $("#morePendingSignForm");79 var totalRepeatable = $(customTemplate).find("[data-repeatable=true]").length;80 var customTemplateParent = $(customTemplate).wrap("<div class='testDiv'></div>").parent();81 var totalRepeatable = $(customTemplateParent).find("[data-repeatable=true]").length;82 var templateToAppend = "";83 while(totalRepeatable--){84 var currentTemplateObj = $($(customTemplateParent).find("[data-repeatable=true]")[totalRepeatable]);85 $(currentTemplateObj).wrap("<div class='currentTemplateParent'></div>");86 var currentTemplateParent = $(currentTemplateObj).parent();87 var currentTemplate = currentTemplateParent.html();88 while(i<totalPendingSignForms && j++ <totalResult ){89 var time = isNaN(new Date(response[i]["jcr:lastModified"])) ? new Date(parseInt(response[i]["jcr:lastModified"])) : new Date(response[i]["jcr:lastModified"]);90 var currentTime = new Date();91 var diffTime = milliSecondsToString(currentTime - time);92 var iconClass = "__FP_iconClass" + i%6;93 var name = response[i].name;94 var firstLetter = name.substring(0,1);95 var desc = response[i].description;96 if(!desc)97 desc = "";98 response[i].path = Granite.HTTP.externalize(response[i].path);99 var contextPath = Granite.HTTP.externalize("/");100 response[i].contextPath = contextPath.substring(0,contextPath.length-1);101 var pendingSignID = response[i].pendingSignID;102 time.today();103 time.timeNow();104 response[i].Today = time.Today;105 response[i].TimeNow = time.TimeNow;106 response[i].diffTime = diffTime;107 response[i].iconClass = iconClass;108 response[i].firstLetter = firstLetter.toUpperCase();109 response[i].description = desc;110 response[i].renderPath = Granite.HTTP.externalize(response[i]["renderPath"] ? response[i]["renderPath"] : response[i]["path"]);111 var oldUnderscoreTemplateSetting = _.templateSettings.interpolate;112 var oldUnderscoreTemplateEscapeSetting = _.templateSettings.escape;113 _.templateSettings.interpolate = /\$\{(.+?)\}/g;114 _.templateSettings.escape = /\$\{(.+?)\}/g;115 templateToAppend += _.template(currentTemplate,response[i]);116 _.templateSettings.interpolate = oldUnderscoreTemplateSetting;117 _.templateSettings.escape = oldUnderscoreTemplateEscapeSetting;118 i++;119 }120 }121 $($("#__FP_appendPendingSign").find("[data-repeatable]").last().parent()).append(templateToAppend);122 if(totalPendingSignForms < (pageNumber)*totalResult+1){123 morePendingSignForms.hide();124 }125 else{126 morePendingSignForms.show();127 pageCount++;128 }129 };130 var showFirstPendingSignFormsPage = function(response){131 var customTemplate = $.parseHTML($("#pendingSignCustomTemplate").html());132 var morePendingSignForms = $("#morePendingSignForm");133 $("#__FP_appendPendingSign").empty();134 var customTemplateParent = $(customTemplate).wrap("<div class='testDiv'></div>").parent();135 var totalRepeatable = $(customTemplateParent).find("[data-repeatable=true]").length;136 while(totalRepeatable--){137 var currentTemplateObj = $($(customTemplateParent).find("[data-repeatable=true]")[totalRepeatable]);138 $(currentTemplateObj).wrap("<div class='currentTemplateParent'></div>");139 var currentTemplateParent = $(currentTemplateObj).parent();140 var currentTemplate = currentTemplateParent.html();141 var templateToAppend = "";142 for(var i=0;i<response.length&&i<totalResult;i++){143 var time = isNaN(new Date(response[i]["jcr:lastModified"])) ? new Date(parseInt(response[i]["jcr:lastModified"])) : new Date(response[i]["jcr:lastModified"]);144 var currentTime = new Date();145 var diffTime = milliSecondsToString(currentTime - time);146 var iconClass = "__FP_iconClass" + i%6;147 var name = response[i].name;148 var firstLetter = name.substring(0,1);149 var desc = response[i].description;150 if(!desc)151 desc = "";152 response[i].path = Granite.HTTP.externalize(response[i].path);153 var contextPath = Granite.HTTP.externalize("/");154 response[i].contextPath = contextPath.substring(0,contextPath.length-1);155 var pendingSignID = response[i].pendingSignID;156 time.today();157 time.timeNow();158 response[i].Today = time.Today;159 response[i].TimeNow = time.TimeNow;160 response[i].diffTime = diffTime;161 response[i].iconClass = iconClass;162 response[i].firstLetter = firstLetter.toUpperCase();163 response[i].description = desc;164 response[i].renderPath = Granite.HTTP.externalize(response[i]["renderPath"] ? response[i]["renderPath"] : response[i]["path"]);165 var oldUnderscoreTemplateSetting = _.templateSettings.interpolate;166 var oldUnderscoreTemplateEscapeSetting = _.templateSettings.escape;167 _.templateSettings.interpolate = /\$\{(.+?)\}/g;168 _.templateSettings.escape = /\$\{(.+?)\}/g;169 templateToAppend += _.template(currentTemplate,response[i]);170 _.templateSettings.interpolate = oldUnderscoreTemplateSetting;171 _.templateSettings.escape = oldUnderscoreTemplateEscapeSetting;172 }173 $(customTemplateParent.find(".currentTemplateParent")).replaceWith(templateToAppend);174 }175 $("#__FP_appendPendingSign").append(($(customTemplateParent).clone()).html());176 if(response.length <= totalResult){177 morePendingSignForms.hide();178 }179 else{180 morePendingSignForms.show();181 pageCount++;182 }183 };184 openPendingSignForm = function(e){185 var path = $(e).attr('path');186 var name = $(e).attr('title');187 var formTarget = (path)+".html";188 window.open(formTarget);189 };190 var checkForPendingSignView = function() {191 if(responsePendingSignGlobal.length == 0){192 $("#__FP_appendPendingSign").empty();193 $("#pendingSignTextSearchBox").hide();194 return;195 }196 showPendingSignForms();197 };198 var milliSecondsToString = function(milliSeconds){199 window.FD.FP.Util.setLocale($("#tabs").data("locale"));200 var seconds = parseInt(milliSeconds/1000);201 var numyears = Math.floor(seconds / 31536000);202 var numdays = Math.floor((seconds % 31536000) / 86400);203 var numhours = Math.floor(((seconds % 31536000) % 86400) / 3600);204 var numminutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60);205 var numseconds = (((seconds % 31536000) % 86400) % 3600) % 60;206 var yearText = window.FD.FP.Util.getLocalizedValue(" Years "),207 daysText = window.FD.FP.Util.getLocalizedValue(" Days "),208 hourText = window.FD.FP.Util.getLocalizedValue(" Hour "),209 minText = window.FD.FP.Util.getLocalizedValue(" Minutes "),210 secText = window.FD.FP.Util.getLocalizedValue(" Seconds "),211 oneMinText = window.FD.FP.Util.getLocalizedValue(" Minute "),212 agoText = window.FD.FP.Util.getLocalizedValue("Ago");213 if(numyears > 0)214 return numyears + yearText + agoText;215 else if(numdays > 1)216 return numdays + daysText + agoText;217 else if(numdays == 1)218 {219 if(numhours > 0)220 return numdays + daysText + numhours + hourText + agoText;221 else222 return numdays + daysText + agoText;223 }224 else if(numhours > 0)225 {226 if(numminutes > 0)227 return numhours + hourText + numminutes + minText + agoText;228 else229 return numhours + hourText + agoText;230 }231 else if(numminutes > 0)232 {233 if(numminutes > 1)234 return numminutes + minText + agoText;235 else236 return numminutes + oneMinText + agoText;237 }238 else return window.FD.FP.Util.getLocalizedValue("Just now");239 };240 var cancelPendingSign = function(e){241 var pendingSignID = $(e).attr('pendingSignID'),242 confirm = window.confirm(window.FD.FP.Util.getLocalizedValue("Are you sure, you want to cancel this Pending Sign Form ?")),243 formPath = $(e).attr('formPath'),244 errorMessage = window.FD.FP.Util.getLocalizedValue("Error occurred while cancelling the Pending Sign form");245 unableToCancelMessage = window.FD.FP.Util.getLocalizedValue("Unable to cancel the Pending Sign form");246 if(confirm == true){247 $.ajax({248 type:"POST",249 url: urlToCancelPendingSign,250 dataType: 'json',251 async: true,252 cache: false,253 data: {254 pendingSignID:pendingSignID,255 formPath:formPath256 },257 complete: function (xhr, status) {258 if (status === 'error') {259 alert(errorMessage);260 } else {261 if(xhr.responseText === "UNABLE_TO_CANCEL") {262 alert(unableToCancelMessage);263 }264 getPendingSignForms();265 }266 }267 });268 }269 };270 $(document).on( "click", ".__FP_cancelPendingSign", function(){271 cancelPendingSign(this);272 });273 $(document).on( "keypress", ".__FP_cancelPendingSign", function(e){274 var eventCode = e.keyCode || e.charCode || e.which;275 if(eventCode == 13 || eventCode == 32){276 cancelPendingSign(this);277 }278 });279 $(document).ready(getPendingSignForms());...

Full Screen

Full Screen

qunit.js

Source:qunit.js Github

copy

Full Screen

1var runScript = function(script, success, failure)2{3 var json = {};4 json.command = "execute_script";5 json.script = script;67 var post_data = {};8 post_data.json = JSON.stringify(json);910 $.ajax("/json/submit", {11 type: "POST",12 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 1314 data: post_data,15 success: function(data)16 {17 if (success != null)18 success(data);19 },20 error: function(jqXHR, textStatus, errorThrown) 21 { 22 if (failure != null)23 failure(jqXHR, textStatus, errorThrown);24 }25 });26};2728var generateUuid = function()29{30 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) 31 {32 var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);33 return v.toString(16);34 });35};3637var pendingTests = [];3839pendingTests.push(function()40{41 asyncTest("Logger Test", 3, function()42 {43 var userId = generateUuid();44 45 var script = "PurpleRobot.persistString('event_log_params', 'study_name', 'My Test Study');";46 script += "PurpleRobot.persistString('event_log_params', 'group_id', 'My Group ID');";47 script += "PurpleRobot.persistString('event_log_params', 'username', '" + userId + "');";48 script += "PurpleRobot.persistString('event_log_params', 'user_id', PurpleRobot.fetchUserHash());";49 script += "PurpleRobot.persistString('event_log_params', 'readable_content', 'Some simple readable content.');";50 51 runScript(script, function(data)52 {53 ok(true, "Log namespace values persisted.");5455 runScript("PurpleRobot.fetchString('event_log_params', 'username');", function(data)56 {57 ok(userId == data.payload, "Username matches.");5859 runScript("PurpleRobot.log('test_event', {'session_id': 'my-session-id'});", function(data)60 {61 ok(data.payload, "Event logged");62 63 start();64 65 if (pendingTests.length > 0)66 {67 var next = pendingTests.pop();68 next(); 69 }70 }, function(jqXHR, textStatus, errorThrown)71 {72 ok(false, "Encountered error: " + errorThrown);73 74 start();75 76 if (pendingTests.length > 0)77 {78 var next = pendingTests.pop();79 next(); 80 }81 });82 }, function(jqXHR, textStatus, errorThrown)83 {84 ok(false, "Encountered error: " + errorThrown);8586 start();8788 if (pendingTests.length > 0)89 {90 var next = pendingTests.pop();91 next(); 92 }93 });94 }, function(jqXHR, textStatus, errorThrown)95 {96 ok(false, "Encountered error: " + errorThrown);9798 if (pendingTests.length > 0)99 {100 var next = pendingTests.pop();101 next(); 102 }103 });104 });105});106107pendingTests.push(function()108{109 asyncTest("Unencrypted String Getters & Setters Test", 2, function()110 {111 var key = generateUuid();112 var value = generateUuid();113 114 runScript("PurpleRobot.persistString('" + key + "', '" + value + "');", function(data)115 {116 ok(true, key + " => " + value + " persisted");117118 runScript("PurpleRobot.fetchString('" + key + "');", function(data)119 {120 ok(value == data.payload, "Fetched value matches original value");121122 start();123 124 if (pendingTests.length > 0)125 {126 var next = pendingTests.pop();127 next(); 128 }129 }, function(jqXHR, textStatus, errorThrown)130 {131 ok(false, "Encountered error: " + errorThrown);132133 start();134135 if (pendingTests.length > 0)136 {137 var next = pendingTests.pop();138 next(); 139 }140 });141 }, function(jqXHR, textStatus, errorThrown)142 {143 ok(false, "Encountered error: " + errorThrown);144145 if (pendingTests.length > 0)146 {147 var next = pendingTests.pop();148 next(); 149 }150 });151 });152});153154pendingTests.push(function()155{156 asyncTest("Encrypted String Getters & Setters Test", 2, function()157 {158 var key = generateUuid();159 var value = generateUuid();160 161 runScript("PurpleRobot.persistEncryptedString('" + key + "', '" + value + "');", function(data)162 {163 ok(true, key + " => " + value + " persisted");164165 runScript("PurpleRobot.fetchEncryptedString('" + key + "');", function(data)166 {167 ok(value == data.payload, "Fetched value matches original value");168169 start();170 171 if (pendingTests.length > 0)172 {173 var next = pendingTests.pop();174 next(); 175 }176 }, function(jqXHR, textStatus, errorThrown)177 {178 ok(false, "Encountered error: " + errorThrown);179180 start();181182 if (pendingTests.length > 0)183 {184 var next = pendingTests.pop();185 next(); 186 }187 });188 }, function(jqXHR, textStatus, errorThrown)189 {190 ok(false, "Encountered error: " + errorThrown);191192 if (pendingTests.length > 0)193 {194 var next = pendingTests.pop();195 next(); 196 }197 });198 });199});200201pendingTests.push(function ()202{203 asyncTest("playDefaultTone Test", function()204 {205 runScript("PurpleRobot.playDefaultTone();", function(data)206 {207 ok(true, "Test tone played.");208 start();209 210 if (pendingTests.length > 0)211 {212 var next = pendingTests.pop();213 next(); 214 }215 }, function(jqXHR, textStatus, errorThrown)216 {217 ok(false, "Encountered error: " + errorThrown);218219 if (pendingTests.length > 0)220 {221 var next = pendingTests.pop();222 next(); 223 }224 });225 });226});227228pendingTests.push(function()229{230 asyncTest("Unencrypted Namespace Test", 3, function()231 {232 var key = generateUuid();233 var value = generateUuid();234 var namespace = generateUuid();235236 runScript("PurpleRobot.persistString('" + namespace + "', '" + key + "', '" + value + "');", function(data)237 {238 ok(true, key + " => " + value + " persisted");239240 runScript("PurpleRobot.fetchString('" + namespace + "', '" + key + "');", function(data)241 {242 ok(value == data.payload, "Fetched value matches original value.");243244 runScript("PurpleRobot.fetchNamespaces();", function(data)245 {246 if (data.payload != undefined)247 ok($.inArray(namespace, data.payload), "Namespace list contains expected namespace.");248 else249 ok(false, "Namespace list returned");250 251 start();252 253 if (pendingTests.length > 0)254 {255 var next = pendingTests.pop();256 next(); 257 }258 }, function(jqXHR, textStatus, errorThrown)259 {260 ok(false, "Encountered error: " + errorThrown);261 262 start();263 264 if (pendingTests.length > 0)265 {266 var next = pendingTests.pop();267 next(); 268 }269 });270 }, function(jqXHR, textStatus, errorThrown)271 {272 ok(false, "Encountered error: " + errorThrown);273274 start();275276 if (pendingTests.length > 0)277 {278 var next = pendingTests.pop();279 next(); 280 }281 });282 }, function(jqXHR, textStatus, errorThrown)283 {284 ok(false, "Encountered error: " + errorThrown);285286 start();287288 if (pendingTests.length > 0)289 {290 var next = pendingTests.pop();291 next(); 292 }293 });294 });295});296297pendingTests.push(function()298{299 asyncTest("Encrypted Namespace Test", 3, function()300 {301 var key = generateUuid();302 var value = generateUuid();303 var namespace = generateUuid();304305 runScript("PurpleRobot.persistEncryptedString('" + namespace + "', '" + key + "', '" + value + "');", function(data)306 {307 ok(true, key + " => " + value + " persisted");308309 runScript("PurpleRobot.fetchEncryptedString('" + namespace + "', '" + key + "');", function(data)310 {311 ok(value == data.payload, "Fetched value matches original value.");312313 runScript("PurpleRobot.fetchNamespaces();", function(data)314 {315 if (data.payload != undefined)316 ok($.inArray(namespace, data.payload), "Namespace list contains expected namespace.");317 else318 ok(false, "Namespace list returned");319 320 start();321 322 if (pendingTests.length > 0)323 {324 var next = pendingTests.pop();325 next(); 326 }327 }, function(jqXHR, textStatus, errorThrown)328 {329 ok(false, "Encountered error: " + errorThrown);330 331 start();332 333 if (pendingTests.length > 0)334 {335 var next = pendingTests.pop();336 next(); 337 }338 });339 }, function(jqXHR, textStatus, errorThrown)340 {341 ok(false, "Encountered error: " + errorThrown);342343 start();344345 if (pendingTests.length > 0)346 {347 var next = pendingTests.pop();348 next(); 349 }350 });351 }, function(jqXHR, textStatus, errorThrown)352 {353 ok(false, "Encountered error: " + errorThrown);354355 start();356357 if (pendingTests.length > 0)358 {359 var next = pendingTests.pop();360 next(); 361 }362 });363 });364});365366pendingTests.push(function()367{368 asyncTest("Namespace Contents Test", 2, function()369 {370 var key = generateUuid();371 var value = generateUuid();372 var namespace = generateUuid();373374 runScript("PurpleRobot.persistString('" + namespace + "', '" + key + "', '" + value + "');", function(data)375 {376 ok(true, key + " => " + value + " persisted");377378 runScript("PurpleRobot.fetchNamespace('" + namespace + "');", function(data)379 {380 ok(value == data.payload[key], "Namespace object contains original value.");381382 start();383384 if (pendingTests.length > 0)385 {386 var next = pendingTests.pop();387 next(); 388 }389 }, function(jqXHR, textStatus, errorThrown)390 {391 ok(false, "Encountered error: " + errorThrown);392393 start();394395 if (pendingTests.length > 0)396 {397 var next = pendingTests.pop();398 next(); 399 }400 });401 }, function(jqXHR, textStatus, errorThrown)402 {403 ok(false, "Encountered error: " + errorThrown);404405 start();406407 if (pendingTests.length > 0)408 {409 var next = pendingTests.pop();410 next(); 411 }412 });413 });414});415416pendingTests.push(function()417{418 asyncTest("Javascript Update Config Test", 2, function()419 {420 var key = "config_json_refresh_manually"; // Unused ID used in the preferences screen for button activity.421 var value = generateUuid();422423 runScript("PurpleRobot.updateConfig({ '" + key + "': '" + value + "'});", function(data)424 {425 ok(true, key + " => " + value + " persisted");426427 runScript("PurpleRobot.fetchConfig();", function(data)428 {429 alert("PAY: " + data.payload);430 431 var result = JSON.parse(data.payload);432 433 alert(value + " =? " + result[key]);434 435 var matches = (value == result[key]);436437 ok(matches, key + " => " + value + " set successfully.");438 439 start();440441 if (pendingTests.length > 0)442 {443 var next = pendingTests.pop();444 next(); 445 }446 }, function(jqXHR, textStatus, errorThrown)447 {448 ok(false, "Encountered error: " + errorThrown);449450 start();451452 if (pendingTests.length > 0)453 {454 var next = pendingTests.pop();455 next(); 456 }457 });458 }, function(jqXHR, textStatus, errorThrown)459 {460 ok(false, "Encountered error: " + errorThrown);461462 start();463464 if (pendingTests.length > 0)465 {466 var next = pendingTests.pop();467 next(); 468 }469 });470 });471});472473var go = pendingTests.pop(); ...

Full Screen

Full Screen

network.js

Source:network.js Github

copy

Full Screen

1/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */2/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */3/* Copyright 2012 Mozilla Foundation4 *5 * Licensed under the Apache License, Version 2.0 (the "License");6 * you may not use this file except in compliance with the License.7 * You may obtain a copy of the License at8 *9 * http://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */17// NOTE: Be careful what goes in this file, as it is also used from the context18// of the addon. So using warn/error in here will break the addon.19'use strict';20//#if (FIREFOX || MOZCENTRAL)21//22//Components.utils.import('resource://gre/modules/Services.jsm');23//24//var EXPORTED_SYMBOLS = ['NetworkManager'];25//26//var console = {27// log: function console_log(aMsg) {28// var msg = 'network.js: ' + (aMsg.join ? aMsg.join('') : aMsg);29// Services.console.logStringMessage(msg);30// // TODO(mack): dump() doesn't seem to work here...31// dump(msg + '\n');32// }33//}34//#endif35var NetworkManager = (function NetworkManagerClosure() {36 var OK_RESPONSE = 200;37 var PARTIAL_CONTENT_RESPONSE = 206;38 function NetworkManager(url, args) {39 this.url = url;40 args = args || {};41 this.isHttp = /^https?:/i.test(url);42 this.httpHeaders = (this.isHttp && args.httpHeaders) || {};43 this.withCredentials = args.withCredentials || false;44 this.getXhr = args.getXhr ||45 function NetworkManager_getXhr() {46//#if B2G47// return new XMLHttpRequest({ mozSystem: true });48//#else49 return new XMLHttpRequest();50//#endif51 };52 this.currXhrId = 0;53 this.pendingRequests = {};54 this.loadedRequests = {};55 }56 function getArrayBuffer(xhr) {57 var data = xhr.response;58 if (typeof data !== 'string') {59 return data;60 }61 var length = data.length;62 var array = new Uint8Array(length);63 for (var i = 0; i < length; i++) {64 array[i] = data.charCodeAt(i) & 0xFF;65 }66 return array.buffer;67 }68 NetworkManager.prototype = {69 requestRange: function NetworkManager_requestRange(begin, end, listeners) {70 var args = {71 begin: begin,72 end: end73 };74 for (var prop in listeners) {75 args[prop] = listeners[prop];76 }77 return this.request(args);78 },79 requestFull: function NetworkManager_requestFull(listeners) {80 return this.request(listeners);81 },82 request: function NetworkManager_request(args) {83 var xhr = this.getXhr();84 var xhrId = this.currXhrId++;85 var pendingRequest = this.pendingRequests[xhrId] = {86 xhr: xhr87 };88 xhr.open('GET', this.url);89 xhr.withCredentials = this.withCredentials;90 for (var property in this.httpHeaders) {91 var value = this.httpHeaders[property];92 if (typeof value === 'undefined') {93 continue;94 }95 xhr.setRequestHeader(property, value);96 }97 if (this.isHttp && 'begin' in args && 'end' in args) {98 var rangeStr = args.begin + '-' + (args.end - 1);99 xhr.setRequestHeader('Range', 'bytes=' + rangeStr);100 pendingRequest.expectedStatus = 206;101 } else {102 pendingRequest.expectedStatus = 200;103 }104 if (args.onProgressiveData) {105 // Some legacy browsers might throw an exception.106 try {107 xhr.responseType = 'moz-chunked-arraybuffer';108 } catch(e) {}109 if (xhr.responseType === 'moz-chunked-arraybuffer') {110 pendingRequest.onProgressiveData = args.onProgressiveData;111 pendingRequest.mozChunked = true;112 } else {113 xhr.responseType = 'arraybuffer';114 }115 } else {116 xhr.responseType = 'arraybuffer';117 }118 if (args.onError) {119 xhr.onerror = function(evt) {120 args.onError(xhr.status);121 };122 }123 xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);124 xhr.onprogress = this.onProgress.bind(this, xhrId);125 pendingRequest.onHeadersReceived = args.onHeadersReceived;126 pendingRequest.onDone = args.onDone;127 pendingRequest.onError = args.onError;128 pendingRequest.onProgress = args.onProgress;129 xhr.send(null);130 return xhrId;131 },132 onProgress: function NetworkManager_onProgress(xhrId, evt) {133 var pendingRequest = this.pendingRequests[xhrId];134 if (!pendingRequest) {135 // Maybe abortRequest was called...136 return;137 }138 if (pendingRequest.mozChunked) {139 var chunk = getArrayBuffer(pendingRequest.xhr);140 pendingRequest.onProgressiveData(chunk);141 }142 var onProgress = pendingRequest.onProgress;143 if (onProgress) {144 onProgress(evt);145 }146 },147 onStateChange: function NetworkManager_onStateChange(xhrId, evt) {148 var pendingRequest = this.pendingRequests[xhrId];149 if (!pendingRequest) {150 // Maybe abortRequest was called...151 return;152 }153 var xhr = pendingRequest.xhr;154 if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {155 pendingRequest.onHeadersReceived();156 delete pendingRequest.onHeadersReceived;157 }158 if (xhr.readyState !== 4) {159 return;160 }161 if (!(xhrId in this.pendingRequests)) {162 // The XHR request might have been aborted in onHeadersReceived()163 // callback, in which case we should abort request164 return;165 }166 delete this.pendingRequests[xhrId];167 // success status == 0 can be on ftp, file and other protocols168 if (xhr.status === 0 && this.isHttp) {169 if (pendingRequest.onError) {170 pendingRequest.onError(xhr.status);171 }172 return;173 }174 var xhrStatus = xhr.status || OK_RESPONSE;175 // From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2:176 // "A server MAY ignore the Range header". This means it's possible to177 // get a 200 rather than a 206 response from a range request.178 var ok_response_on_range_request =179 xhrStatus === OK_RESPONSE &&180 pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;181 if (!ok_response_on_range_request &&182 xhrStatus !== pendingRequest.expectedStatus) {183 if (pendingRequest.onError) {184 pendingRequest.onError(xhr.status);185 }186 return;187 }188 this.loadedRequests[xhrId] = true;189 var chunk = getArrayBuffer(xhr);190 if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {191 var rangeHeader = xhr.getResponseHeader('Content-Range');192 var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);193 var begin = parseInt(matches[1], 10);194 pendingRequest.onDone({195 begin: begin,196 chunk: chunk197 });198 } else if (pendingRequest.onProgressiveData) {199 pendingRequest.onDone(null);200 } else {201 pendingRequest.onDone({202 begin: 0,203 chunk: chunk204 });205 }206 },207 hasPendingRequests: function NetworkManager_hasPendingRequests() {208 for (var xhrId in this.pendingRequests) {209 return true;210 }211 return false;212 },213 getRequestXhr: function NetworkManager_getXhr(xhrId) {214 return this.pendingRequests[xhrId].xhr;215 },216 isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {217 return !!(this.pendingRequests[xhrId].onProgressiveData);218 },219 isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {220 return xhrId in this.pendingRequests;221 },222 isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {223 return xhrId in this.loadedRequests;224 },225 abortAllRequests: function NetworkManager_abortAllRequests() {226 for (var xhrId in this.pendingRequests) {227 this.abortRequest(xhrId | 0);228 }229 },230 abortRequest: function NetworkManager_abortRequest(xhrId) {231 var xhr = this.pendingRequests[xhrId].xhr;232 delete this.pendingRequests[xhrId];233 xhr.abort();234 }235 };236 return NetworkManager;...

Full Screen

Full Screen

instagram.js

Source:instagram.js Github

copy

Full Screen

1import { IgApiClient } from 'instagram-private-api';2import { handleInput } from '../cognition/handleInput.js';3import { database } from '../database.js';4import customConfig from '../utilities/customConfig.js';5import { log } from '../utilities/logger.js';6export const createInstagramClient = async () => {7 const username = customConfig.instance.get('instagramUsername')8 const password = customConfig.instance.get('instagramPassword')9 if (!username || !password) return console.warn("No Instagram credentials found, skipping");10 //creates the instagram client and logs in using the credentials11 const ig = new IgApiClient()12 ig.state.generateDevice(username);13 await ig.simulate.preLoginFlow()14 const loggedInUser = await ig.account.login(username, password)15 process.nextTick(async () => await ig.simulate.postLoginFlow())16 const history = { 17 pending: await ig.feed.directInbox().items(),18 unread:[]19 }20 for (var idx in history.pending) {21 let pending = history.pending[idx]22 if (pending.last_permanent_item.item_type === 'text') {23 await database.instance.messageExists('instagram', 24 pending.thread_id, 25 pending.last_permanent_item.item_id + '',26 pending.last_permanent_item.user_id === loggedInUser.pk ? customConfig.instance.get('botName') : pending.thread_title,27 pending.last_permanent_item.text, 28 parseInt(pending.last_permanent_item.timestamp) / 1000)29 }30 }31 setInterval(async () => {32 const inbox = { 33 pending: await ig.feed.directInbox().items()34 }35 for (var idx in inbox.pending) {36 let pending = inbox.pending[idx]37 if (pending.last_permanent_item.item_type === 'text') {38 if (pending.last_permanent_item.user_id === loggedInUser.pk) {39 await database.instance.messageExists('instagram', 40 pending.thread_id, 41 pending.last_permanent_item.item_id + '',42 pending.last_permanent_item.user_id === loggedInUser.pk ? customConfig.instance.get('botName') : pending.thread_title,43 pending.last_permanent_item.text, 44 parseInt(pending.last_permanent_item.timestamp) / 1000)45 continue46 }47 await database.instance.messageExistsAsyncWitHCallback('instgram', 48 pending.thread_id,49 pending.last_permanent_item.item_id + '',50 pending.users[0].username, 51 pending.last_permanent_item.text, 52 parseInt(pending.last_permanent_item.timestamp), () => {53 const timestamp = parseInt(pending.last_permanent_item.timestamp)54 var date = new Date(timestamp / 1000);55 const utc = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());56 const utcStr = date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear() + ' ' + utc.getHours() + ':' + utc.getMinutes() + ':' + utc.getSeconds()57 58 log('got new message: ' + pending.last_permanent_item.text)59 const resp = await handleInput(pending.last_permanent_item.text, pending.users[0].username,60 customConfig.instance.get('agent') ?? "Agent", null, 'instagram', pending.last_permanent_item.item_id);61 62 const thread = ig.entity.directThread(chatId)63 await thread.broadcastText(resp)64 database.instance.addMessageInHistoryWithDate('instagram',65 pending.thread_id, 66 pending.last_permanent_item.item_id + '', 67 pending.users[0].username, 68 pending.last_permanent_item.text, 69 utcStr)70 })71 }72 }73 }, 5000)...

Full Screen

Full Screen

pendingactions.js

Source:pendingactions.js Github

copy

Full Screen

1/**2 * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license4 */5import VirtualTestEditor from './_utils/virtualtesteditor';6import PendingActions from '../src/pendingactions';7import { expectToThrowCKEditorError } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';8let editor, pendingActions;9describe( 'PendingActions', () => {10 beforeEach( () => {11 return VirtualTestEditor.create( {12 plugins: [ PendingActions ]13 } ).then( newEditor => {14 editor = newEditor;15 pendingActions = editor.plugins.get( PendingActions );16 } );17 } );18 afterEach( () => {19 return editor.destroy();20 } );21 it( 'should define static pluginName property', () => {22 expect( PendingActions ).to.have.property( 'pluginName', 'PendingActions' );23 } );24 it( 'should be marked as a context plugin', () => {25 expect( PendingActions.isContextPlugin ).to.true;26 } );27 describe( 'init()', () => {28 it( 'should have hasAny observable', () => {29 const spy = sinon.spy();30 pendingActions.on( 'change:hasAny', spy );31 expect( pendingActions ).to.have.property( 'hasAny', false );32 pendingActions.hasAny = true;33 sinon.assert.calledOnce( spy );34 } );35 } );36 describe( 'add()', () => {37 it( 'should register and return pending action', () => {38 const action = pendingActions.add( 'Action' );39 expect( action ).be.an( 'object' );40 expect( action.message ).to.equal( 'Action' );41 } );42 it( 'should return observable', () => {43 const spy = sinon.spy();44 const action = pendingActions.add( 'Action' );45 action.on( 'change:message', spy );46 action.message = 'New message';47 sinon.assert.calledOnce( spy );48 } );49 it( 'should update hasAny observable', () => {50 expect( pendingActions ).to.have.property( 'hasAny', false );51 pendingActions.add( 'Action' );52 expect( pendingActions ).to.have.property( 'hasAny', true );53 } );54 it( 'should throw an error when invalid message is given', () => {55 expectToThrowCKEditorError( () => {56 pendingActions.add( {} );57 }, /^pendingactions-add-invalid-message/, editor );58 } );59 it( 'should fire add event with added item', () => {60 const spy = sinon.spy();61 pendingActions.on( 'add', spy );62 const action = pendingActions.add( 'Some action' );63 sinon.assert.calledWith( spy, sinon.match.any, action );64 } );65 } );66 describe( 'remove()', () => {67 it( 'should remove given pending action and update observable', () => {68 const action1 = pendingActions.add( 'Action 1' );69 const action2 = pendingActions.add( 'Action 2' );70 expect( pendingActions ).to.have.property( 'hasAny', true );71 pendingActions.remove( action1 );72 expect( pendingActions ).to.have.property( 'hasAny', true );73 pendingActions.remove( action2 );74 expect( pendingActions ).to.have.property( 'hasAny', false );75 } );76 it( 'should fire remove event with removed item', () => {77 const spy = sinon.spy();78 pendingActions.on( 'remove', spy );79 const action = pendingActions.add( 'Some action' );80 pendingActions.remove( action );81 sinon.assert.calledWith( spy, sinon.match.any, action );82 } );83 } );84 describe( 'first', () => {85 it( 'should return first pending action from the list', () => {86 expect( pendingActions.first ).to.be.null;87 const action = pendingActions.add( 'Action 1' );88 pendingActions.add( 'Action 2' );89 expect( pendingActions.first ).to.equal( action );90 } );91 } );92 describe( 'iterator', () => {93 it( 'should return all panding actions', () => {94 pendingActions.add( 'Action 1' );95 pendingActions.add( 'Action 2' );96 expect( Array.from( pendingActions, action => action.message ) ).to.have.members( [ 'Action 1', 'Action 2' ] );97 } );98 } );...

Full Screen

Full Screen

_promiseWaiter.js

Source:_promiseWaiter.js Github

copy

Full Screen

1/*!2 * ${copyright}3 */4sap.ui.define([5 "sap/ui/test/_OpaLogger",6 "sap/ui/test/_ParameterValidator",7 "sap/ui/test/autowaiter/_utils",8 "sap/ui/thirdparty/jquery"9], function(_OpaLogger, _ParameterValidator, _utils, jQueryDOM) {10 "use strict";11 var oLogger = _OpaLogger.getLogger("sap.ui.test.autowaiter._promiseWaiter");12 var oHasPendingLogger = _OpaLogger.getLogger("sap.ui.test.autowaiter._promiseWaiter#hasPending");13 var oConfigValidator = new _ParameterValidator({14 errorPrefix: "sap.ui.test.autowaiter._promiseCounter#extendConfig"15 });16 var iDefaultMaxDelay = 1000; // milliseconds; should be at least as big as _timeoutWaiter maxDelay17 var config = {18 maxDelay: iDefaultMaxDelay19 };20 var aPendingPromises = [];21 function wrapPromiseFunction (sOriginalFunctionName) {22 var fnOriginal = Promise[sOriginalFunctionName];23 Promise[sOriginalFunctionName] = function () {24 var bTooLate = false;25 var mPendingPromise = {26 func: sOriginalFunctionName,27 args: _utils.argumentsToString(arguments),28 stack: _utils.resolveStackTrace()29 };30 var sPendingPromiseLog = createLogForPromise(mPendingPromise);31 // Timeout to detect long runners32 var iTimeout = setTimeout(function () {33 bTooLate = true;34 aPendingPromises.splice(aPendingPromises.indexOf(mPendingPromise), 1);35 oLogger.trace("Long-running promise is ignored:" + sPendingPromiseLog);36 }, config.maxDelay,'TIMEOUT_WAITER_IGNORE');37 var fnCountDownPromises = function () {38 if (bTooLate) {39 // the timeout already counted down - do nothing40 return;41 }42 // count down and clear the timeout to make sure it is only counted down once43 aPendingPromises.splice(aPendingPromises.indexOf(mPendingPromise), 1);44 oLogger.trace("Promise complete:" + sPendingPromiseLog);45 clearTimeout(iTimeout);46 };47 var oPromise = fnOriginal.apply(this, arguments);48 aPendingPromises.push(mPendingPromise);49 oLogger.trace("New pending promise:" + sPendingPromiseLog);50 oPromise.then(fnCountDownPromises, fnCountDownPromises);51 return oPromise;52 };53 }54 wrapPromiseFunction("resolve");55 wrapPromiseFunction("all");56 wrapPromiseFunction("race");57 wrapPromiseFunction("reject");58 function createLogForPromise(mPromise) {59 return "\nPromise: Function: " + mPromise.func + " Args: " + mPromise.args + " Stack: " + mPromise.stack;60 }61 function logPendingPromises() {62 var sLogMessage = "There are " + aPendingPromises.length + " pending promises\n";63 aPendingPromises.forEach(function (mPromise) {64 sLogMessage += createLogForPromise(mPromise);65 });66 oHasPendingLogger.debug(sLogMessage);67 }68 return {69 hasPending: function () {70 var bHasPendingPromises = aPendingPromises.length > 0;71 if (bHasPendingPromises) {72 logPendingPromises();73 }74 return bHasPendingPromises;75 },76 extendConfig: function (oConfig) {77 var iConfigMaxDelay = oConfig && oConfig.timeoutWaiter && oConfig.timeoutWaiter.maxDelay;78 oConfig = {79 maxDelay: iConfigMaxDelay || iDefaultMaxDelay80 };81 oConfigValidator.validate({82 inputToValidate: oConfig,83 validationInfo: {84 maxDelay: "numeric"85 }86 });87 jQueryDOM.extend(config, oConfig);88 }89 };...

Full Screen

Full Screen

PendingObjectGrid.js

Source:PendingObjectGrid.js Github

copy

Full Screen

1Ext.define('PVE.grid.PendingObjectGrid', {2 extend: 'PVE.grid.ObjectGrid',3 alias: ['widget.pvePendingObjectGrid'],4 getObjectValue: function(key, defaultValue, pending) {5 var me = this;6 var rec = me.store.getById(key);7 if (rec) {8 var value = (pending && Ext.isDefined(rec.data.pending) && (rec.data.pending !== '')) ? 9 rec.data.pending : rec.data.value;10 if (Ext.isDefined(value) && (value !== '')) {11 return value;12 } else {13 return defaultValue;14 }15 }16 return defaultValue;17 },18 hasPendingChanges: function(key) {19 var me = this;20 var rows = me.rows;21 var rowdef = (rows && rows[key]) ? rows[key] : {};22 var keys = rowdef.multiKey || [ key ];23 var pending = false;24 Ext.Array.each(keys, function(k) {25 var rec = me.store.getById(k);26 if (rec && rec.data && Ext.isDefined(rec.data.pending) && (rec.data.pending !== '')) {27 pending = true;28 }29 });30 return pending;31 },32 renderValue: function(value, metaData, record, rowIndex, colIndex, store) {33 var me = this;34 var rows = me.rows;35 var key = record.data.key;36 var rowdef = (rows && rows[key]) ? rows[key] : {};37 var renderer = rowdef.renderer;38 var current = '';39 var pendingdelete = '';40 var pending = '';41 if (renderer) {42 current = renderer(value, metaData, record, rowIndex, colIndex, store, false);43 if (me.hasPendingChanges(key)) {44 pending = renderer(record.data.pending, metaData, record, rowIndex, colIndex, store, true);45 }46 if (pending == current) {47 pending = undefined;48 }49 } else {50 current = value;51 pending = record.data.pending;52 }53 if (record.data['delete']) {54 pendingdelete = '<div style="text-decoration: line-through;">'+ current +'</div>';55 }56 if (pending || pendingdelete) {57 return current + '<div style="color:red">' + pending + pendingdelete + '</div>';58 } else {59 return current;60 }61 },62 initComponent : function() {63 var me = this;64 var rows = me.rows;65 if (!me.rstore) {66 if (!me.url) {67 throw "no url specified";68 }69 me.rstore = Ext.create('PVE.data.ObjectStore', {70 model: 'KeyValuePendingDelete',71 readArray: true,72 url: me.url,73 interval: me.interval,74 extraParams: me.extraParams,75 rows: me.rows76 });77 }78 me.callParent();79 }...

Full Screen

Full Screen

authorityStore.js

Source:authorityStore.js Github

copy

Full Screen

1import {createReducer} from "../../config/create-reducer";2export const UPDATE_THRESHOLD = "authority/updateThreshold";3export const UPDATE_PENDING_USERDATA = "authority/updatePendingApprovals";4export const initialState = {5 thresholds:{},6 pendingUsers:[],7 pendingUserGridData:[],8 pendingUsersLoaded:false,9}10function transformPendingUsersForGrid(pendingUsers){11 return pendingUsers.map(item => {12 return [item.firstName, item.email, item.role]13 })14}15const updateThresholdLevel =(state,action)=>{16 return { ...state,thresholds:action.payload}17};18const updatePendingData =(state,action)=>{19 console.log("updatePendingData");20 const pendingUsers = action.payload;21 return { ...state,pendingUsersLoaded:true,pendingUsers,pendingUserGridData:transformPendingUsersForGrid(pendingUsers)}22};23const authorityReducer = createReducer(initialState, {24 [UPDATE_THRESHOLD]: updateThresholdLevel,25 [UPDATE_PENDING_USERDATA]: updatePendingData,26});...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var pending = wpt('www.webpagetest.org');3 if (err) {4 console.log('Error: ', err);5 } else {6 console.log('Test Results: ', data);7 }8});9var wpt = require('webpagetest');10var promise = wpt('www.webpagetest.org');11 .then(function(data) {12 console.log('Test Results: ', data);13 })14 .catch(function(err) {15 console.log('Error: ', err);16 });17var wpt = require('webpagetest');18var callback = wpt('www.webpagetest.org');19 lighthouseConfig: {20 settings: {21 }22 }23}, function(err, data) {24 if (err) {25 console.log('Error: ', err);26 } else {27 console.log('Test Results: ', data);28 }29});30var wpt = require('webpagetest');31var pending = wpt('www.webpagetest.org');32 lighthouseConfig: {33 settings: {34 }35 }36}, function(err, data) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2wptoolkit.pending('Test', function() {3});4var wptoolkit = require('wptoolkit');5wptoolkit.xpending('Test', function() {6});7var wptoolkit = require('wptoolkit');8wptoolkit.skip('Test', function() {9});10var wptoolkit = require('wptoolkit');11wptoolkit.xskip('Test', function() {12});13var wptoolkit = require('wptoolkit');14wptoolkit.describe('Test', function() {15});16var wptoolkit = require('wptoolkit');17wptoolkit.xdescribe('Test', function() {18});19var wptoolkit = require('wptoolkit');20wptoolkit.it('Test', function() {21});22var wptoolkit = require('wptoolkit');23wptoolkit.xit('Test', function() {24});25var wptoolkit = require('wptoolkit');26wptoolkit.before(function() {27});28var wptoolkit = require('wptoolkit');29wptoolkit.after(function() {30});

Full Screen

Using AI Code Generation

copy

Full Screen

1var webPageTest = require('webpagetest');2var wpt = new webPageTest('www.webpagetest.org', 'A.0d5e5c5b5a5b5c5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y5z5');3wpt.getLocations(function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7}, function(err, data) {8 if (err) return console.error(err);9 console.log(data);10});11wpt.getTestStatus('140825_8R_5c2a2f5b5c5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y5z5', function(err, data) {12 if (err) return console.error(err);13 console.log(data);14});15wpt.getTestResults('140825_8R_5c2a2f5b5c5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y5z5', function(err, data) {16 if (err) return console.error(err);17 console.log(data);18});19var webPageTest = require('webpagetest');20var wpt = new webPageTest('www.webpagetest.org', 'A.0d5e5c5b5

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