How to use pause method in Cypress

Best JavaScript code snippet using cypress

code1.js

Source:code1.js Github

copy

Full Screen

1gdjs.PauseCode = {};2gdjs.PauseCode.GDplayerKnightObjects1= [];3gdjs.PauseCode.GDplayerKnightObjects2= [];4gdjs.PauseCode.GDplayerWeaponObjects1= [];5gdjs.PauseCode.GDplayerWeaponObjects2= [];6gdjs.PauseCode.GDdemonObjects1= [];7gdjs.PauseCode.GDdemonObjects2= [];8gdjs.PauseCode.GDsentryObjects1= [];9gdjs.PauseCode.GDsentryObjects2= [];10gdjs.PauseCode.GDprojectileObjects1= [];11gdjs.PauseCode.GDprojectileObjects2= [];12gdjs.PauseCode.GDexplosionObjects1= [];13gdjs.PauseCode.GDexplosionObjects2= [];14gdjs.PauseCode.GDGameOverObjects1= [];15gdjs.PauseCode.GDGameOverObjects2= [];16gdjs.PauseCode.GDfloorObjects1= [];17gdjs.PauseCode.GDfloorObjects2= [];18gdjs.PauseCode.GDwallObjects1= [];19gdjs.PauseCode.GDwallObjects2= [];20gdjs.PauseCode.GDwallRightObjects1= [];21gdjs.PauseCode.GDwallRightObjects2= [];22gdjs.PauseCode.GDwallLeftObjects1= [];23gdjs.PauseCode.GDwallLeftObjects2= [];24gdjs.PauseCode.GDdoorObjects1= [];25gdjs.PauseCode.GDdoorObjects2= [];26gdjs.PauseCode.GDspikesObjects1= [];27gdjs.PauseCode.GDspikesObjects2= [];28gdjs.PauseCode.GDholeObjects1= [];29gdjs.PauseCode.GDholeObjects2= [];30gdjs.PauseCode.GDplayerHPObjects1= [];31gdjs.PauseCode.GDplayerHPObjects2= [];32gdjs.PauseCode.GDframerateObjects1= [];33gdjs.PauseCode.GDframerateObjects2= [];34gdjs.PauseCode.GDhealthBarObjects1= [];35gdjs.PauseCode.GDhealthBarObjects2= [];36gdjs.PauseCode.GDpermaSpikeObjects1= [];37gdjs.PauseCode.GDpermaSpikeObjects2= [];38gdjs.PauseCode.GDhealthBarBackgroundObjects1= [];39gdjs.PauseCode.GDhealthBarBackgroundObjects2= [];40gdjs.PauseCode.GDcoinObjects1= [];41gdjs.PauseCode.GDcoinObjects2= [];42gdjs.PauseCode.GDpodiumObjects1= [];43gdjs.PauseCode.GDpodiumObjects2= [];44gdjs.PauseCode.GDcoinImageObjects1= [];45gdjs.PauseCode.GDcoinImageObjects2= [];46gdjs.PauseCode.GDcoinScoreObjects1= [];47gdjs.PauseCode.GDcoinScoreObjects2= [];48gdjs.PauseCode.GDlevelCompleteObjects1= [];49gdjs.PauseCode.GDlevelCompleteObjects2= [];50gdjs.PauseCode.GDobjectiveObjects1= [];51gdjs.PauseCode.GDobjectiveObjects2= [];52gdjs.PauseCode.GDswordIconObjects1= [];53gdjs.PauseCode.GDswordIconObjects2= [];54gdjs.PauseCode.GDenemyHealthBarObjects1= [];55gdjs.PauseCode.GDenemyHealthBarObjects2= [];56gdjs.PauseCode.GDhealthPowerupObjects1= [];57gdjs.PauseCode.GDhealthPowerupObjects2= [];58gdjs.PauseCode.GDhealthIncreasedTextObjects1= [];59gdjs.PauseCode.GDhealthIncreasedTextObjects2= [];60gdjs.PauseCode.GDswordPowerupObjects1= [];61gdjs.PauseCode.GDswordPowerupObjects2= [];62gdjs.PauseCode.GDdamageIncreasedTextObjects1= [];63gdjs.PauseCode.GDdamageIncreasedTextObjects2= [];64gdjs.PauseCode.GDHPpotionObjects1= [];65gdjs.PauseCode.GDHPpotionObjects2= [];66gdjs.PauseCode.GDHPpotionTextObjects1= [];67gdjs.PauseCode.GDHPpotionTextObjects2= [];68gdjs.PauseCode.GDmaxHPObjects1= [];69gdjs.PauseCode.GDmaxHPObjects2= [];70gdjs.PauseCode.GDinvinciblePowerupObjects1= [];71gdjs.PauseCode.GDinvinciblePowerupObjects2= [];72gdjs.PauseCode.GDinvincibleTextObjects1= [];73gdjs.PauseCode.GDinvincibleTextObjects2= [];74gdjs.PauseCode.GDogreObjects1= [];75gdjs.PauseCode.GDogreObjects2= [];76gdjs.PauseCode.GDzombieObjects1= [];77gdjs.PauseCode.GDzombieObjects2= [];78gdjs.PauseCode.GDwizardObjects1= [];79gdjs.PauseCode.GDwizardObjects2= [];80gdjs.PauseCode.GDopenDoorObjects1= [];81gdjs.PauseCode.GDopenDoorObjects2= [];82gdjs.PauseCode.GDlavaObjects1= [];83gdjs.PauseCode.GDlavaObjects2= [];84gdjs.PauseCode.GDlavaBaseObjects1= [];85gdjs.PauseCode.GDlavaBaseObjects2= [];86gdjs.PauseCode.GDtrapTriggerObjects1= [];87gdjs.PauseCode.GDtrapTriggerObjects2= [];88gdjs.PauseCode.GDwizardProjectileObjects1= [];89gdjs.PauseCode.GDwizardProjectileObjects2= [];90gdjs.PauseCode.GDpathOpenedObjects1= [];91gdjs.PauseCode.GDpathOpenedObjects2= [];92gdjs.PauseCode.GDfogObjects1= [];93gdjs.PauseCode.GDfogObjects2= [];94gdjs.PauseCode.GDblockerObjects1= [];95gdjs.PauseCode.GDblockerObjects2= [];96gdjs.PauseCode.GDmainMenuObjects1= [];97gdjs.PauseCode.GDmainMenuObjects2= [];98gdjs.PauseCode.GDquitButtonObjects1= [];99gdjs.PauseCode.GDquitButtonObjects2= [];100gdjs.PauseCode.GDdeathsObjects1= [];101gdjs.PauseCode.GDdeathsObjects2= [];102gdjs.PauseCode.GDpausedObjects1= [];103gdjs.PauseCode.GDpausedObjects2= [];104gdjs.PauseCode.GDNewObjectObjects1= [];105gdjs.PauseCode.GDNewObjectObjects2= [];106gdjs.PauseCode.GDresumeObjects1= [];107gdjs.PauseCode.GDresumeObjects2= [];108gdjs.PauseCode.GDresumeButtonObjects1= [];109gdjs.PauseCode.GDresumeButtonObjects2= [];110gdjs.PauseCode.conditionTrue_0 = {val:false};111gdjs.PauseCode.condition0IsTrue_0 = {val:false};112gdjs.PauseCode.condition1IsTrue_0 = {val:false};113gdjs.PauseCode.condition2IsTrue_0 = {val:false};114gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDresumeButtonObjects1Objects = Hashtable.newFrom({"resumeButton": gdjs.PauseCode.GDresumeButtonObjects1});gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDquitButtonObjects1Objects = Hashtable.newFrom({"quitButton": gdjs.PauseCode.GDquitButtonObjects1});gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDresumeButtonObjects1Objects = Hashtable.newFrom({"resumeButton": gdjs.PauseCode.GDresumeButtonObjects1});gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDquitButtonObjects1Objects = Hashtable.newFrom({"quitButton": gdjs.PauseCode.GDquitButtonObjects1});gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDresumeButtonObjects1Objects = Hashtable.newFrom({"resumeButton": gdjs.PauseCode.GDresumeButtonObjects1});gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDquitButtonObjects1Objects = Hashtable.newFrom({"quitButton": gdjs.PauseCode.GDquitButtonObjects1});gdjs.PauseCode.eventsList0xb2358 = function(runtimeScene) {115{116gdjs.PauseCode.condition0IsTrue_0.val = false;117{118gdjs.PauseCode.condition0IsTrue_0.val = gdjs.evtTools.runtimeScene.sceneJustBegins(runtimeScene);119}if (gdjs.PauseCode.condition0IsTrue_0.val) {120gdjs.PauseCode.GDquitButtonObjects1.createFrom(runtimeScene.getObjects("quitButton"));121gdjs.PauseCode.GDresumeButtonObjects1.createFrom(runtimeScene.getObjects("resumeButton"));122{for(var i = 0, len = gdjs.PauseCode.GDresumeButtonObjects1.length ;i < len;++i) {123    gdjs.PauseCode.GDresumeButtonObjects1[i].hide();124}125}{for(var i = 0, len = gdjs.PauseCode.GDquitButtonObjects1.length ;i < len;++i) {126    gdjs.PauseCode.GDquitButtonObjects1[i].hide();127}128}}129}130{131gdjs.PauseCode.GDresumeButtonObjects1.createFrom(runtimeScene.getObjects("resumeButton"));132gdjs.PauseCode.condition0IsTrue_0.val = false;133{134gdjs.PauseCode.condition0IsTrue_0.val = gdjs.evtTools.input.cursorOnObject(gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDresumeButtonObjects1Objects, runtimeScene, true, true);135}if (gdjs.PauseCode.condition0IsTrue_0.val) {136gdjs.PauseCode.GDresumeObjects1.createFrom(runtimeScene.getObjects("resume"));137{for(var i = 0, len = gdjs.PauseCode.GDresumeObjects1.length ;i < len;++i) {138    gdjs.PauseCode.GDresumeObjects1[i].setColor("255;255;255");139}140}}141}142{143gdjs.PauseCode.GDquitButtonObjects1.createFrom(runtimeScene.getObjects("quitButton"));144gdjs.PauseCode.condition0IsTrue_0.val = false;145{146gdjs.PauseCode.condition0IsTrue_0.val = gdjs.evtTools.input.cursorOnObject(gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDquitButtonObjects1Objects, runtimeScene, true, true);147}if (gdjs.PauseCode.condition0IsTrue_0.val) {148gdjs.PauseCode.GDmainMenuObjects1.createFrom(runtimeScene.getObjects("mainMenu"));149{for(var i = 0, len = gdjs.PauseCode.GDmainMenuObjects1.length ;i < len;++i) {150    gdjs.PauseCode.GDmainMenuObjects1[i].setColor("255;255;255");151}152}}153}154{155gdjs.PauseCode.GDresumeButtonObjects1.createFrom(runtimeScene.getObjects("resumeButton"));156gdjs.PauseCode.condition0IsTrue_0.val = false;157{158gdjs.PauseCode.condition0IsTrue_0.val = gdjs.evtTools.input.cursorOnObject(gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDresumeButtonObjects1Objects, runtimeScene, true, false);159}if (gdjs.PauseCode.condition0IsTrue_0.val) {160gdjs.PauseCode.GDresumeObjects1.createFrom(runtimeScene.getObjects("resume"));161{for(var i = 0, len = gdjs.PauseCode.GDresumeObjects1.length ;i < len;++i) {162    gdjs.PauseCode.GDresumeObjects1[i].setColor("252;7;7");163}164}}165}166{167gdjs.PauseCode.GDquitButtonObjects1.createFrom(runtimeScene.getObjects("quitButton"));168gdjs.PauseCode.condition0IsTrue_0.val = false;169{170gdjs.PauseCode.condition0IsTrue_0.val = gdjs.evtTools.input.cursorOnObject(gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDquitButtonObjects1Objects, runtimeScene, true, false);171}if (gdjs.PauseCode.condition0IsTrue_0.val) {172gdjs.PauseCode.GDmainMenuObjects1.createFrom(runtimeScene.getObjects("mainMenu"));173{for(var i = 0, len = gdjs.PauseCode.GDmainMenuObjects1.length ;i < len;++i) {174    gdjs.PauseCode.GDmainMenuObjects1[i].setColor("252;7;7");175}176}}177}178{179gdjs.PauseCode.GDresumeButtonObjects1.createFrom(runtimeScene.getObjects("resumeButton"));180gdjs.PauseCode.condition0IsTrue_0.val = false;181gdjs.PauseCode.condition1IsTrue_0.val = false;182{183gdjs.PauseCode.condition0IsTrue_0.val = gdjs.evtTools.input.cursorOnObject(gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDresumeButtonObjects1Objects, runtimeScene, true, false);184}if ( gdjs.PauseCode.condition0IsTrue_0.val ) {185{186gdjs.PauseCode.condition1IsTrue_0.val = gdjs.evtTools.input.isMouseButtonReleased(runtimeScene, "Left");187}}188if (gdjs.PauseCode.condition1IsTrue_0.val) {189{gdjs.evtTools.runtimeScene.popScene(runtimeScene);190}}191}192{193gdjs.PauseCode.GDquitButtonObjects1.createFrom(runtimeScene.getObjects("quitButton"));194gdjs.PauseCode.condition0IsTrue_0.val = false;195gdjs.PauseCode.condition1IsTrue_0.val = false;196{197gdjs.PauseCode.condition0IsTrue_0.val = gdjs.evtTools.input.cursorOnObject(gdjs.PauseCode.mapOfGDgdjs_46PauseCode_46GDquitButtonObjects1Objects, runtimeScene, true, false);198}if ( gdjs.PauseCode.condition0IsTrue_0.val ) {199{200gdjs.PauseCode.condition1IsTrue_0.val = gdjs.evtTools.input.isMouseButtonReleased(runtimeScene, "Left");201}}202if (gdjs.PauseCode.condition1IsTrue_0.val) {203{gdjs.evtTools.runtimeScene.replaceScene(runtimeScene, "Startup", true);204}}205}206}; //End of gdjs.PauseCode.eventsList0xb2358207gdjs.PauseCode.func = function(runtimeScene) {208runtimeScene.getOnceTriggers().startNewFrame();209gdjs.PauseCode.GDplayerKnightObjects1.length = 0;210gdjs.PauseCode.GDplayerKnightObjects2.length = 0;211gdjs.PauseCode.GDplayerWeaponObjects1.length = 0;212gdjs.PauseCode.GDplayerWeaponObjects2.length = 0;213gdjs.PauseCode.GDdemonObjects1.length = 0;214gdjs.PauseCode.GDdemonObjects2.length = 0;215gdjs.PauseCode.GDsentryObjects1.length = 0;216gdjs.PauseCode.GDsentryObjects2.length = 0;217gdjs.PauseCode.GDprojectileObjects1.length = 0;218gdjs.PauseCode.GDprojectileObjects2.length = 0;219gdjs.PauseCode.GDexplosionObjects1.length = 0;220gdjs.PauseCode.GDexplosionObjects2.length = 0;221gdjs.PauseCode.GDGameOverObjects1.length = 0;222gdjs.PauseCode.GDGameOverObjects2.length = 0;223gdjs.PauseCode.GDfloorObjects1.length = 0;224gdjs.PauseCode.GDfloorObjects2.length = 0;225gdjs.PauseCode.GDwallObjects1.length = 0;226gdjs.PauseCode.GDwallObjects2.length = 0;227gdjs.PauseCode.GDwallRightObjects1.length = 0;228gdjs.PauseCode.GDwallRightObjects2.length = 0;229gdjs.PauseCode.GDwallLeftObjects1.length = 0;230gdjs.PauseCode.GDwallLeftObjects2.length = 0;231gdjs.PauseCode.GDdoorObjects1.length = 0;232gdjs.PauseCode.GDdoorObjects2.length = 0;233gdjs.PauseCode.GDspikesObjects1.length = 0;234gdjs.PauseCode.GDspikesObjects2.length = 0;235gdjs.PauseCode.GDholeObjects1.length = 0;236gdjs.PauseCode.GDholeObjects2.length = 0;237gdjs.PauseCode.GDplayerHPObjects1.length = 0;238gdjs.PauseCode.GDplayerHPObjects2.length = 0;239gdjs.PauseCode.GDframerateObjects1.length = 0;240gdjs.PauseCode.GDframerateObjects2.length = 0;241gdjs.PauseCode.GDhealthBarObjects1.length = 0;242gdjs.PauseCode.GDhealthBarObjects2.length = 0;243gdjs.PauseCode.GDpermaSpikeObjects1.length = 0;244gdjs.PauseCode.GDpermaSpikeObjects2.length = 0;245gdjs.PauseCode.GDhealthBarBackgroundObjects1.length = 0;246gdjs.PauseCode.GDhealthBarBackgroundObjects2.length = 0;247gdjs.PauseCode.GDcoinObjects1.length = 0;248gdjs.PauseCode.GDcoinObjects2.length = 0;249gdjs.PauseCode.GDpodiumObjects1.length = 0;250gdjs.PauseCode.GDpodiumObjects2.length = 0;251gdjs.PauseCode.GDcoinImageObjects1.length = 0;252gdjs.PauseCode.GDcoinImageObjects2.length = 0;253gdjs.PauseCode.GDcoinScoreObjects1.length = 0;254gdjs.PauseCode.GDcoinScoreObjects2.length = 0;255gdjs.PauseCode.GDlevelCompleteObjects1.length = 0;256gdjs.PauseCode.GDlevelCompleteObjects2.length = 0;257gdjs.PauseCode.GDobjectiveObjects1.length = 0;258gdjs.PauseCode.GDobjectiveObjects2.length = 0;259gdjs.PauseCode.GDswordIconObjects1.length = 0;260gdjs.PauseCode.GDswordIconObjects2.length = 0;261gdjs.PauseCode.GDenemyHealthBarObjects1.length = 0;262gdjs.PauseCode.GDenemyHealthBarObjects2.length = 0;263gdjs.PauseCode.GDhealthPowerupObjects1.length = 0;264gdjs.PauseCode.GDhealthPowerupObjects2.length = 0;265gdjs.PauseCode.GDhealthIncreasedTextObjects1.length = 0;266gdjs.PauseCode.GDhealthIncreasedTextObjects2.length = 0;267gdjs.PauseCode.GDswordPowerupObjects1.length = 0;268gdjs.PauseCode.GDswordPowerupObjects2.length = 0;269gdjs.PauseCode.GDdamageIncreasedTextObjects1.length = 0;270gdjs.PauseCode.GDdamageIncreasedTextObjects2.length = 0;271gdjs.PauseCode.GDHPpotionObjects1.length = 0;272gdjs.PauseCode.GDHPpotionObjects2.length = 0;273gdjs.PauseCode.GDHPpotionTextObjects1.length = 0;274gdjs.PauseCode.GDHPpotionTextObjects2.length = 0;275gdjs.PauseCode.GDmaxHPObjects1.length = 0;276gdjs.PauseCode.GDmaxHPObjects2.length = 0;277gdjs.PauseCode.GDinvinciblePowerupObjects1.length = 0;278gdjs.PauseCode.GDinvinciblePowerupObjects2.length = 0;279gdjs.PauseCode.GDinvincibleTextObjects1.length = 0;280gdjs.PauseCode.GDinvincibleTextObjects2.length = 0;281gdjs.PauseCode.GDogreObjects1.length = 0;282gdjs.PauseCode.GDogreObjects2.length = 0;283gdjs.PauseCode.GDzombieObjects1.length = 0;284gdjs.PauseCode.GDzombieObjects2.length = 0;285gdjs.PauseCode.GDwizardObjects1.length = 0;286gdjs.PauseCode.GDwizardObjects2.length = 0;287gdjs.PauseCode.GDopenDoorObjects1.length = 0;288gdjs.PauseCode.GDopenDoorObjects2.length = 0;289gdjs.PauseCode.GDlavaObjects1.length = 0;290gdjs.PauseCode.GDlavaObjects2.length = 0;291gdjs.PauseCode.GDlavaBaseObjects1.length = 0;292gdjs.PauseCode.GDlavaBaseObjects2.length = 0;293gdjs.PauseCode.GDtrapTriggerObjects1.length = 0;294gdjs.PauseCode.GDtrapTriggerObjects2.length = 0;295gdjs.PauseCode.GDwizardProjectileObjects1.length = 0;296gdjs.PauseCode.GDwizardProjectileObjects2.length = 0;297gdjs.PauseCode.GDpathOpenedObjects1.length = 0;298gdjs.PauseCode.GDpathOpenedObjects2.length = 0;299gdjs.PauseCode.GDfogObjects1.length = 0;300gdjs.PauseCode.GDfogObjects2.length = 0;301gdjs.PauseCode.GDblockerObjects1.length = 0;302gdjs.PauseCode.GDblockerObjects2.length = 0;303gdjs.PauseCode.GDmainMenuObjects1.length = 0;304gdjs.PauseCode.GDmainMenuObjects2.length = 0;305gdjs.PauseCode.GDquitButtonObjects1.length = 0;306gdjs.PauseCode.GDquitButtonObjects2.length = 0;307gdjs.PauseCode.GDdeathsObjects1.length = 0;308gdjs.PauseCode.GDdeathsObjects2.length = 0;309gdjs.PauseCode.GDpausedObjects1.length = 0;310gdjs.PauseCode.GDpausedObjects2.length = 0;311gdjs.PauseCode.GDNewObjectObjects1.length = 0;312gdjs.PauseCode.GDNewObjectObjects2.length = 0;313gdjs.PauseCode.GDresumeObjects1.length = 0;314gdjs.PauseCode.GDresumeObjects2.length = 0;315gdjs.PauseCode.GDresumeButtonObjects1.length = 0;316gdjs.PauseCode.GDresumeButtonObjects2.length = 0;317gdjs.PauseCode.eventsList0xb2358(runtimeScene);318return;319}...

