OLD | NEW |
(Empty) | |
| 1 (async function(testRunner) { |
| 2 let {page, session, dp} = await testRunner.startBlank(''); |
| 3 |
| 4 var newVariableValue = 55; |
| 5 |
| 6 dp.Debugger.enable(); |
| 7 dp.Runtime.evaluate({expression: ` |
| 8 function TestFunction() { |
| 9 var a = 2; |
| 10 debugger; |
| 11 debugger; |
| 12 } |
| 13 setTimeout(TestFunction, 0); |
| 14 `}); |
| 15 |
| 16 var messageObject = await dp.Debugger.oncePaused(); |
| 17 testRunner.log(`Paused on 'debugger;'`); |
| 18 var topFrame = messageObject.params.callFrames[0]; |
| 19 var topFrameId = topFrame.callFrameId; |
| 20 |
| 21 dp.Debugger.evaluateOnCallFrame({callFrameId: topFrameId, expression: 'a = ' +
newVariableValue }); |
| 22 testRunner.log('Variable value changed'); |
| 23 dp.Debugger.resume(); |
| 24 |
| 25 var response = await dp.Debugger.oncePaused(); |
| 26 testRunner.log('Stacktrace re-read again'); |
| 27 var localScope = response.params.callFrames[0].scopeChain[0]; |
| 28 |
| 29 response = await dp.Runtime.getProperties({objectId: localScope.object.objectI
d }); |
| 30 testRunner.log('Scope variables downloaded anew'); |
| 31 var propertyList = response.result.result; |
| 32 var varNamedA = propertyList.find(x => x.name === 'a'); |
| 33 if (varNamedA) { |
| 34 var actualValue = varNamedA.value.value; |
| 35 testRunner.log('New variable is ' + actualValue + ', expected is ' + newVari
ableValue + ', old was: 2'); |
| 36 testRunner.log(actualValue == newVariableValue ? 'SUCCESS' : 'FAIL'); |
| 37 } else { |
| 38 testRunner.log('Failed to find variable in scope'); |
| 39 } |
| 40 testRunner.completeTest(); |
| 41 }) |
OLD | NEW |