##// END OF EJS Templates
js tests: simplify js test html
ergo -
Show More
@@ -1,57 +1,54 b''
1 {% extends "/layout.jinja2" %}
1 <!DOCTYPE html>
2 {% from '/reports/reports_small_list_old.jinja2' import render_reports with context %}
2 <html lang="en">
3 {% block additional_layout_scripts %}
3 <head>
4 <script src="/static/scripts/jerrormator.js" type="text/javascript"></script>
4 <meta charset="utf-8">
5 {% endblock %}
6 {% block content_class %}{% endblock %}
7 {% set layout_disable_menu = True %}
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 <script type="text/javascript">
14 <script type="text/javascript">
13 (function(callback) {
15 (function(callback) {
14 var ab = document.createElement('script');
16 var ab = document.createElement('script');
15 ab.type = 'text/javascript'; ab.async = true;
17 ab.type = 'text/javascript'; ab.async = true;
16 ab.onload = ab.onreadystatechange = callback;
18 ab.onload = ab.onreadystatechange = callback;
17 // this should match your copy of the compiled notifier.js or notifier.min.js
19 // this should match your copy of the compiled notifier.js or notifier.min.js
18 //ab.src = (("https:" == document.location.protocol) ? "https://ssljscdn" : "http://jscdn") + ".airbrake.io/notifier.min.js";
20 //ab.src = (("https:" == document.location.protocol) ? "https://ssljscdn" : "http://jscdn") + ".airbrake.io/notifier.min.js";
19 ab.src = "/static/scripts/notifier.js";
21 ab.src = "/static/scripts/notifier.js";
20 var p = document.getElementsByTagName('script')[0];
22 var p = document.getElementsByTagName('script')[0];
21 p.parentNode.insertBefore(ab, p);
23 p.parentNode.insertBefore(ab, p);
22 }(function () {
24 }(function () {
23 Airbrake.setGuessFunctionName(true);
25 Airbrake.setGuessFunctionName(true);
24 Airbrake.setHost('api.appenlight.com');
26 Airbrake.setHost('api.appenlight.com');
25 console.log(Airbrake)
27 console.log(Airbrake)
26 // insert your public api key
28 // insert your public api key
27 Airbrake.setKey('1ec3119102154a8caaa307a4495b8558');
29 Airbrake.setKey('{{ request.registry.settings.get('appenlight.public_api_key') }}');
28 Airbrake.setEnvironment('production');
30 Airbrake.setEnvironment('production');
29 Airbrake.setErrorDefaults({
31 Airbrake.setErrorDefaults({
30 url: document.URL,
32 url: document.URL,
31 component: "",
33 component: "",
32 action: "",
34 action: "",
33 user: "someuser",
35 user: "someuser",
34 });
36 });
35 }));
37 }));
36 // example error
38 // example error
37 setTimeout(function(){
39 setTimeout(function(){
38 try {
40 try {
39 cvxzvcxzcvxv + 263
41 cvxzvcxzcvxv + 263
40 } catch (e) {
42 } catch (e) {
41 window.Airbrake.captureException(e);
43 window.Airbrake.captureException(e);
42 }
44 }
43 console.log('foo');
45 console.log('foo');
44 },2000);
46 },2000);
45
47
46
48
47
49
48
50
49 </script>
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" %}
1 <!DOCTYPE html>
2 {% block dojodeps %}
2 <html lang="en">
3 deps: ["appenlight","appenlight/sections/test_error"]
3 <head>
4 {% endblock %}
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 %}
26 AppEnlight.addGlobalTags({framework:'angular', 'language':'javascript'});
9 {% block content_class %}{% endblock %}
27 AppEnlight.addGlobalExtra({some_key:'on every request'});
10 {% set layout_disable_menu = True %}
11
28
12 {% block additional_styles %}
29 }
13 <script type="text/javascript">
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 function subfunction() {
49 function subfunction() {
17 subsubfunction();
50 subsubfunction();
18 }
51 }
19
52
20 function subsubfunction() {
53 function subsubfunction() {
21 console.log('A');
54 console.log('A');
22
55
23 try {
56 try {
24 1 + nonexistantvar;
57 1 + nonexistantvar;
25 } catch (exc) {
58 } catch (exc) {
26 AppEnlight.grabError(exc, {
59 AppEnlight.grabError(exc, {
27 extra: {foo: 'foo'},
60 extra: {foo: 'foo'},
28 tags: {'bar': 'aa', 'baz': 5}
61 tags: {'bar': 'aa', 'baz': 5}
29 });
62 });
30 }
63 }
31
64
32 //var x = 1/0 + fateqtwetew;
65 //var x = 1/0 + fateqtwetew;
33 console.log('B');
66 console.log('B');
34 }
67 }
35
68
36 setTimeout(function () {
69 setTimeout(function () {
37 subfunction();
70 subfunction();
38 }, 5000);
71 }, 5000);
39
72
40
73
41 setTimeout(function () {
74 setTimeout(function () {
42 brokenCode + 666;
75 brokenCode + 666;
43 }, 3000);
76 }, 3000);
44
77
45 </script>
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" %}
1 <!DOCTYPE html>
2 {% block additional_layout_scripts %}
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 <script type="text/javascript">
47 <script type="text/javascript">
48
8 setTimeout(function(){
49 setTimeout(function(){
9 AppEnlight.log('error',"some test message");
50 AppEnlight.log('error',"some test message");
10 AppEnlight.log('info',"some info message");
51 AppEnlight.log('info',"some info message");
11 AppEnlight.log('warning',"some warn message");
52 AppEnlight.log('warning',"some warn message");
12 },2000);
53 },2000);
13
54
14
15
16
17
18 </script>
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