How to use rs method in wpt

Best JavaScript code snippet using wpt

RenderStateSpec.js

Source:RenderStateSpec.js Github

copy

Full Screen

1/*global defineSuite*/2defineSuite([3 'Core/WebGLConstants',4 'Core/WindingOrder',5 'Renderer/RenderState',6 'Renderer/ContextLimits',7 'Specs/createContext'8 ], function(9 WebGLConstants,10 WindingOrder,11 RenderState,12 ContextLimits,13 createContext) {14 'use strict';1516 var context;1718 beforeAll(function() {19 context = createContext();20 });2122 afterAll(function() {23 context.destroyForSpecs();24 });2526 it('creates with defaults', function() {27 var defaultRS = {28 frontFace : WindingOrder.COUNTER_CLOCKWISE,29 cull : {30 enabled : false,31 face : WebGLConstants.BACK32 },33 lineWidth : 1,34 polygonOffset : {35 enabled : false,36 factor : 0,37 units : 038 },39 scissorTest : {40 enabled : false,41 rectangle : {42 x : 0,43 y : 0,44 width : 0,45 height : 046 }47 },48 depthRange : {49 near : 0,50 far : 151 },52 depthTest : {53 enabled : false,54 func : WebGLConstants.LESS55 },56 colorMask : {57 red : true,58 green : true,59 blue : true,60 alpha : true61 },62 depthMask : true,63 stencilMask : ~0,64 blending : {65 enabled : false,66 color : {67 red : 0.0,68 green : 0.0,69 blue : 0.0,70 alpha : 0.071 },72 equationRgb : WebGLConstants.FUNC_ADD,73 equationAlpha : WebGLConstants.FUNC_ADD,74 functionSourceRgb : WebGLConstants.ONE,75 functionSourceAlpha : WebGLConstants.ONE,76 functionDestinationRgb : WebGLConstants.ZERO,77 functionDestinationAlpha : WebGLConstants.ZERO78 },79 stencilTest : {80 enabled : false,81 frontFunction : WebGLConstants.ALWAYS,82 backFunction : WebGLConstants.ALWAYS,83 reference : 0,84 mask : ~0,85 frontOperation : {86 fail : WebGLConstants.KEEP,87 zFail : WebGLConstants.KEEP,88 zPass : WebGLConstants.KEEP89 },90 backOperation : {91 fail : WebGLConstants.KEEP,92 zFail : WebGLConstants.KEEP,93 zPass : WebGLConstants.KEEP94 }95 },96 sampleCoverage : {97 enabled : false,98 value : 1.0,99 invert : false100 }101 };102103 var rs = RenderState.fromCache();104105 expect(rs.frontFace).toEqual(defaultRS.frontFace);106 expect(rs.cull.enabled).toEqual(defaultRS.cull.enabled);107 expect(rs.cull.face).toEqual(defaultRS.cull.face);108 expect(rs.cull.lineWidth).toEqual(defaultRS.cull.lineWidth);109 expect(rs.polygonOffset.enabled).toEqual(defaultRS.polygonOffset.enabled);110 expect(rs.polygonOffset.factor).toEqual(defaultRS.polygonOffset.factor);111 expect(rs.polygonOffset.units).toEqual(defaultRS.polygonOffset.units);112 expect(rs.scissorTest.enabled).toEqual(defaultRS.scissorTest.enabled);113 expect(rs.scissorTest.rectangle.x).toEqual(defaultRS.scissorTest.rectangle.x);114 expect(rs.scissorTest.rectangle.y).toEqual(defaultRS.scissorTest.rectangle.y);115 expect(rs.scissorTest.rectangle.width).toEqual(defaultRS.scissorTest.rectangle.width);116 expect(rs.scissorTest.rectangle.height).toEqual(defaultRS.scissorTest.rectangle.height);117 expect(rs.depthRange.near).toEqual(defaultRS.depthRange.near);118 expect(rs.depthRange.far).toEqual(defaultRS.depthRange.far);119 expect(rs.depthTest.enabled).toEqual(defaultRS.depthTest.enabled);120 expect(rs.depthTest.func).toEqual(defaultRS.depthTest.func);121 expect(rs.colorMask.red).toEqual(defaultRS.colorMask.red);122 expect(rs.colorMask.green).toEqual(defaultRS.colorMask.green);123 expect(rs.colorMask.blue).toEqual(defaultRS.colorMask.blue);124 expect(rs.colorMask.alpha).toEqual(defaultRS.colorMask.alpha);125 expect(rs.depthMask).toEqual(defaultRS.depthMask);126 expect(rs.stencilMask).toEqual(defaultRS.stencilMask);127 expect(rs.blending.enabled).toEqual(defaultRS.blending.enabled);128 expect(rs.blending.color.red).toEqual(defaultRS.blending.color.red);129 expect(rs.blending.color.green).toEqual(defaultRS.blending.color.green);130 expect(rs.blending.color.blue).toEqual(defaultRS.blending.color.blue);131 expect(rs.blending.color.alpha).toEqual(defaultRS.blending.color.alpha);132 expect(rs.blending.equationRgb).toEqual(defaultRS.blending.equationRgb);133 expect(rs.blending.equationAlpha).toEqual(defaultRS.blending.equationAlpha);134 expect(rs.blending.functionSourceRgb).toEqual(defaultRS.blending.functionSourceRgb);135 expect(rs.blending.functionSourceAlpha).toEqual(defaultRS.blending.functionSourceAlpha);136 expect(rs.blending.functionDestinationRgb).toEqual(defaultRS.blending.functionDestinationRgb);137 expect(rs.blending.functionDestinationAlpha).toEqual(defaultRS.blending.functionDestinationAlpha);138 expect(rs.stencilTest.enabled).toEqual(defaultRS.stencilTest.enabled);139 expect(rs.stencilTest.frontFunction).toEqual(defaultRS.stencilTest.frontFunction);140 expect(rs.stencilTest.backFunction).toEqual(defaultRS.stencilTest.backFunction);141 expect(rs.stencilTest.reference).toEqual(defaultRS.stencilTest.reference);142 expect(rs.stencilTest.mask).toEqual(defaultRS.stencilTest.mask);143 expect(rs.stencilTest.frontOperation.fail).toEqual(defaultRS.stencilTest.frontOperation.fail);144 expect(rs.stencilTest.frontOperation.zFail).toEqual(defaultRS.stencilTest.frontOperation.zFail);145 expect(rs.stencilTest.frontOperation.zPass).toEqual(defaultRS.stencilTest.frontOperation.zPass);146 expect(rs.stencilTest.backOperation.fail).toEqual(defaultRS.stencilTest.backOperation.fail);147 expect(rs.stencilTest.backOperation.zFail).toEqual(defaultRS.stencilTest.backOperation.zFail);148 expect(rs.stencilTest.backOperation.zPass).toEqual(defaultRS.stencilTest.backOperation.zPass);149 expect(rs.sampleCoverage.enabled).toEqual(defaultRS.sampleCoverage.enabled);150 expect(rs.sampleCoverage.value).toEqual(defaultRS.sampleCoverage.value);151 expect(rs.sampleCoverage.invert).toEqual(defaultRS.sampleCoverage.invert);152 });153154 it('creates with all render states', function() {155 var r = {156 frontFace : WindingOrder.CLOCKWISE,157 cull : {158 enabled : true,159 face : WebGLConstants.FRONT160 },161 lineWidth : ContextLimits.maximumAliasedLineWidth,162 polygonOffset : {163 enabled : false,164 factor : 1,165 units : 1166 },167 scissorTest : {168 enabled : true,169 rectangle : {170 x : 1,171 y : 1,172 width : 2,173 height : 2174 }175 },176 depthRange : {177 near : 0.25,178 far : 0.75179 },180 depthTest : {181 enabled : true,182 func : WebGLConstants.GREATER183 },184 colorMask : {185 red : false,186 green : false,187 blue : false,188 alpha : false189 },190 depthMask : false,191 stencilMask : 0,192 blending : {193 enabled : true,194 color : {195 red : 1.0,196 green : 1.0,197 blue : 1.0,198 alpha : 1.0199 },200 equationRgb : WebGLConstants.FUNC_SUBTRACT,201 equationAlpha : WebGLConstants.FUNC_SUBTRACT,202 functionSourceRgb : WebGLConstants.ZERO,203 functionSourceAlpha : WebGLConstants.ZERO,204 functionDestinationRgb : WebGLConstants.ONE,205 functionDestinationAlpha : WebGLConstants.ONE206 },207 stencilTest : {208 enabled : true,209 frontFunction : WebGLConstants.NEVER,210 backFunction : WebGLConstants.NEVER,211 reference : 1,212 mask : 0,213 frontOperation : {214 fail : WebGLConstants.REPLACE,215 zFail : WebGLConstants.REPLACE,216 zPass : WebGLConstants.REPLACE217 },218 backOperation : {219 fail : WebGLConstants.REPLACE,220 zFail : WebGLConstants.REPLACE,221 zPass : WebGLConstants.REPLACE222 }223 },224 sampleCoverage : {225 enabled : true,226 value : 0.5,227 invert : true228 }229 };230231 var rs = RenderState.fromCache(r);232233 expect(rs.frontFace).toEqual(r.frontFace);234 expect(rs.cull.enabled).toEqual(r.cull.enabled);235 expect(rs.cull.face).toEqual(r.cull.face);236 expect(rs.cull.lineWidth).toEqual(r.cull.lineWidth);237 expect(rs.polygonOffset.enabled).toEqual(r.polygonOffset.enabled);238 expect(rs.polygonOffset.factor).toEqual(r.polygonOffset.factor);239 expect(rs.polygonOffset.units).toEqual(r.polygonOffset.units);240 expect(rs.scissorTest.enabled).toEqual(r.scissorTest.enabled);241 expect(rs.scissorTest.rectangle.x).toEqual(r.scissorTest.rectangle.x);242 expect(rs.scissorTest.rectangle.y).toEqual(r.scissorTest.rectangle.y);243 expect(rs.scissorTest.rectangle.width).toEqual(r.scissorTest.rectangle.width);244 expect(rs.scissorTest.rectangle.height).toEqual(r.scissorTest.rectangle.height);245 expect(rs.depthRange.near).toEqual(r.depthRange.near);246 expect(rs.depthRange.far).toEqual(r.depthRange.far);247 expect(rs.depthTest.enabled).toEqual(r.depthTest.enabled);248 expect(rs.depthTest.func).toEqual(r.depthTest.func);249 expect(rs.colorMask.red).toEqual(r.colorMask.red);250 expect(rs.colorMask.green).toEqual(r.colorMask.green);251 expect(rs.colorMask.blue).toEqual(r.colorMask.blue);252 expect(rs.colorMask.alpha).toEqual(r.colorMask.alpha);253 expect(rs.depthMask).toEqual(r.depthMask);254 expect(rs.stencilMask).toEqual(r.stencilMask);255 expect(rs.blending.enabled).toEqual(r.blending.enabled);256 expect(rs.blending.color.red).toEqual(r.blending.color.red);257 expect(rs.blending.color.green).toEqual(r.blending.color.green);258 expect(rs.blending.color.blue).toEqual(r.blending.color.blue);259 expect(rs.blending.color.alpha).toEqual(r.blending.color.alpha);260 expect(rs.blending.equationRgb).toEqual(r.blending.equationRgb);261 expect(rs.blending.equationAlpha).toEqual(r.blending.equationAlpha);262 expect(rs.blending.functionSourceRgb).toEqual(r.blending.functionSourceRgb);263 expect(rs.blending.functionSourceAlpha).toEqual(r.blending.functionSourceAlpha);264 expect(rs.blending.functionDestinationRgb).toEqual(r.blending.functionDestinationRgb);265 expect(rs.blending.functionDestinationAlpha).toEqual(r.blending.functionDestinationAlpha);266 expect(rs.stencilTest.enabled).toEqual(r.stencilTest.enabled);267 expect(rs.stencilTest.frontFunction).toEqual(r.stencilTest.frontFunction);268 expect(rs.stencilTest.backFunction).toEqual(r.stencilTest.backFunction);269 expect(rs.stencilTest.reference).toEqual(r.stencilTest.reference);270 expect(rs.stencilTest.mask).toEqual(r.stencilTest.mask);271 expect(rs.stencilTest.frontOperation.fail).toEqual(r.stencilTest.frontOperation.fail);272 expect(rs.stencilTest.frontOperation.zFail).toEqual(r.stencilTest.frontOperation.zFail);273 expect(rs.stencilTest.frontOperation.zPass).toEqual(r.stencilTest.frontOperation.zPass);274 expect(rs.stencilTest.backOperation.fail).toEqual(r.stencilTest.backOperation.fail);275 expect(rs.stencilTest.backOperation.zFail).toEqual(r.stencilTest.backOperation.zFail);276 expect(rs.stencilTest.backOperation.zPass).toEqual(r.stencilTest.backOperation.zPass);277 expect(rs.sampleCoverage.enabled).toEqual(r.sampleCoverage.enabled);278 expect(rs.sampleCoverage.value).toEqual(r.sampleCoverage.value);279 expect(rs.sampleCoverage.invert).toEqual(r.sampleCoverage.invert);280 });281282 it('creates with some render states', function() {283 var r = {284 frontFace : WindingOrder.CLOCKWISE,285 depthRange : {286 near : 0.25,287 far : 0.75288 }289 };290291 var rs = RenderState.fromCache(r);292 expect(rs.frontFace).toEqual(r.frontFace);293 expect(rs.depthRange.near).toEqual(r.depthRange.near);294 expect(rs.depthRange.far).toEqual(r.depthRange.far);295296 var defaultRS = RenderState.fromCache();297 expect(rs.cull.enabled).toEqual(defaultRS.cull.enabled);298 expect(rs.cull.face).toEqual(defaultRS.cull.face);299 expect(rs.cull.lineWidth).toEqual(defaultRS.cull.lineWidth);300 expect(rs.polygonOffset.enabled).toEqual(defaultRS.polygonOffset.enabled);301 expect(rs.polygonOffset.factor).toEqual(defaultRS.polygonOffset.factor);302 expect(rs.polygonOffset.units).toEqual(defaultRS.polygonOffset.units);303 expect(rs.scissorTest.enabled).toEqual(defaultRS.scissorTest.enabled);304 expect(rs.scissorTest.rectangle.x).toEqual(defaultRS.scissorTest.rectangle.x);305 expect(rs.scissorTest.rectangle.y).toEqual(defaultRS.scissorTest.rectangle.y);306 expect(rs.scissorTest.rectangle.width).toEqual(defaultRS.scissorTest.rectangle.width);307 expect(rs.scissorTest.rectangle.height).toEqual(defaultRS.scissorTest.rectangle.height);308 expect(rs.depthTest.enabled).toEqual(defaultRS.depthTest.enabled);309 expect(rs.depthTest.func).toEqual(defaultRS.depthTest.func);310 expect(rs.colorMask.red).toEqual(defaultRS.colorMask.red);311 expect(rs.colorMask.green).toEqual(defaultRS.colorMask.green);312 expect(rs.colorMask.blue).toEqual(defaultRS.colorMask.blue);313 expect(rs.colorMask.alpha).toEqual(defaultRS.colorMask.alpha);314 expect(rs.depthMask).toEqual(defaultRS.depthMask);315 expect(rs.stencilMask).toEqual(defaultRS.stencilMask);316 expect(rs.blending.enabled).toEqual(defaultRS.blending.enabled);317 expect(rs.blending.color.red).toEqual(defaultRS.blending.color.red);318 expect(rs.blending.color.green).toEqual(defaultRS.blending.color.green);319 expect(rs.blending.color.blue).toEqual(defaultRS.blending.color.blue);320 expect(rs.blending.color.alpha).toEqual(defaultRS.blending.color.alpha);321 expect(rs.blending.equationRgb).toEqual(defaultRS.blending.equationRgb);322 expect(rs.blending.equationAlpha).toEqual(defaultRS.blending.equationAlpha);323 expect(rs.blending.functionSourceRgb).toEqual(defaultRS.blending.functionSourceRgb);324 expect(rs.blending.functionSourceAlpha).toEqual(defaultRS.blending.functionSourceAlpha);325 expect(rs.blending.functionDestinationRgb).toEqual(defaultRS.blending.functionDestinationRgb);326 expect(rs.blending.functionDestinationAlpha).toEqual(defaultRS.blending.functionDestinationAlpha);327 expect(rs.stencilTest.enabled).toEqual(defaultRS.stencilTest.enabled);328 expect(rs.stencilTest.frontFunction).toEqual(defaultRS.stencilTest.frontFunction);329 expect(rs.stencilTest.backFunction).toEqual(defaultRS.stencilTest.backFunction);330 expect(rs.stencilTest.reference).toEqual(defaultRS.stencilTest.reference);331 expect(rs.stencilTest.mask).toEqual(defaultRS.stencilTest.mask);332 expect(rs.stencilTest.frontOperation.fail).toEqual(defaultRS.stencilTest.frontOperation.fail);333 expect(rs.stencilTest.frontOperation.zFail).toEqual(defaultRS.stencilTest.frontOperation.zFail);334 expect(rs.stencilTest.frontOperation.zPass).toEqual(defaultRS.stencilTest.frontOperation.zPass);335 expect(rs.stencilTest.backOperation.fail).toEqual(defaultRS.stencilTest.backOperation.fail);336 expect(rs.stencilTest.backOperation.zFail).toEqual(defaultRS.stencilTest.backOperation.zFail);337 expect(rs.stencilTest.backOperation.zPass).toEqual(defaultRS.stencilTest.backOperation.zPass);338 expect(rs.sampleCoverage.enabled).toEqual(defaultRS.sampleCoverage.enabled);339 expect(rs.sampleCoverage.value).toEqual(defaultRS.sampleCoverage.value);340 expect(rs.sampleCoverage.invert).toEqual(defaultRS.sampleCoverage.invert);341 });342343 it('caches render states', function() {344 var rs = RenderState.fromCache();345 var rs2 = RenderState.fromCache();346 // rs3 is still the same state as rs and rs2, but with a partial definition347 var rs3 = RenderState.fromCache({348 depthTest : {349 enabled : false,350 func : WebGLConstants.LESS351 }352 });353 // rs4 is a cache miss since it has a different depthTest354 var rs4 = RenderState.fromCache({355 depthTest : {356 enabled : true,357 func : WebGLConstants.NEVER358 }359 });360 expect(rs2).toBe(rs);361 expect(rs3).toBe(rs);362 expect(rs4).not.toBe(rs);363 });364365 it('removes from render cache', function() {366 RenderState.clearCache();367 var cache = RenderState.getCache();368369 var rs = RenderState.fromCache();370 var undefinedKey = JSON.stringify(undefined);371 var fullKey = JSON.stringify(new RenderState());372373 expect(cache[fullKey].referenceCount).toEqual(1);374 expect(cache[undefinedKey].referenceCount).toEqual(1);375376 var rs2 = RenderState.fromCache();377378 expect(cache[fullKey].referenceCount).toEqual(1);379 expect(cache[undefinedKey].referenceCount).toEqual(2);380381 // rs3 is still the same state as rs and rs2, but with a partial definition382 var param = {383 depthTest : {384 enabled : false,385 func : WebGLConstants.LESS386 }387 };388 var rs3 = RenderState.fromCache(param);389 var paramKey = JSON.stringify(param);390391 expect(rs2).toBe(rs);392 expect(rs3).toBe(rs);393394 expect(cache[fullKey].referenceCount).toEqual(2);395 expect(cache[undefinedKey].referenceCount).toEqual(2);396 expect(cache[paramKey].referenceCount).toEqual(1);397398 RenderState.removeFromCache(param);399400 expect(cache[fullKey].referenceCount).toEqual(1);401 expect(cache[undefinedKey].referenceCount).toEqual(2);402 expect(cache[paramKey]).not.toBeDefined();403404 RenderState.removeFromCache();405 RenderState.removeFromCache();406407 expect(cache[undefinedKey]).not.toBeDefined();408 expect(cache[fullKey]).not.toBeDefined();409 });410411 it('fails to create (frontFace)', function() {412 expect(function() {413 RenderState.fromCache({414 frontFace : 'invalid value'415 });416 }).toThrowDeveloperError();417 });418419 it('fails to create (cull.face)', function() {420 expect(function() {421 RenderState.fromCache({422 cull : {423 face : 'invalid value'424 }425 });426 }).toThrowDeveloperError();427 });428429 it('fails to create (small lineWidth)', function() {430 expect(function() {431 RenderState.fromCache({432 lineWidth : ContextLimits.minimumAliasedLineWidth - 1433 });434 }).toThrowDeveloperError();435 });436437 it('fails to create (large lineWidth)', function() {438 expect(function() {439 RenderState.fromCache({440 lineWidth : ContextLimits.maximumAliasedLineWidth + 1441 });442 }).toThrowDeveloperError();443 });444445 it('fails to create (negative scissorTest.rectangle.width)', function() {446 expect(function() {447 RenderState.fromCache({448 scissorTest : {449 rectangle : {450 x : 0,451 y : 0,452 width : -1,453 height : 0454 }455 }456 });457 }).toThrowDeveloperError();458 });459460 it('fails to create (negative scissorTest.rectangle.height)', function() {461 expect(function() {462 RenderState.fromCache({463 scissorTest : {464 rectangle : {465 x : 0,466 y : 0,467 width : 0,468 height : -1469 }470 }471 });472 }).toThrowDeveloperError();473 });474475 it('fails to create (near > far)', function() {476 expect(function() {477 RenderState.fromCache({478 depthRange : {479 near : 0.75,480 far : 0.25481 }482 });483 }).toThrowDeveloperError();484 });485486 it('fails to create (near < 0)', function() {487 expect(function() {488 RenderState.fromCache({489 depthRange : {490 near : -1491 }492 });493 }).toThrowDeveloperError();494 });495496 it('fails to create (far > 1)', function() {497 expect(function() {498 RenderState.fromCache({499 depthRange : {500 far : 2501 }502 });503 }).toThrowDeveloperError();504 });505506 it('fails to create (depthTest.func)', function() {507 expect(function() {508 RenderState.fromCache({509 depthTest : {510 func : 'invalid value'511 }512 });513 }).toThrowDeveloperError();514 });515516 it('fails to create (blending.color < 0)', function() {517 expect(function() {518 RenderState.fromCache({519 blending : {520 color : {521 red : -1.0,522 green : 0.0,523 blue : 0.0,524 alpha : 0.0525 }526 }527 });528 }).toThrowDeveloperError();529 });530531 it('fails to create (blending.color > 1)', function() {532 expect(function() {533 RenderState.fromCache({534 blending: {535 color: {536 red: 0.0,537 green: 0.0,538 blue: 0.0,539 alpha: 2.0540 }541 }542 });543 }).toThrowDeveloperError();544 });545546 it('fails to create (blend.equationRgb)', function() {547 expect(function() {548 RenderState.fromCache({549 blending: {550 equationRgb: 'invalid value'551 }552 });553 }).toThrowDeveloperError();554 });555556 it('fails to create (blend.equationAlpha)', function() {557 expect(function() {558 RenderState.fromCache({559 blending: {560 equationAlpha: 'invalid value'561 }562 });563 }).toThrowDeveloperError();564 });565566 it('fails to create (blend.functionSourceRgb)', function() {567 expect(function() {568 RenderState.fromCache({569 blending: {570 functionSourceRgb: 'invalid value'571 }572 });573 }).toThrowDeveloperError();574 });575576 it('fails to create (blend.functionSourceAlpha)', function() {577 expect(function() {578 RenderState.fromCache({579 blending: {580 functionSourceAlpha: 'invalid value'581 }582 });583 }).toThrowDeveloperError();584 });585586 it('fails to create (blend.functionDestinationRgb)', function() {587 expect(function() {588 RenderState.fromCache({589 blending: {590 functionDestinationRgb: 'invalid value'591 }592 });593 }).toThrowDeveloperError();594 });595596 it('fails to create (blend.functionDestinationAlpha)', function() {597 expect(function() {598 RenderState.fromCache({599 blending: {600 functionDestinationAlpha: 'invalid value'601 }602 });603 }).toThrowDeveloperError();604 });605606 it('fails to create (stencilTest.frontFunction)', function() {607 expect(function() {608 RenderState.fromCache({609 stencilTest: {610 frontFunction: 'invalid value'611 }612 });613 }).toThrowDeveloperError();614 });615616 it('fails to create (stencilTest.backFunction)', function() {617 expect(function() {618 RenderState.fromCache({619 stencilTest: {620 backFunction: 'invalid value'621 }622 });623 }).toThrowDeveloperError();624 });625626 it('fails to create (stencilTest.frontOperation.fail)', function() {627 expect(function() {628 RenderState.fromCache({629 stencilTest: {630 frontOperation: {631 fail: 'invalid value'632 }633 }634 });635 }).toThrowDeveloperError();636 });637638 it('fails to create (stencilTest.frontOperation.zFail)', function() {639 expect(function() {640 RenderState.fromCache({641 stencilTest: {642 frontOperation: {643 zFail: 'invalid value'644 }645 }646 });647 }).toThrowDeveloperError();648 });649650 it('fails to create (stencilTest.frontOperation.zPass)', function() {651 expect(function() {652 RenderState.fromCache({653 stencilTest: {654 frontOperation: {655 zPass: 'invalid value'656 }657 }658 });659 }).toThrowDeveloperError();660 });661662 it('fails to create (stencilTest.backOperation.fail)', function() {663 expect(function() {664 RenderState.fromCache({665 stencilTest: {666 backOperation: {667 fail: 'invalid value'668 }669 }670 });671 }).toThrowDeveloperError();672 });673674 it('fails to create (stencilTest.backOperation.zFail)', function() {675 expect(function() {676 RenderState.fromCache({677 stencilTest: {678 backOperation: {679 zFail: 'invalid value'680 }681 }682 });683 }).toThrowDeveloperError();684 });685686 it('fails to create (stencilTest.backOperation.zPass)', function() {687 expect(function() {688 RenderState.fromCache({689 stencilTest: {690 backOperation: {691 zPass: 'invalid value'692 }693 }694 });695 }).toThrowDeveloperError();696 });697698 it('fails to get state without renderState', function() {699 expect(function() {700 RenderState.getState(undefined);701 }).toThrowDeveloperError();702 });703704 it('clones', function() {705 var r = {706 frontFace : WindingOrder.CLOCKWISE,707 cull : {708 enabled : true,709 face : WebGLConstants.FRONT710 },711 lineWidth : ContextLimits.maximumAliasedLineWidth,712 polygonOffset : {713 enabled : false,714 factor : 1,715 units : 1716 },717 scissorTest : {718 enabled : true,719 rectangle : {720 x : 1,721 y : 1,722 width : 2,723 height : 2724 }725 },726 depthRange : {727 near : 0.25,728 far : 0.75729 },730 depthTest : {731 enabled : true,732 func : WebGLConstants.GREATER733 },734 colorMask : {735 red : false,736 green : false,737 blue : false,738 alpha : false739 },740 depthMask : false,741 stencilMask : 0,742 blending : {743 enabled : true,744 color : {745 red : 1.0,746 green : 1.0,747 blue : 1.0,748 alpha : 1.0749 },750 equationRgb : WebGLConstants.FUNC_SUBTRACT,751 equationAlpha : WebGLConstants.FUNC_SUBTRACT,752 functionSourceRgb : WebGLConstants.ZERO,753 functionSourceAlpha : WebGLConstants.ZERO,754 functionDestinationRgb : WebGLConstants.ONE,755 functionDestinationAlpha : WebGLConstants.ONE756 },757 stencilTest : {758 enabled : true,759 frontFunction : WebGLConstants.NEVER,760 backFunction : WebGLConstants.NEVER,761 reference : 1,762 mask : 0,763 frontOperation : {764 fail : WebGLConstants.REPLACE,765 zFail : WebGLConstants.REPLACE,766 zPass : WebGLConstants.REPLACE767 },768 backOperation : {769 fail : WebGLConstants.REPLACE,770 zFail : WebGLConstants.REPLACE,771 zPass : WebGLConstants.REPLACE772 }773 },774 sampleCoverage : {775 enabled : true,776 value : 0.5,777 invert : true778 }779 };780781 var rs = RenderState.fromCache(RenderState.getState(r));782783 expect(rs.frontFace).toEqual(r.frontFace);784 expect(rs.cull.enabled).toEqual(r.cull.enabled);785 expect(rs.cull.face).toEqual(r.cull.face);786 expect(rs.cull.lineWidth).toEqual(r.cull.lineWidth);787 expect(rs.polygonOffset.enabled).toEqual(r.polygonOffset.enabled);788 expect(rs.polygonOffset.factor).toEqual(r.polygonOffset.factor);789 expect(rs.polygonOffset.units).toEqual(r.polygonOffset.units);790 expect(rs.scissorTest.enabled).toEqual(r.scissorTest.enabled);791 expect(rs.scissorTest.rectangle.x).toEqual(r.scissorTest.rectangle.x);792 expect(rs.scissorTest.rectangle.y).toEqual(r.scissorTest.rectangle.y);793 expect(rs.scissorTest.rectangle.width).toEqual(r.scissorTest.rectangle.width);794 expect(rs.scissorTest.rectangle.height).toEqual(r.scissorTest.rectangle.height);795 expect(rs.depthRange.near).toEqual(r.depthRange.near);796 expect(rs.depthRange.far).toEqual(r.depthRange.far);797 expect(rs.depthTest.enabled).toEqual(r.depthTest.enabled);798 expect(rs.depthTest.func).toEqual(r.depthTest.func);799 expect(rs.colorMask.red).toEqual(r.colorMask.red);800 expect(rs.colorMask.green).toEqual(r.colorMask.green);801 expect(rs.colorMask.blue).toEqual(r.colorMask.blue);802 expect(rs.colorMask.alpha).toEqual(r.colorMask.alpha);803 expect(rs.depthMask).toEqual(r.depthMask);804 expect(rs.stencilMask).toEqual(r.stencilMask);805 expect(rs.blending.enabled).toEqual(r.blending.enabled);806 expect(rs.blending.color.red).toEqual(r.blending.color.red);807 expect(rs.blending.color.green).toEqual(r.blending.color.green);808 expect(rs.blending.color.blue).toEqual(r.blending.color.blue);809 expect(rs.blending.color.alpha).toEqual(r.blending.color.alpha);810 expect(rs.blending.equationRgb).toEqual(r.blending.equationRgb);811 expect(rs.blending.equationAlpha).toEqual(r.blending.equationAlpha);812 expect(rs.blending.functionSourceRgb).toEqual(r.blending.functionSourceRgb);813 expect(rs.blending.functionSourceAlpha).toEqual(r.blending.functionSourceAlpha);814 expect(rs.blending.functionDestinationRgb).toEqual(r.blending.functionDestinationRgb);815 expect(rs.blending.functionDestinationAlpha).toEqual(r.blending.functionDestinationAlpha);816 expect(rs.stencilTest.enabled).toEqual(r.stencilTest.enabled);817 expect(rs.stencilTest.frontFunction).toEqual(r.stencilTest.frontFunction);818 expect(rs.stencilTest.backFunction).toEqual(r.stencilTest.backFunction);819 expect(rs.stencilTest.reference).toEqual(r.stencilTest.reference);820 expect(rs.stencilTest.mask).toEqual(r.stencilTest.mask);821 expect(rs.stencilTest.frontOperation.fail).toEqual(r.stencilTest.frontOperation.fail);822 expect(rs.stencilTest.frontOperation.zFail).toEqual(r.stencilTest.frontOperation.zFail);823 expect(rs.stencilTest.frontOperation.zPass).toEqual(r.stencilTest.frontOperation.zPass);824 expect(rs.stencilTest.backOperation.fail).toEqual(r.stencilTest.backOperation.fail);825 expect(rs.stencilTest.backOperation.zFail).toEqual(r.stencilTest.backOperation.zFail);826 expect(rs.stencilTest.backOperation.zPass).toEqual(r.stencilTest.backOperation.zPass);827 expect(rs.sampleCoverage.enabled).toEqual(r.sampleCoverage.enabled);828 expect(rs.sampleCoverage.value).toEqual(r.sampleCoverage.value);829 expect(rs.sampleCoverage.invert).toEqual(r.sampleCoverage.invert);830 });831 ...

Full Screen

Full Screen

v52.js

Source:v52.js Github

copy

Full Screen

1// Netratings SiteCensus v52.js2// COPYRIGHT 2006 Nielsen//Netratings3function random()4{5 random.seed = (random.seed*random.a + random.c) % random.m;6 return random.seed / random.m;7}8random.m=714025;9random.a=4096;10random.c=150889;11random.seed = (new Date()).getTime()%random.m;12function _rsEH(){}13window.onerror=_rsEH;14var _rsLP=location.protocol.indexOf('https')>-1?'https:':'http:';15var _rsND=_rsLP+_rsDN;16var _rsRD=(new Date()).getTime();17if (typeof(_rsCC)=="undefined") {var _rsCC=1;} // cookie check18if (typeof(_rsDT)=="undefined") {var _rsDT=0;} // doc.title19if (typeof(_rsSE)=="undefined") {var _rsSE=0;} // surveys enabled20if (typeof(_rsSV)=="undefined") {var _rsSV="";} // survey id21if (typeof(_rsSM)=="undefined") {var _rsSM=0;} // sample rate22if (typeof(_rsSS)=="undefined") {var _rsSS=1;} // sample size23if (typeof(_rsUT)=="undefined") {var _rsUT=0;} // use custom tags24if (typeof(_rsMP)=="undefined") {var _rsMP=1;} // measure page25if (typeof(_rsIP)=="undefined") {var _rsIP=0;} // use invisible pixel26if (typeof(_rsTC)=="undefined") {var _rsTC=500;} // click timeout (_rsClick)27if (typeof(_rsSI)=="undefined") {var _rsSI=escape(window.location);}28if (typeof(_rsC0)=="undefined") {var _rsC0;}29if (typeof(_rsC1)=="undefined") {var _rsC1;}30if (typeof(_rsC2)=="undefined") {var _rsC2;}31if (typeof(_rsC3)=="undefined") {var _rsC3;}32if (typeof(_rsC4)=="undefined") {var _rsC4;}33if (typeof(_rsC5)=="undefined") {var _rsC5;}34if (typeof(_rsC6)=="undefined") {var _rsC6;}35if (typeof(_rsC7)=="undefined") {var _rsC7;}36if (typeof(_rsC8)=="undefined") {var _rsC8;}37if (typeof(_rsC9)=="undefined") {var _rsC9;}38var _rsClickDst;39function _rsClick(_clickDest)40{41 var _pixelSrc;42 var _pixel;43 var _eClickDest = escape(_clickDest);44 _rsClickDst = _clickDest;45 _pixelSrc = _rsND+'cgi-bin/m?rnd='+(new Date()).getTime();46 _pixelSrc = _pixelSrc+'&ci='+_rsCI;47 _pixelSrc = _pixelSrc+'&cg='+escape(_rsCG);48 _pixelSrc = _pixelSrc+'&cc='+_rsCC;49 _pixelSrc = _pixelSrc+'&si='+_rsCI+'-ctgw-'+_eClickDest;50 _pixelSrc = _pixelSrc+'&rp='+escape(window.location);51 _pixel = new Image(1,1);52 _pixel.src = _pixelSrc;53 setTimeout("window.location = _rsClickDst", _rsTC);54}55function rsCi()56{57 var _rsUA=navigator.appName+" "+navigator.appVersion;58 var _rsRUA=navigator.userAgent;59 var _rsWS=window.screen;60 var _rsBV=navigator.appVersion.substring(0, 1);61 var _rsNN=(_rsUA.indexOf('Netscape'));62 var _rsMC=(_rsUA.indexOf('Mac'));63 var _rsIE=(_rsUA.indexOf('MSIE'));64 var _rsOP=(_rsRUA.indexOf('Opera'));65 var _rsIEV=(parseInt(_rsUA.substr(_rsIE+5)));66 var _rsRP=escape(document.referrer);67 var _rsSR;68 var _rsCD;69 var _rsLG;70 var _rsJE;71 var _rsCK;72 var _rsTZ;73 var _rsCT;74 var _rsHP;75 var _rsTL;76 var _rsSW;77 var _rsSH;78 if (_rsMP==0) {return;}79 _rsJE=(navigator.javaEnabled()==true)?"y":"n";80 if (_rsDT==1) {81 _rsTL=escape(document.title);82 }83 if((_rsIE>0)||((_rsNN!=-1)&&(_rsBV >=5))) {84 _rsCK=(navigator.cookieEnabled==true)?"y":"n";85 }86 if((_rsIE>=0)&&(_rsIEV>=5)&&(_rsMC==-1)&&(_rsOP==-1)) {87 document.body.addBehavior("#default#clientCaps");88 _rsCT=document.body.connectionType;89 document.body.addBehavior("#default#homePage");90 _rsHP=(document.body.isHomePage(location.href))?"y":"n";91 }92 var _rsD = new Date();93 _rsTZ = _rsD.getTimezoneOffset()/-60;94 if((typeof(_rsWS)!="undefined")&&(_rsWS!=null)) {95 _rsSW=_rsWS.width;96 _rsSH=_rsWS.height;97 _rsCD=_rsWS.colorDepth;98 _rsSR=_rsSW+'x'+_rsSH;99 if((_rsNN!=-1)&&(_rsBV >=4)) {100 _rsCD=_rsWS.pixelDepth;101 }102 }103 if((_rsNN!=-1)&&(_rsBV >=4)||(_rsOP>=0)) {104 _rsLG=navigator.language;105 }106 if((_rsIE!=-1)&&(_rsBV >=4)&&(_rsOP==-1)) {107 _rsLG=navigator.userLanguage;108 }109 110 var _rsPR="";111 _rsPR='<img src="';112 _rsPR=_rsPR+_rsND+'cgi-bin/m?rnd='+(new Date()).getTime();113 _rsPR=_rsPR+'&ci='+_rsCI;114 _rsPR=_rsPR+'&cg='+escape(_rsCG);115 _rsPR=_rsPR+'&cc='+_rsCC;116 if (_rsSR!=null) {_rsPR=_rsPR+'&sr='+_rsSR;}117 if (_rsCD!=null) {_rsPR=_rsPR+'&cd='+_rsCD;}118 if (_rsLG!=null) {_rsPR=_rsPR+'&lg='+_rsLG;}119 if (_rsJE!=null) {_rsPR=_rsPR+'&je='+_rsJE;}120 if (_rsCK!=null) {_rsPR=_rsPR+'&ck='+_rsCK;}121 if (_rsTZ!=null) {_rsPR=_rsPR+'&tz='+_rsTZ;}122 if (_rsCT!=null) {_rsPR=_rsPR+'&ct='+_rsCT;}123 if (_rsHP!=null) {_rsPR=_rsPR+'&hp='+_rsHP;}124 if (_rsTL!=null) {_rsPR=_rsPR+'&tl='+_rsTL;}125 if (_rsUT==1) {126 if (_rsC0!=null) {_rsPR=_rsPR+'&c0='+escape(_rsC0);}127 if (_rsC1!=null) {_rsPR=_rsPR+'&c1='+escape(_rsC1);}128 if (_rsC2!=null) {_rsPR=_rsPR+'&c2='+escape(_rsC2);}129 if (_rsC3!=null) {_rsPR=_rsPR+'&c3='+escape(_rsC3);}130 if (_rsC4!=null) {_rsPR=_rsPR+'&c4='+escape(_rsC4);}131 if (_rsC5!=null) {_rsPR=_rsPR+'&c5='+escape(_rsC5);}132 if (_rsC6!=null) {_rsPR=_rsPR+'&c6='+escape(_rsC6);}133 if (_rsC7!=null) {_rsPR=_rsPR+'&c7='+escape(_rsC7);}134 if (_rsC8!=null) {_rsPR=_rsPR+'&c8='+escape(_rsC8);}135 if (_rsC9!=null) {_rsPR=_rsPR+'&c9='+escape(_rsC9);}136 }137 _rsPR=_rsPR+'&si='+_rsSI;138 _rsPR=_rsPR+'&rp='+_rsRP;139 if (_rsIP==1) {_rsPR=_rsPR+'" style="visibility:hidden;position:absolute;left:0px;top:0px;z-index:-1';}140 _rsPR=_rsPR+'" width="1" height="1" alt=""/>';141 document.write(_rsPR);142}143if((_rsSE)&&(random() <= _rsSM)) {144 var _rsIM='<scr'+'ipt language="JavaScript" type="text/javascript" src="'+_rsND+'cgi-bin/j?ci='+_rsCI+'&ss='+_rsSS+'&cc='+_rsCC+'&rd='+_rsRD+'&se='+_rsSE+'&sv='+_rsSV+'"><\/scr'+'ipt>';145 document.write(_rsIM);146}147else {148 rsCi();...

Full Screen

Full Screen

unicodeWords.js

Source:unicodeWords.js Github

copy

Full Screen

1/** Used to compose unicode character classes. */2const rsAstralRange = '\\ud800-\\udfff'3const rsComboMarksRange = '\\u0300-\\u036f'4const reComboHalfMarksRange = '\\ufe20-\\ufe2f'5const rsComboSymbolsRange = '\\u20d0-\\u20ff'6const rsComboMarksExtendedRange = '\\u1ab0-\\u1aff'7const rsComboMarksSupplementRange = '\\u1dc0-\\u1dff'8const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange9const rsDingbatRange = '\\u2700-\\u27bf'10const rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff'11const rsMathOpRange = '\\xac\\xb1\\xd7\\xf7'12const rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf'13const rsPunctuationRange = '\\u2000-\\u206f'14const rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000'15const rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde'16const rsVarRange = '\\ufe0e\\ufe0f'17const rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange18/** Used to compose unicode capture groups. */19const rsApos = "['\u2019]"20const rsBreak = `[${rsBreakRange}]`21const rsCombo = `[${rsComboRange}]`22const rsDigit = '\\d'23const rsDingbat = `[${rsDingbatRange}]`24const rsLower = `[${rsLowerRange}]`25const rsMisc = `[^${rsAstralRange}${rsBreakRange + rsDigit + rsDingbatRange + rsLowerRange + rsUpperRange}]`26const rsFitz = '\\ud83c[\\udffb-\\udfff]'27const rsModifier = `(?:${rsCombo}|${rsFitz})`28const rsNonAstral = `[^${rsAstralRange}]`29const rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}'30const rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]'31const rsUpper = `[${rsUpperRange}]`32const rsZWJ = '\\u200d'33/** Used to compose unicode regexes. */34const rsMiscLower = `(?:${rsLower}|${rsMisc})`35const rsMiscUpper = `(?:${rsUpper}|${rsMisc})`36const rsOptContrLower = `(?:${rsApos}(?:d|ll|m|re|s|t|ve))?`37const rsOptContrUpper = `(?:${rsApos}(?:D|LL|M|RE|S|T|VE))?`38const reOptMod = `${rsModifier}?`39const rsOptVar = `[${rsVarRange}]?`40const rsOptJoin = `(?:${rsZWJ}(?:${[rsNonAstral, rsRegional, rsSurrPair].join('|')})${rsOptVar + reOptMod})*`41const rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])'42const rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])'43const rsSeq = rsOptVar + reOptMod + rsOptJoin44const rsEmoji = `(?:${[rsDingbat, rsRegional, rsSurrPair].join('|')})${rsSeq}`45const reUnicodeWords = RegExp([46 `${rsUpper}?${rsLower}+${rsOptContrLower}(?=${[rsBreak, rsUpper, '$'].join('|')})`,47 `${rsMiscUpper}+${rsOptContrUpper}(?=${[rsBreak, rsUpper + rsMiscLower, '$'].join('|')})`,48 `${rsUpper}?${rsMiscLower}+${rsOptContrLower}`,49 `${rsUpper}+${rsOptContrUpper}`,50 rsOrdUpper,51 rsOrdLower,52 `${rsDigit}+`,53 rsEmoji54].join('|'), 'g')55/**56 * Splits a Unicode `string` into an array of its words.57 *58 * @private59 * @param {string} The string to inspect.60 * @returns {Array} Returns the words of `string`.61 */62function unicodeWords(string) {63 return string.match(reUnicodeWords)64}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = require('webpagetest');10var wpt = new WebPageTest('www.webpagetest.org');11}, function(err, data) {12 if (err) {13 console.log(err);14 } else {15 console.log(data);16 }17});18var wpt = require('webpagetest');19var wpt = new WebPageTest('www.webpagetest.org');20wpt.getTestResults('140725_5G_6d8e7e8d6c1b7d1e2f2c7c8d6a0c7f2f', function(err, data) {21 if (err) {22 console.log(err);23 } else {24 console.log(data);25 }26});27var wpt = require('webpagetest');28var wpt = new WebPageTest('www.webpagetest.org');29wpt.getLocations(function(err, data) {30 if (err) {31 console.log(err);32 } else {33 console.log(data);34 }35});36var wpt = require('webpagetest');37var wpt = new WebPageTest('www.webpagetest.org');38wpt.getTesters(function(err, data) {39 if (err) {40 console.log(err);41 } else {42 console.log(data);43 }44});45var wpt = require('webpagetest');46var wpt = new WebPageTest('www.webpagetest.org');47wpt.getTesters(function(err, data) {48 if (err) {49 console.log(err);50 } else {51 console.log(data);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test status:', data.statusText);5 wpt.getTestResults(data.data.testId, function(err, data) {6 if (err) return console.error(err);7 console.log('SpeedIndex:', data.data.average.firstView.SpeedIndex);8 });9});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var api = new wpt('www.webpagetest.org');3var options = {4 lighthouseConfig: {5 "settings": {6 }7 },8 lighthouseThrottling: {9 },10 lighthouseBudget: {11 },

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var rs = wptools.rs('Albert Einstein');3rs.then(function(result) {4 console.log(result);5});6var wptools = require('wptools');7var rs = wptools.rs('Albert Einstein');8rs.then(function(result) {9 console.log(result);10});11var wptools = require('wptools');12var rs = wptools.rs('Albert Einstein');13rs.then(function(result) {14 console.log(result);15});16var wptools = require('wptools');17var rs = wptools.rs('Albert Einstein');18rs.then(function(result) {19 console.log(result);20});21var wptools = require('wptools');22var rs = wptools.rs('Albert Einstein');23rs.then(function(result) {24 console.log(result);25});26var wptools = require('wptools');27var rs = wptools.rs('Albert Einstein');28rs.then(function(result) {29 console.log(result);30});31var wptools = require('wptools');32var rs = wptools.rs('Albert Einstein');33rs.then(function(result) {34 console.log(result);35});36var wptools = require('wptools');37var rs = wptools.rs('Albert Einstein');38rs.then(function(result) {39 console.log(result);40});41var wptools = require('wptools');42var rs = wptools.rs('Albert Einstein');43rs.then(function(result) {44 console.log(result);45});46var wptools = require('wptools');47var rs = wptools.rs('Albert Einstein');48rs.then(function(result) {49 console.log(result);50});51var wptools = require('wptools');52var rs = wptools.rs('Albert Einstein');53rs.then(function(result) {54 console.log(result);55});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest')('API_KEY');2}, function(err, data) {3 if (err) return console.error(err);4 console.log(data);5});6var wpt = require('webpagetest')('API_KEY');7}, function(err, data) {8 if (err) return console.error(err);9 console.log(data);10});11var wpt = require('webpagetest')('API_KEY');12wpt.getTestResults('170321_0S_7d4f6a4e7c4b4a4b4c4a4b4c4a4a4b4', function(err, data) {13 if (err) return console.error(err);14 console.log(data);15});16var wpt = require('webpagetest')('API_KEY');17wpt.getTestStatus('170321_0S_7d4f6a4e7c4b4a4b4c4a4b4c4a4a4b4', function(err, data) {18 if (err) return console.error(err);19 console.log(data);20});21var wpt = require('webpagetest')('API_KEY');22wpt.getLocations(function(err, data) {23 if (err) return console.error(err);24 console.log(data);25});26var wpt = require('webpagetest')('API_KEY');27wpt.getTesters(function(err, data) {28 if (err) return

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var rs = new wptoolkit.rs();3var rs2 = new wptoolkit.rs();4rs.on('message', function(msg){5 console.log(msg);6});7rs2.on('message', function(msg){8 console.log(msg);9});10rs.on('error', function(err){11 console.log(err);12});13rs2.on('error', function(err){14 console.log(err);15});16rs.start({17 'agent': 'Mozilla/5.0 (Windows NT 6.1; rv:20.0) Gecko/20100101 Firefox/20.0',18 'headers': {19 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',20 'Accept-Language': 'en-US,en;q=0.5',21 },22 'cookies': {23 },24});25rs2.start({26 'agent': 'Mozilla/5.0 (Windows NT 6.1; rv:20.0) Gecko/20100101 Firefox/20.0',27 'headers': {28 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',29 'Accept-Language': 'en-US,en;q=0.5',30 },31 'cookies': {32 },33});34echo "hello world";

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptool = require('wptool');2var wp = new wptool();3wp.setSelector('input[name="q"]');4wp.setMethod('rs');5wp.execute(function(err, data){6 if(err){7 console.log(err);8 }else{9 console.log(data);10 }11});

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