Full Screen

Full Screen

stepping-with-natives-and-frameworks.js

Source:stepping-with-natives-and-frameworks.js Github

copy

Full Screen

...17Protocol.Debugger.enable();18Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']});19InspectorTest.runAsyncTestSuite([20  async function testNativeCodeStepOut() {21    Protocol.Debugger.pause();22    Protocol.Runtime.evaluate({expression: '[1,2].map(v => v);'});23    await logPauseLocation(await Protocol.Debugger.oncePaused());24    Protocol.Debugger.stepInto();25    await logPauseLocation(await Protocol.Debugger.oncePaused());26    Protocol.Debugger.stepOut();27    await logPauseLocation(await Protocol.Debugger.oncePaused());28    await Protocol.Debugger.resume();29  },30  async function testNativeCodeStepOver() {31    Protocol.Debugger.pause();32    Protocol.Runtime.evaluate({expression: '[1,2].map(v => v);'});33    await logPauseLocation(await Protocol.Debugger.oncePaused());34    Protocol.Debugger.stepInto();35    await logPauseLocation(await Protocol.Debugger.oncePaused());36    Protocol.Debugger.stepOver();37    await logPauseLocation(await Protocol.Debugger.oncePaused());38    Protocol.Debugger.stepOver();39    await logPauseLocation(await Protocol.Debugger.oncePaused());40    Protocol.Debugger.stepOver();41    await logPauseLocation(await Protocol.Debugger.oncePaused());42    Protocol.Debugger.stepOver();43    await logPauseLocation(await Protocol.Debugger.oncePaused());44    await Protocol.Debugger.resume();45  },46  async function testNativeCodeStepInto() {47    Protocol.Debugger.pause();48    Protocol.Runtime.evaluate({expression: '[1,2].map(v => v);'});49    await logPauseLocation(await Protocol.Debugger.oncePaused());50    Protocol.Debugger.stepInto();51    await logPauseLocation(await Protocol.Debugger.oncePaused());52    Protocol.Debugger.stepInto();53    await logPauseLocation(await Protocol.Debugger.oncePaused());54    Protocol.Debugger.stepInto();55    await logPauseLocation(await Protocol.Debugger.oncePaused());56    Protocol.Debugger.stepInto();57    await logPauseLocation(await Protocol.Debugger.oncePaused());58    Protocol.Debugger.stepInto();59    await logPauseLocation(await Protocol.Debugger.oncePaused());60    await Protocol.Debugger.resume();61  },62  async function testFrameworkCodeStepInto() {63    Protocol.Debugger.pause();64    Protocol.Runtime.evaluate({expression: 'callAll(() => 1, () => 2);'});65    await logPauseLocation(await Protocol.Debugger.oncePaused());66    Protocol.Debugger.stepInto();67    await logPauseLocation(await Protocol.Debugger.oncePaused());68    Protocol.Debugger.stepInto();69    await logPauseLocation(await Protocol.Debugger.oncePaused());70    Protocol.Debugger.stepInto();71    await logPauseLocation(await Protocol.Debugger.oncePaused());72    Protocol.Debugger.stepInto();73    await logPauseLocation(await Protocol.Debugger.oncePaused());74    Protocol.Debugger.stepInto();75    await logPauseLocation(await Protocol.Debugger.oncePaused());76    await Protocol.Debugger.resume();77  },78  async function testFrameworkCodeStepOver() {79    Protocol.Debugger.pause();80    Protocol.Runtime.evaluate({expression: 'callAll(() => 1, () => 2);'});81    await logPauseLocation(await Protocol.Debugger.oncePaused());82    Protocol.Debugger.stepInto();83    await logPauseLocation(await Protocol.Debugger.oncePaused());84    Protocol.Debugger.stepOver();85    await logPauseLocation(await Protocol.Debugger.oncePaused());86    Protocol.Debugger.stepOver();87    await logPauseLocation(await Protocol.Debugger.oncePaused());88    Protocol.Debugger.stepOver();89    await logPauseLocation(await Protocol.Debugger.oncePaused());90    Protocol.Debugger.stepOver();91    await logPauseLocation(await Protocol.Debugger.oncePaused());92    await Protocol.Debugger.resume();93  },94  async function testFrameworkCodeStepOut() {95    Protocol.Debugger.pause();96    Protocol.Runtime.evaluate({expression: 'callAll(() => 1, () => 2);'});97    await logPauseLocation(await Protocol.Debugger.oncePaused());98    Protocol.Debugger.stepInto();99    await logPauseLocation(await Protocol.Debugger.oncePaused());100    Protocol.Debugger.stepOut();101    await logPauseLocation(await Protocol.Debugger.oncePaused());102    Protocol.Debugger.stepOut();103    await logPauseLocation(await Protocol.Debugger.oncePaused());104    await Protocol.Debugger.resume();105  },106  async function testFrameworkNextCallDeeperStepOut() {107    Protocol.Debugger.pause();108    Protocol.Runtime.evaluate({109      expression: 'callAll(() => 1, callAll.bind(null, () => 2));'});110    await logPauseLocation(await Protocol.Debugger.oncePaused());111    Protocol.Debugger.stepInto();112    await logPauseLocation(await Protocol.Debugger.oncePaused());113    Protocol.Debugger.stepOut();114    await logPauseLocation(await Protocol.Debugger.oncePaused());115    Protocol.Debugger.stepOut();116    await logPauseLocation(await Protocol.Debugger.oncePaused());117    await Protocol.Debugger.resume();118  },119  async function testFrameworkNextCallDeeperStepOutSameFunction() {120    await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});121    Protocol.Debugger.pause();122    Protocol.Runtime.evaluate({123      expression: 'callAll(foo, callAll.bind(null, foo));'});124    await logPauseLocation(await Protocol.Debugger.oncePaused());125    Protocol.Debugger.stepInto();126    await logPauseLocation(await Protocol.Debugger.oncePaused());127    Protocol.Debugger.stepOut();128    await logPauseLocation(await Protocol.Debugger.oncePaused());129    await Protocol.Debugger.resume();130  },131  async function testFrameworkNextCallDeeperStepInto() {132    Protocol.Debugger.pause();133    Protocol.Runtime.evaluate({134      expression: 'callAll(() => 1, callAll.bind(null, () => 2));'});135    await logPauseLocation(await Protocol.Debugger.oncePaused());136    Protocol.Debugger.stepInto();137    await logPauseLocation(await Protocol.Debugger.oncePaused());138    Protocol.Debugger.stepOver();139    await logPauseLocation(await Protocol.Debugger.oncePaused());140    Protocol.Debugger.stepOver();141    await logPauseLocation(await Protocol.Debugger.oncePaused());142    Protocol.Debugger.stepOver();143    await logPauseLocation(await Protocol.Debugger.oncePaused());144    Protocol.Debugger.stepOver();145    await logPauseLocation(await Protocol.Debugger.oncePaused());146    await Protocol.Debugger.resume();147  },148  async function testFrameworkNextCallDeeperStepOver() {149    Protocol.Debugger.pause();150    Protocol.Runtime.evaluate({151      expression: 'callAll(() => 1, callAll.bind(null, () => 2));'});152    await logPauseLocation(await Protocol.Debugger.oncePaused());153    Protocol.Debugger.stepInto();154    await logPauseLocation(await Protocol.Debugger.oncePaused());155    Protocol.Debugger.stepOver();156    await logPauseLocation(await Protocol.Debugger.oncePaused());157    Protocol.Debugger.stepOver();158    await logPauseLocation(await Protocol.Debugger.oncePaused());159    Protocol.Debugger.stepOver();160    await logPauseLocation(await Protocol.Debugger.oncePaused());161    Protocol.Debugger.stepOver();162    await logPauseLocation(await Protocol.Debugger.oncePaused());163    await Protocol.Debugger.resume();164  },165  async function testFrameworkCurrentCallDeeperStepOut() {166    Protocol.Debugger.pause();167    Protocol.Runtime.evaluate({168      expression: 'callAll(callAll.bind(null, () => 1), () => 2);'});169    await logPauseLocation(await Protocol.Debugger.oncePaused());170    Protocol.Debugger.stepInto();171    await logPauseLocation(await Protocol.Debugger.oncePaused());172    Protocol.Debugger.stepOut();173    await logPauseLocation(await Protocol.Debugger.oncePaused());174    Protocol.Debugger.stepOut();175    await logPauseLocation(await Protocol.Debugger.oncePaused());176    await Protocol.Debugger.resume();177  },178  async function testFrameworkCurrentCallDeeperStepOutSameFunction() {179    await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});180    Protocol.Debugger.pause();181    Protocol.Runtime.evaluate({182      expression: 'callAll(callAll.bind(null, foo), foo);'});183    await logPauseLocation(await Protocol.Debugger.oncePaused());184    Protocol.Debugger.stepInto();185    await logPauseLocation(await Protocol.Debugger.oncePaused());186    Protocol.Debugger.stepOut();187    await logPauseLocation(await Protocol.Debugger.oncePaused());188    await Protocol.Debugger.resume();189  },190  async function testFrameworkCurrentCallDeeperStepOver() {191    Protocol.Debugger.pause();192    Protocol.Runtime.evaluate({193      expression: 'callAll(callAll.bind(null, () => 1), () => 2);'});194    await logPauseLocation(await Protocol.Debugger.oncePaused());195    Protocol.Debugger.stepInto();196    await logPauseLocation(await Protocol.Debugger.oncePaused());197    Protocol.Debugger.stepOver();198    await logPauseLocation(await Protocol.Debugger.oncePaused());199    Protocol.Debugger.stepOver();200    await logPauseLocation(await Protocol.Debugger.oncePaused());201    Protocol.Debugger.stepOver();202    await logPauseLocation(await Protocol.Debugger.oncePaused());203    Protocol.Debugger.stepOver();204    await logPauseLocation(await Protocol.Debugger.oncePaused());205    await Protocol.Debugger.resume();206  },207  async function testFrameworkCurrentCallDeeperStepInto() {208    Protocol.Debugger.pause();209    Protocol.Runtime.evaluate({210      expression: 'callAll(callAll.bind(null, () => 1), () => 2);'});211    await logPauseLocation(await Protocol.Debugger.oncePaused());212    Protocol.Debugger.stepInto();213    await logPauseLocation(await Protocol.Debugger.oncePaused());214    Protocol.Debugger.stepInto();215    await logPauseLocation(await Protocol.Debugger.oncePaused());216    Protocol.Debugger.stepInto();217    await logPauseLocation(await Protocol.Debugger.oncePaused());218    Protocol.Debugger.stepInto();219    await logPauseLocation(await Protocol.Debugger.oncePaused());220    Protocol.Debugger.stepInto();221    await logPauseLocation(await Protocol.Debugger.oncePaused());222    await Protocol.Debugger.resume();223  },224  async function testFrameworkStepOverMixed() {225    await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});226    Protocol.Debugger.pause();227    Protocol.Runtime.evaluate({228      expression: 'callAll(foo, foo, () => 2);'});229    await logPauseLocation(await Protocol.Debugger.oncePaused());230    Protocol.Debugger.stepInto();231    await logPauseLocation(await Protocol.Debugger.oncePaused());232    Protocol.Debugger.stepOver();233    await logPauseLocation(await Protocol.Debugger.oncePaused());234    Protocol.Debugger.stepOver();235    await logPauseLocation(await Protocol.Debugger.oncePaused());236    Protocol.Debugger.stepOver();237    await logPauseLocation(await Protocol.Debugger.oncePaused());238    Protocol.Debugger.stepOver();239    await logPauseLocation(await Protocol.Debugger.oncePaused());240    Protocol.Debugger.stepOver();241    await logPauseLocation(await Protocol.Debugger.oncePaused());242    Protocol.Debugger.stepOver();243    await logPauseLocation(await Protocol.Debugger.oncePaused());244    await Protocol.Debugger.resume();245  },246  async function testFrameworkStepOutMixed() {247    await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});248    Protocol.Debugger.pause();249    Protocol.Runtime.evaluate({250      expression: 'callAll(foo, foo, () => 2);'});251    await logPauseLocation(await Protocol.Debugger.oncePaused());252    Protocol.Debugger.stepInto();253    await logPauseLocation(await Protocol.Debugger.oncePaused());254    Protocol.Debugger.stepOut();255    await logPauseLocation(await Protocol.Debugger.oncePaused());256    Protocol.Debugger.stepOut();257    await logPauseLocation(await Protocol.Debugger.oncePaused());258    await Protocol.Debugger.resume();259  },260  async function testStepOutFrameworkSameFunctionAtReturn() {261    await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});262    Protocol.Debugger.pause();263    Protocol.Runtime.evaluate({264      expression: 'callAll(foo, foo, () => 2);'});265    await logPauseLocation(await Protocol.Debugger.oncePaused());266    Protocol.Debugger.stepInto();267    await logPauseLocation(await Protocol.Debugger.oncePaused());268    Protocol.Debugger.stepOver();269    await logPauseLocation(await Protocol.Debugger.oncePaused());270    Protocol.Debugger.stepOut();271    await logPauseLocation(await Protocol.Debugger.oncePaused());272    Protocol.Debugger.stepOut();273    await logPauseLocation(await Protocol.Debugger.oncePaused());274    await Protocol.Debugger.resume();275  }276]);...

