OLD | NEW |
---|---|
(Empty) | |
1 (async function(testRunner) { | |
2 let {page, session, dp} = await testRunner.startBlank(''); | |
3 | |
4 var response = await dp.Runtime.evaluate({expression: 'let a = 42;'}); | |
5 failIfError(response); | |
6 testRunner.log('first \'let a = 1;\' result: wasThrown = ' + !!response.result .exceptionDetails); | |
alph
2017/06/22 01:30:54
nit: you can use backquotes to avoid escaping.
dgozman
2017/06/22 17:14:32
Done.
| |
7 | |
8 response = await dp.Runtime.evaluate({expression: 'let a = 239;'}); | |
9 failIfError(response); | |
10 testRunner.log('second \'let a = 1;\' result: wasThrown = ' + !!response.resul t.exceptionDetails); | |
11 if (response.result.exceptionDetails) | |
12 testRunner.log('exception message: ' + response.result.exceptionDetails.text + ' ' + response.result.exceptionDetails.exception.description); | |
13 | |
14 response = await dp.Runtime.evaluate({expression: 'a'}); | |
15 failIfError(response); | |
16 testRunner.log(JSON.stringify(response.result)); | |
17 | |
18 var methods = [ '$', '$$', '$x', 'dir', 'dirxml', 'keys', 'values', 'profile', 'profileEnd', | |
19 'monitorEvents', 'unmonitorEvents', 'inspect', 'copy', 'clear', 'getEventL isteners', | |
20 'debug', 'undebug', 'monitor', 'unmonitor', 'table' ]; | |
21 for (var method of methods) { | |
22 response = await dp.Runtime.evaluate({expression: method, includeCommandLine API: true}); | |
23 failIfError(response); | |
24 testRunner.log(response.result.result.description); | |
25 } | |
26 testRunner.completeTest(); | |
27 | |
28 function failIfError(response) { | |
29 if (response && response.error) { | |
30 testRunner.log('FAIL: ' + JSON.stringify(response.error)); | |
31 testRunner.completeTest(); | |
32 } | |
33 } | |
34 }) | |
OLD | NEW |