##// END OF EJS Templates
js tests: simplify js test html
ergo -
Show More
@@ -1,57 +1,54 b''
1 {% extends "/layout.jinja2" %}
2 {% from '/reports/reports_small_list_old.jinja2' import render_reports with context %}
3 {% block additional_layout_scripts %}
4 <script src="/static/scripts/jerrormator.js" type="text/javascript"></script>
5 {% endblock %}
6 {% block content_class %}{% endblock %}
7 {% set layout_disable_menu = True %}
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
8 5
9 {% block additional_styles %}
6 <title>Error test</title>
7 <meta name="description" content="">
8 </head>
9 <body>
10
11 <h1>Error test</h1>
10 12
11 13
12 14 <script type="text/javascript">
13 15 (function(callback) {
14 16 var ab = document.createElement('script');
15 17 ab.type = 'text/javascript'; ab.async = true;
16 18 ab.onload = ab.onreadystatechange = callback;
17 19 // this should match your copy of the compiled notifier.js or notifier.min.js
18 20 //ab.src = (("https:" == document.location.protocol) ? "https://ssljscdn" : "http://jscdn") + ".airbrake.io/notifier.min.js";
19 21 ab.src = "/static/scripts/notifier.js";
20 22 var p = document.getElementsByTagName('script')[0];
21 23 p.parentNode.insertBefore(ab, p);
22 24 }(function () {
23 25 Airbrake.setGuessFunctionName(true);
24 26 Airbrake.setHost('api.appenlight.com');
25 27 console.log(Airbrake)
26 28 // insert your public api key
27 Airbrake.setKey('1ec3119102154a8caaa307a4495b8558');
29 Airbrake.setKey('{{ request.registry.settings.get('appenlight.public_api_key') }}');
28 30 Airbrake.setEnvironment('production');
29 31 Airbrake.setErrorDefaults({
30 32 url: document.URL,
31 33 component: "",
32 34 action: "",
33 35 user: "someuser",
34 36 });
35 37 }));
36 38 // example error
37 39 setTimeout(function(){
38 40 try {
39 41 cvxzvcxzcvxv + 263
40 42 } catch (e) {
41 43 window.Airbrake.captureException(e);
42 44 }
43 45 console.log('foo');
44 46 },2000);
45 47
46 48
47 49
48 50
49 51 </script>
50 {% endblock %}
51
52 {% block page_title %}
53 <h1 class="page-title">{{_('JS')}}</h1>
54 {% endblock %}
55 {% block content %}
56 52
57 {% endblock %}
53 </body>
54 </html>
@@ -1,53 +1,81 b''
1 {% extends "/layout.jinja2" %}
2 {% block dojodeps %}
3 deps: ["appenlight","appenlight/sections/test_error"]
4 {% endblock %}
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 5
6 {% block additional_layout_scripts %}
6 <title>Error test</title>
7 <meta name="description" content="">
8 {% if request.registry.settings.get('appenlight.public_api_key') %}
9 <script type="application/javascript">
10 var initAppEnlight = function () {
11 if(this.readyState!='loading'){
12 AppEnlight.init({
13 apiKey:'{{ request.registry.settings.get('appenlight.public_api_key') }}',
14 windowOnError: 1 // enable to hook to window.onerror
15 });
16 // setting request info is completly optional
17 AppEnlight.setRequestInfo({
18 server:"{{ request.environ.get('SERVER_NAME', '<unknown>') }}",
19 {% if request.user %}
20 username:'{{ request.user.user_name }}',
21 {% endif %}
22 ip: "{{ request.environ.get('REMOTE_ADDR', '') }}",
23 request_id:"{{ request.environ.get('appenlight.request_id', '') }}"
24 });
7 25
8 {% endblock %}
9 {% block content_class %}{% endblock %}
10 {% set layout_disable_menu = True %}
26 AppEnlight.addGlobalTags({framework:'angular', 'language':'javascript'});
27 AppEnlight.addGlobalExtra({some_key:'on every request'});
11 28
12 {% block additional_styles %}
13 <script type="text/javascript">
29 }
30 };
31 // load the script asynchroneously
32 var scrElem = document.createElement('script');
33 scrElem.type = 'text/javascript';
34 scrElem.async = true;
35 scrElem.onload = scrElem.onreadystatechange = initAppEnlight;
36 scrElem.src = "//cdn.jsdelivr.net/appenlight/latest/appenlight-client.min.js";
37 scrElem.src = "/static/appenlight/js/appenlight-client.js";
38 var p = document.getElementsByTagName('script')[0];
39 p.parentNode.insertBefore(scrElem, p);
40 </script>
41 {% endif %}
42 </head>
43 <body>
44
45 <h1>Error test</h1>
14 46
47 <script type="text/javascript">
15 48
16 49 function subfunction() {
17 50 subsubfunction();
18 51 }
19 52
20 53 function subsubfunction() {
21 54 console.log('A');
22 55
23 56 try {
24 57 1 + nonexistantvar;
25 58 } catch (exc) {
26 59 AppEnlight.grabError(exc, {
27 60 extra: {foo: 'foo'},
28 61 tags: {'bar': 'aa', 'baz': 5}
29 62 });
30 63 }
31 64
32 65 //var x = 1/0 + fateqtwetew;
33 66 console.log('B');
34 67 }
35 68
36 69 setTimeout(function () {
37 70 subfunction();
38 71 }, 5000);
39 72
40 73
41 74 setTimeout(function () {
42 75 brokenCode + 666;
43 76 }, 3000);
44 77
45 78 </script>
46 {% endblock %}
47
48 {% block page_title %}
49 <h1 class="page-title">{{ _('JS') }}</h1>
50 {% endblock %}
51 {% block content %}
52 79
53 {% endblock %}
80 </body>
81 </html>
@@ -1,33 +1,58 b''
1 {% extends "/layout.jinja2" %}
2 {% block additional_layout_scripts %}
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5
6 <title>Error test</title>
7 <meta name="description" content="">
8 {% if request.registry.settings.get('appenlight.public_api_key') %}
9 <script type="application/javascript">
10 var initAppEnlight = function () {
11 if(this.readyState!='loading'){
12 AppEnlight.init({
13 apiKey:'{{ request.registry.settings.get('appenlight.public_api_key') }}',
14 windowOnError: 1 // enable to hook to window.onerror
15 });
16 // setting request info is completly optional
17 AppEnlight.setRequestInfo({
18 server:"{{ request.environ.get('SERVER_NAME', '<unknown>') }}",
19 {% if request.user %}
20 username:'{{ request.user.user_name }}',
21 {% endif %}
22 ip: "{{ request.environ.get('REMOTE_ADDR', '') }}",
23 request_id:"{{ request.environ.get('appenlight.request_id', '') }}"
24 });
25
26 AppEnlight.addGlobalTags({framework:'angular', 'language':'javascript'});
27 AppEnlight.addGlobalExtra({some_key:'on every request'});
28
29 }
30 };
31 // load the script asynchroneously
32 var scrElem = document.createElement('script');
33 scrElem.type = 'text/javascript';
34 scrElem.async = true;
35 scrElem.onload = scrElem.onreadystatechange = initAppEnlight;
36 scrElem.src = "//cdn.jsdelivr.net/appenlight/latest/appenlight-client.min.js";
37 scrElem.src = "/static/appenlight/js/appenlight-client.js";
38 var p = document.getElementsByTagName('script')[0];
39 p.parentNode.insertBefore(scrElem, p);
40 </script>
41 {% endif %}
42 </head>
43 <body>
3 44
4 {% endblock %}
45 <h1>Error test</h1>
5 46
6 {% block additional_styles %}
7 47 <script type="text/javascript">
48
8 49 setTimeout(function(){
9 50 AppEnlight.log('error',"some test message");
10 51 AppEnlight.log('info',"some info message");
11 52 AppEnlight.log('warning',"some warn message");
12 53 },2000);
13 54
14
15
16
17
18 55 </script>
19 {% endblock %}
20
21 {% block content_class %}{% endblock %}
22 {% set layout_disable_menu = True %}
23
24
25
26 {% block page_title %}
27 <h1 class="page-title">{{_('JS')}}</h1>
28 {% endblock %}
29 {% block content %}
30
31
32 56
33 {% endblock %}
57 </body>
58 </html>
General Comments 0
You need to be logged in to leave comments. Login now