Full Screen

Full Screen

pauseGuardianTest.js

Source:pauseGuardianTest.js Github

copy

Full Screen

1const { address, both, etherMantissa } = require('../Utils/Ethereum');2const { makeComptroller, makeCToken } = require('../Utils/Compound');3describe('Comptroller', () => {4  let comptroller, cToken;5  let root, accounts;6  beforeEach(async () => {7    [root, ...accounts] = saddle.accounts;8  });9  describe("_setPauseGuardian", () => {10    beforeEach(async () => {11      comptroller = await makeComptroller();12    });13    describe("failing", () => {14      it("emits a failure log if not sent by admin", async () => {15        let result = await send(comptroller, '_setPauseGuardian', [root], {from: accounts[1]});16        expect(result).toHaveTrollFailure('UNAUTHORIZED', 'SET_PAUSE_GUARDIAN_OWNER_CHECK');17      });18      it("does not change the pause guardian", async () => {19        let pauseGuardian = await call(comptroller, 'pauseGuardian');20        expect(pauseGuardian).toEqual(address(0));21        await send(comptroller, '_setPauseGuardian', [root], {from: accounts[1]});22        pauseGuardian = await call(comptroller, 'pauseGuardian');23        expect(pauseGuardian).toEqual(address(0));24      });25    });26    describe('succesfully changing pause guardian', () => {27      let result;28      beforeEach(async () => {29        comptroller = await makeComptroller();30        result = await send(comptroller, '_setPauseGuardian', [accounts[1]]);31      });32      it('emits new pause guardian event', async () => {33        expect(result).toHaveLog(34          'NewPauseGuardian',35          {newPauseGuardian: accounts[1], oldPauseGuardian: address(0)}36        );37      });38      it('changes pending pause guardian', async () => {39        let pauseGuardian = await call(comptroller, 'pauseGuardian');40        expect(pauseGuardian).toEqual(accounts[1]);41      });42    });43  });44  describe('setting paused', () => {45    beforeEach(async () => {46      cToken = await makeCToken({supportMarket: true});47      comptroller = cToken.comptroller;48    });49    let globalMethods = ["Transfer", "Seize"];50    describe('succeeding', () => {51      let pauseGuardian;52      beforeEach(async () => {53        pauseGuardian = accounts[1];54        await send(comptroller, '_setPauseGuardian', [accounts[1]], {from: root});55      });56      globalMethods.forEach(async (method) => {57        it(`only pause guardian or admin can pause ${method}`, async () => {58          await expect(send(comptroller, `_set${method}Paused`, [true], {from: accounts[2]})).rejects.toRevert("revert only pause guardian and admin can pause");59          await expect(send(comptroller, `_set${method}Paused`, [false], {from: accounts[2]})).rejects.toRevert("revert only pause guardian and admin can pause");60        });61        it(`PauseGuardian can pause of ${method}GuardianPaused`, async () => {62          result = await send(comptroller, `_set${method}Paused`, [true], {from: pauseGuardian});63          expect(result).toHaveLog(`ActionPaused`, {action: method, pauseState: true});64          let camelCase = method.charAt(0).toLowerCase() + method.substring(1);65          state = await call(comptroller, `${camelCase}GuardianPaused`);66          expect(state).toEqual(true);67          await expect(send(comptroller, `_set${method}Paused`, [false], {from: pauseGuardian})).rejects.toRevert("revert only admin can unpause");68          result = await send(comptroller, `_set${method}Paused`, [false]);69          expect(result).toHaveLog(`ActionPaused`, {action: method, pauseState: false});70          state = await call(comptroller, `${camelCase}GuardianPaused`);71          expect(state).toEqual(false);72        });73        it(`pauses ${method}`, async() => {74          await send(comptroller, `_set${method}Paused`, [true], {from: pauseGuardian});75          switch (method) {76          case "Transfer":77            await expect(78              send(comptroller, 'transferAllowed', [address(1), address(2), address(3), 1])79            ).rejects.toRevert(`revert ${method.toLowerCase()} is paused`);80            break;81          case "Seize":82            await expect(83              send(comptroller, 'seizeAllowed', [address(1), address(2), address(3), address(4), 1])84            ).rejects.toRevert(`revert ${method.toLowerCase()} is paused`);85            break;86          default:87            break;88          }89        });90      });91    });92    let marketMethods = ["Borrow", "Mint"];93    describe('succeeding', () => {94      let pauseGuardian;95      beforeEach(async () => {96        pauseGuardian = accounts[1];97        await send(comptroller, '_setPauseGuardian', [accounts[1]], {from: root});98      });99      marketMethods.forEach(async (method) => {100        it(`only pause guardian or admin can pause ${method}`, async () => {101          await expect(send(comptroller, `_set${method}Paused`, [cToken._address, true], {from: accounts[2]})).rejects.toRevert("revert only pause guardian and admin can pause");102          await expect(send(comptroller, `_set${method}Paused`, [cToken._address, false], {from: accounts[2]})).rejects.toRevert("revert only pause guardian and admin can pause");103        });104        it(`PauseGuardian can pause of ${method}GuardianPaused`, async () => {105          result = await send(comptroller, `_set${method}Paused`, [cToken._address, true], {from: pauseGuardian});106          expect(result).toHaveLog(`ActionPaused`, {cToken: cToken._address, action: method, pauseState: true});107          let camelCase = method.charAt(0).toLowerCase() + method.substring(1);108          state = await call(comptroller, `${camelCase}GuardianPaused`, [cToken._address]);109          expect(state).toEqual(true);110          await expect(send(comptroller, `_set${method}Paused`, [cToken._address, false], {from: pauseGuardian})).rejects.toRevert("revert only admin can unpause");111          result = await send(comptroller, `_set${method}Paused`, [cToken._address, false]);112          expect(result).toHaveLog(`ActionPaused`, {cToken: cToken._address, action: method, pauseState: false});113          state = await call(comptroller, `${camelCase}GuardianPaused`, [cToken._address]);114          expect(state).toEqual(false);115        });116        it(`pauses ${method}`, async() => {117          await send(comptroller, `_set${method}Paused`, [cToken._address, true], {from: pauseGuardian});118          switch (method) {119          case "Mint":120            expect(await call(comptroller, 'mintAllowed', [address(1), address(2), 1])).toHaveTrollError('MARKET_NOT_LISTED');121            await expect(send(comptroller, 'mintAllowed', [cToken._address, address(2), 1])).rejects.toRevert(`revert ${method.toLowerCase()} is paused`);122            break;123          case "Borrow":124            expect(await call(comptroller, 'borrowAllowed', [address(1), address(2), 1])).toHaveTrollError('MARKET_NOT_LISTED');125            await expect(send(comptroller, 'borrowAllowed', [cToken._address, address(2), 1])).rejects.toRevert(`revert ${method.toLowerCase()} is paused`);126            break;127          default:128            break;129          }130        });131      });132    });133  });...

Full Screen

Full Screen

music.js

Source:music.js Github

copy

Full Screen

...34    $("playSearch").onclick=playSearch;35    $("playHole").onclick=playHole;36};37var pauseAll=function(){38    cant.pause();39    waves.pause();40    highway.pause();41    escape.pause();42    autumn.pause();43    penny.pause();44    solitude.pause();45    dusty.pause();46    corner.pause();47    search.pause();48    hole.pause();49    like.pause();50    saturn.pause();51    twisting.pause();52    fire.pause();53}54var playCant=function(){55    if(!cant.paused){56        cant.pause();57        $("playCant").innerHTML="<img src='Images/play.png' alt='play icon'>"58    }59    else{60        pauseAll();61        cant.play();62        $("playCant").innerHTML="<img src='Images/pause.png' alt='pause icon'>"63    }64}65var playLike = function(){66    if(!like.paused){67        like.pause();68        $("playLike").innerHTML="<img src='Images/play.png' alt='play icon'>"69    }70    else{71         pauseAll();72        like.play();73        $("playLike").innerHTML="<img src='Images/pause.png' alt='pause icon'>"74    }75}76var playSaturn = function(){77    if(!saturn.paused){78        saturn.pause();79        $("playSaturn").innerHTML="<img src='Images/play.png' alt='play icon'>"80    }81    else{82         pauseAll();83        saturn.play();84        $("playSaturn").innerHTML="<img src='Images/pause.png' alt='pause icon'>"85    }86}87var playFire = function(){88    if(!fire.paused){89        fire.pause();90        $("playFire").innerHTML="<img src='Images/play.png' alt='play icon'>"91    }92    else{93        pauseAll();94        fire.play();95        $("playFire").innerHTML="<img src='Images/pause.png' alt='pause icon'>"96    }97}98var playWire = function(){99    if(!twisting.paused){100        twisting.pause();101        $("playWire").innerHTML="<img src='Images/play.png' alt='play icon'>"102    }103    else{104        pauseAll();105        twisting.play();106        $("playWire").innerHTML="<img src='Images/pause.png' alt='pause icon'>"107    }108}109var playWaves = function(){110    if(!waves.paused){111        waves.pause();112        $("playWaves").innerHTML="<img src='Images/play.png' alt='play icon'>"113    }114    else{115        pauseAll();116        waves.play();117        $("playWaves").innerHTML="<img src='Images/pause.png' alt='pause icon'>"118    }119}120var playHighway = function(){121    if(!highway.paused){122        highway.pause();123        $("playHighway").innerHTML="<img src='Images/play.png' alt='play icon'>"124    }125    else{126        pauseAll();127        highway.play();128        $("playHighway").innerHTML="<img src='Images/pause.png' alt='pause icon'>"129    }130}131var playEscape = function(){132    if(!escape.paused){133        escape.pause();134        $("playEscape").innerHTML="<img src='Images/play.png' alt='play icon'>"135    }136    else{137        pauseAll();138        escape.play();139        $("playEscape").innerHTML="<img src='Images/pause.png' alt='pause icon'>"140    }141}142var playAutumn = function(){143    if(!autumn.paused){144        autumn.pause();145        $("playAutumn").innerHTML="<img src='Images/play.png' alt='play icon'>"146    }147    else{148        pauseAll();149        autumn.play();150        $("playAutumn").innerHTML="<img src='Images/pause.png' alt='pause icon'>"151    }152}153var playPenny = function(){154    if(!penny.paused){155        penny.pause();156        $("playPenny").innerHTML="<img src='Images/play.png' alt='play icon'>"157    }158    else{159        pauseAll();160        penny.play();161        $("playPenny").innerHTML="<img src='Images/pause.png' alt='pause icon'>"162    }163}164var playSolitude = function(){165    if(!solitude.paused){166        solitude.pause();167        $("playSolitude").innerHTML="<img src='Images/play.png' alt='play icon'>"168    }169    else{170        pauseAll();171        solitude.play();172        $("playSolitude").innerHTML="<img src='Images/pause.png' alt='pause icon'>"173    }174}175var playDusty = function(){176    if(!dusty.paused){177        dusty.pause();178        $("playDusty").innerHTML="<img src='Images/play.png' alt='play icon'>"179    }180    else{181        pauseAll();182        dusty.play();183        $("playDusty").innerHTML="<img src='Images/pause.png' alt='pause icon'>"184    }185}186var playCorner = function(){187    if(!corner.paused){188        corner.pause();189        $("playCorner").innerHTML="<img src='Images/play.png' alt='play icon'>"190    }191    else{192        pauseAll();193        corner.play();194        $("playCorner").innerHTML="<img src='Images/pause.png' alt='pause icon'>"195    }196}197var playSearch = function(){198    if(!search.paused){199        search.pause();200        $("playSearch").innerHTML="<img src='Images/play.png' alt='play icon'>"201    }202    else{203        pauseAll();204        search.play();205        $("playSearch").innerHTML="<img src='Images/pause.png' alt='pause icon'>"206    }207}208var playHole= function(){209    if(!hole.paused){210        hole.pause();211        $("playHole").innerHTML="<img src='Images/play.png' alt='play icon'>"212    }213    else{214        pauseAll();215        hole.play();216        $("playHole").innerHTML="<img src='Images/pause.png' alt='pause icon'>"217    }...

Full Screen

Full Screen

SimpleRemainingTimer.js

Source:SimpleRemainingTimer.js Github

copy

Full Screen

1let CountdownTimer = {2  props: ['lib', 'config', 'status'3    , 'remainingSeconds', 'pauseAtStart', 'showLabel', 'isStatic'],4  data() {    5    this.$i18n.locale = this.config.locale6    7    let dataPause = (this.pauseAtStart || (this.isStatic === true && this.status.progress.countdownPause === true ))8    //console.log(dataPause, this.pauseAtStart, this.isStatic , this.status.progress.countdownPause)9    return {10      dataRemainingSec: this.remainingSeconds,11      dataPause: dataPause,12      timer: null13    }14  },15  computed: {16    dataRemainingTime () {17      //console.log(this.dataRemainingSec)18      let t = this.lib.DayJSHelper.formatHHMMSS(this.dataRemainingSec)19      //console.log(this.dataRemainingSec, t, typeof(t))20      if (t === -1) {21        t = '00:00'22      }23      else if (this.dataRemainingSec < 10) {24        t = '00:0' + t25      }26      else if (this.dataRemainingSec < 60) {27        t = '00:' + t28      }29      30      return t31    },32    dataMinutes () {33      return Math.ceil(this.remainingSeconds / 60)34    }35  },36  watch: {37    remainingSeconds (remainingSec) {38      this.dataRemainingSec = remainingSec39    },40    pauseAtStart (pause) {41      this.dataPause = pause42      if (this.dataPause === false) {43        this.dataRemainingSec = undefined44        this.start()45      }46      else {47        clearTimeout(this.timer)48      }49    },50    'status.progress.countdownPause' (countdownPause) {51      if (countdownPause === false) {52        this.dataPause = false53        this.dataRemainingSec = undefined54        this.start()55      }56      else {57        clearTimeout(this.timer)58      }59    }60  },61  mounted() {62    if (this.isStatic || this.pauseAtStart === true) {63      return false64    }65    this.start()66  },67  methods: {68    start: function () {69      if (!this.dataRemainingSec) {70        //this.dataRemainingSec = await this.lib.AxiosHelper.get('/client/ReadingProgress/getRemainingSeconds')71        //console.log(this.status.progress.countdownPause)72        //console.log(this.status.progress.countdownPause, this.pauseAtStart)73        if (this.status.progress.countdownPause === false) {74          this.dataRemainingSec = this.lib.auth.getRemainingSeconds()75//          if (this.dataRemainingSec === 0) {76//            throw new Error('dataRemainingSec is 0')77//          }78          //console.log('getRemainingSeconds', this.dataRemainingSec)79        }80        else {81          this.dataRemainingSec = this.lib.auth.getPausedRemainingSeconds()82          //console.log('getPausedRemainingSeconds', this.dataRemainingSec)83        }84      }85      86      //console.log(this.pauseAtStart)87      //console.log(this.isStatic, this.dataPause)88      if (this.dataPause === true || (this.isStatic === true && this.status.progress.countdownPause === true )) {89        //console.log(this.dataPause, this.isStatic, this.status.progress.countdownPause)90        return null91      }92      //else {93        //console.log(this.dataPause, this.isStatic, this.status.progress.countdownPause)94      //}95      96      this.timer = setTimeout(() => {97        if (this.dataPause === true || (this.isStatic === true && this.status.progress.countdownPause === true )) {98          //console.log(this.dataPause, this.isStatic, this.status.progress.countdownPause)99          return null100        }101        //else {102        //  console.log(this.dataPause, this.isStatic, this.status.progress.countdownPause)103        //}104        105        this.dataRemainingSec--106        107        if (this.dataRemainingSec > 0) {108          this.start()109        }110        else {111          this.timeup()112        }113      }, 1000)114    },115    timeup () {116      //console.log('timeup')117      this.$emit('timeup')118      119      // 在結束之後,切換一個隨機的數字120      //console.log('準備隨機切換數字')121      setTimeout(() => {122        this.dataRemainingSec = 10 + Math.floor(Math.random() * 150)123        //console.log(this.dataRemainingSec)124      }, 3000)125    },126    pause () {127      this.dataPause = true128    },129    resume () {130      this.dataPause = false131      this.start()132    }133  } // methods134}...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...88		 * Note that Array.includes is not supported by IE.89		 *90		 * @param {number} flag - A pause flag to be added.91		 */92		pause( flag = 0 ) {93			interval.pause();94			if ( flags.indexOf( flag ) === -1 ) {95				flags.push( flag );96			}97			if ( flags.length === 1 ) {98				Splide.emit( `${ name }:pause` );99			}100		},101	};102	/**103	 * Listen some events.104	 */105	function bind() {106		const options = Splide.options;107		const sibling = Splide.sibling;108		const elms    = [ Splide.root, sibling ? sibling.root : null ];109		if ( options.pauseOnHover ) {110			switchOn( elms, 'mouseleave', PAUSE_FLAGS.HOVER, true );111			switchOn( elms, 'mouseenter', PAUSE_FLAGS.HOVER, false );112		}113		if ( options.pauseOnFocus ) {114			switchOn( elms, 'focusout', PAUSE_FLAGS.FOCUS, true );115			switchOn( elms, 'focusin', PAUSE_FLAGS.FOCUS, false );116		}117		if ( Elements.play ) {118			Splide.on( 'click', () => {119				// Need to be removed a focus flag at first.120				Autoplay.play( PAUSE_FLAGS.FOCUS );121				Autoplay.play( PAUSE_FLAGS.MANUAL );122			}, Elements.play );123		}124		if ( Elements.pause ) {125			switchOn( [ Elements.pause ], 'click', PAUSE_FLAGS.MANUAL, false );126		}127		Splide128			.on( 'move refresh', () => { Autoplay.play() } ) // Rewind the timer.129			.on( 'destroy', () => {	Autoplay.pause() } );130	}131	/**132	 * Play or pause on the given event.133	 *134	 * @param {Element[]} elms  - Elements.135	 * @param {string}    event - An event name or names.136	 * @param {number}    flag  - A pause flag defined on the top.137	 * @param {boolean}   play  - Determine whether to play or pause.138	 */139	function switchOn( elms, event, flag, play ) {140		elms.forEach( elm => {141			Splide.on( event, () => { Autoplay[ play ? 'play' : 'pause' ]( flag ) }, elm );142		} );143	}...

Full Screen

Full Screen

commandPause.js

Source:commandPause.js Github

copy

Full Screen

...11     * @function pause12     * @export $.commandPause13     * @param {Number} [seconds]14     */15    function pause(seconds) {16        seconds = (seconds ? seconds : defaultTime);17        if (isActive) {18            clearTimeout(timerId);19        } else {20            $.setIniDbBoolean('commandPause', 'commandsPaused', true);21            isActive = true;22        }23        timerId = setTimeout(function() {24            unPause();25        }, seconds * 1e3);26        $.say($.lang.get('commandpause.initiated', $.getTimeString(seconds)));27    };28    /**29     * @function isPaused30     * @export $.commandPause31     * @returns {boolean}32     */33    function isPaused() {34        return isActive;35    };36    /**37     * @function clear38     * @export $.commandPause39     */40    function unPause() {41        if (timerId > -1) {42            clearTimeout(timerId);43            $.setIniDbBoolean('commandPause', 'commandsPaused', false);44            isActive = false;45            timerId = -1;46            $.say($.lang.get('commandpause.ended'));47        }48    };49    /**50     * @event event51     */52    $.bind('command', function(event) {53        var command = event.getCommand(),54            args = event.getArgs();55        /**56         * @commandpath pausecommands [seconds] - Pause all command usage for the given amount of time. If [seconds] is not present, uses a default value57         * @commandpath pausecommands clear - Unpause commands 58         */59        if (command.equalsIgnoreCase('pausecommands')) {60            if (args[0] != undefined || args[0] != null) {61                if (args[0] == 'clear') {62                    unPause();63                    return;64                }65                if (!isNaN(parseInt(args[0]))) {66                    pause(parseInt(args[0]));67                } else {68                    pause();69                }70            } else {71                $.say($.lang.get('pausecommands.usage'));72            }73        }74    });75    /**76     * @event initReady77     */78    $.bind('initReady', function() {79        if ($.bot.isModuleEnabled('./core/commandPause.js')) {80            $.registerChatCommand('./core/commandPause.js', 'pausecommands', 2);81        }82    });...

Full Screen

Full Screen

pause.js

Source:pause.js Github

copy

Full Screen

1import { getHelpStatus } from './help.js';23const divPauseLayer = document.getElementById('pause-layer');4const btnResumePause = document.getElementById('btn-resume-pause');5const btnPauseOnScreen = document.getElementById('pause-btn'); //кнопка паузы на экране67let pauseStatus = true;89export function initialPauseLayer() {  10  btnResumePause.onclick = () => { 11    hidePauseLayer();12  };13  14  15  btnPauseOnScreen.onclick = () => {16    showPauseLayer();17  }18}1920export function pauseToggle() {2122    if (!getHelpStatus()){23      if (!pauseStatus) {24        // console.log(document.getElementById('pause-layer'));         25        showPauseLayer();26        27      } else {28        hidePauseLayer();29        30      }31    }32}3334export function getPauseStatus() {35  return pauseStatus;36}3738export function setPauseStatus(value) {39  pauseStatus = value;40}4142export function showPauseLayer() {43  divPauseLayer.style.display = 'flex';44  btnPauseOnScreen.style.display = 'none';45  pauseStatus = true;46}4748export function hidePauseLayer() {49  divPauseLayer.style.display = 'none';  50  btnPauseOnScreen.style.display = 'block';51  pauseStatus = false;
...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2  it('Does not do much!', function() {3    cy.pause()4    cy.contains('type').click()5    cy.url().should('include', '/commands/actions')6    cy.get('.action-email')7      .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2    it('Does not do much!', function() {3      cy.pause()4      cy.contains('type').click()5      cy.url().should('include', '/commands/actions')6      cy.get('.action-email')7        .type('fake@email')8        .should('have.value', 'fake@email')9    })10  })

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2  it('Does not do much!', function() {3    cy.pause()4    cy.contains('type').click()5    cy.url().should('include', '/commands/actions')6    cy.get('.action-email')7      .type('fake@email')8      .should('have.value', 'fake@email')9  })10})11describe('My First Test', function() {12  it('Does not do much!', function() {13    cy.pause()14    cy.contains('type').click()15    cy.url().should('include', '/commands/actions')16    cy.get('.action-email')17      .type('fake@email')18      .should('have.value', 'fake@email')19  })20})21describe('My First Test', function() {22  it('Does not do much!', function() {23    cy.pause()24    cy.contains('type').click()25    cy.url().should('include', '/commands/actions')26    cy.get('.action-email')27      .type('fake@email')28      .should('have.value', 'fake@email')29  })30})

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2    it('Does not do much!', function() {3      cy.pause()4      cy.contains('type').click()5    })6  })7  describe('My First Test', function() {8    it('Does not do much!', function() {9      cy.pause()10      cy.contains('type').click()11    })12  })13  describe('My First Test', function() {14    it('Does not do much!', function() {15      cy.pause()16      cy.contains('type').click()17    })18  })19  describe('My First Test', function() {20    it('Does not do much!', function() {21      cy.pause()22      cy.contains('type').click()23    })24  })25  describe('My First Test', function() {26    it('Does not do much!', function() {27      cy.pause()28      cy.contains('type').click()29    })30  })31  describe('My First Test', function() {32    it('Does not do much!', function() {33      cy.pause()34      cy.contains('type').click()35    })36  })37  describe('My First Test', function() {38    it('Does not do much!', function() {39      cy.pause()40      cy.contains('type').click()41    })42  })43  describe('My First Test', function() {44    it('Does not do much!', function() {45      cy.pause()46      cy.contains('type').click()47    })48  })49  describe('My First Test', function() {50    it('Does not do much!', function() {51      cy.pause()

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2  it('Does not do much!', function() {3    cy.pause()4    cy.contains('type').click()5  })6})7describe('My First Test', function() {8  it('Does not do much!', function() {9    cy.pause()10    cy.contains('type').click()11  })12})13describe('My First Test', function() {14  it('Does not do much!', function() {15    cy.pause()16    cy.contains('type').click()17  })18})19describe('My First Test', function() {20  it('Does not do much!', function() {21    cy.pause()22    cy.contains('type').click()23  })24})25describe('My First Test', function() {26  it('Does not do much!', function() {27    cy.pause()28    cy.contains('type').click()29  })30})31describe('My First Test', function() {32  it('Does not do much!', function() {33    cy.pause()34    cy.contains('type').click()35  })36})

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2    it('Does not do much!', function() {3      cy.pause()4    })5  })6  describe('My First Test', function() {7    it('Does not do much!', function() {8      cy.debug()9    })10  })11  describe('My First Test', function() {12    it('Does not do much!', function() {13      cy.debug()14    })15  })16  describe('My First Test', function() {17    it('Does not do much!', function() {18      cy.debug()19    })20  })21  describe('My First Test', function() {22    it('Does not do much!', function() {23      cy.debug()24    })25  })26  describe('My First Test', function() {27    it('Does not do much!', function() {28      cy.debug()29    })30  })31  describe('My First Test', function() {32    it('Does not do much!', function() {33      cy.debug()34    })35  })36  describe('My First Test', function() {37    it('Does not do much!', function() {38      cy.debug()39    })40  })41  describe('My First Test', function() {42    it('Does not do much!', function() {43      cy.debug()44    })45  })46  describe('My First Test', function() {47    it('Does not do much!', function() {48      cy.debug()49    })50  })

Full Screen

Using AI Code Generation

copy

Full Screen

1it('test', () => {2    cy.pause()3    cy.get('body').then(($body) => {4        if ($body.find('button').length > 0) {5            cy.get('button').click()6        }7    })8})9it('test', () => {10    cy.get('body').then(($body) => {11        if ($body.find('button').length > 0) {12            cy.get('button').click()13        }14    })15})16it('test', () => {17    cy.get('body').then(($body) => {18        if ($body.find('button').length > 0) {19            cy.get('button').click()20        }21    }).debug()22})23it('test', () => {24    cy.get('body').debug().then(($body) => {25        if ($body.find('button').length > 0) {26            cy.get('button').click()27        }28    })29})30it('test', () => {31    cy.get('body').then(($body) => {32        if ($body.find('button').length > 0) {33            cy.get('button').click()34        }35    })36    cy.get('body').debug()37})38it('test', () => {39    cy.get('body').then(($body) => {40        if ($body.find('button').length > 0) {41            cy.get('button').click()42        }43    })44    cy.get('body').debug().debug()45})46it('test', () => {47    cy.get('body').debug().then(($body) => {48        if ($body.find('button').length > 0) {49            cy.get('button').click()50        }51    })52    cy.get('body').debug()53})54it('test', () => {55    cy.visit('http

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2  it('Does not do much!', function() {3    cy.pause()4  })5})6describe('My First Test', function() {7  it('Does not do much!', function() {8  })9})10describe('My First Test', function() {11  it('Does not do much!', function() {12    cy.debug()13  })14})

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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