Debian Codegraph @

addons/test_website/static/tests/tours/error_views.js

raw
1 import { registry } from "@web/core/registry";
2
3 registry.category("web_tour.tours").add('test_error_website', {
4 url: '/test_error_view',
5 steps: () => [
6 // RPC ERROR
7 {
8 content: "trigger rpc user error",
9 trigger: 'a[href="/test_user_error_json"]',
10 run: "click",
11 },
12 {
13 trigger: '.o_notification:contains("This is a user rpc test")',
14 },
15 {
16 content: "rpc user error modal has message",
17 trigger: 'button.o_notification_close',
18 run: "click",
19 }, {
20 content: "trigger rpc access error",
21 trigger: 'a[href="/test_access_error_json"]',
22 run: "click",
23 },
24 {
25 trigger: '.o_notification:contains("This is an access rpc test")',
26 },
27 {
28 content: "rpc access error modal has message",
29 trigger: 'button.o_notification_close',
30 run: "click",
31 }, {
32 content: "trigger validation rpc error",
33 trigger: 'a[href="/test_validation_error_json"]',
34 run: "click",
35 },
36 {
37 trigger: '.o_notification:contains("This is a validation rpc test")',
38 },
39 {
40 content: "rpc validation error modal has message",
41 trigger: 'button.o_notification_close',
42 run: "click",
43 }, {
44 content: "trigger rpc missing error",
45 trigger: 'a[href="/test_missing_error_json"]',
46 run: "click",
47 },
48 {
49 trigger: '.o_notification:contains("This is a missing rpc test")',
50 },
51 {
52 content: "rpc missing error modal has message",
53 trigger: 'button.o_notification_close',
54 run: "click",
55 }, {
56 content: "trigger rpc error 403",
57 trigger: 'a[href="/test_access_denied_json"]',
58 run: "click",
59 },
60 {
61 trigger: '.o_notification:contains("This is an access denied rpc test")',
62 },
63 {
64 content: "rpc error 403 modal has message",
65 trigger: 'button.o_notification_close',
66 run: "click",
67 }, {
68 content: "trigger rpc error 500",
69 trigger: 'a[href="/test_internal_error_json"]',
70 run: "click",
71 },
72 {
73 trigger: "div.o_error_dialog.modal-content",
74 },
75 {
76 content: "rpc error 500 modal is an ErrorDialog",
77 trigger: '.modal-footer button.btn.btn-primary',
78 run: "click",
79 },
80 // HTTP ERROR
81 {
82 content: "trigger http user error",
83 trigger: 'body',
84 run: function () {
85 window.location.href = window.location.origin + '/test_user_error_http?debug=0';
86 },
87 expectUnloadPage: true,
88 },
89 {
90 trigger: 'h1:contains("Something went wrong.")',
91 },
92 {
93 content: "http user error page has title and message",
94 trigger: 'div.container pre:contains("This is a user http test")',
95 run: function () {
96 window.location.href = window.location.origin + '/test_user_error_http?debug=1';
97 },
98 expectUnloadPage: true,
99 },
100 {
101 trigger: 'h1:contains("Something went wrong.")',
102 },
103 {
104 content: "http user error page debug has title and message open",
105 trigger: 'div#error_main.collapse.show pre:contains("This is a user http test")',
106 }, {
107 content: "http user error page debug has traceback closed",
108 trigger: 'body:has(div#error_traceback.collapse:not(.show) pre#exception_traceback)',
109 run: function () {
110 window.location.href = window.location.origin + '/test_validation_error_http?debug=0';
111 },
112 expectUnloadPage: true,
113 },
114 {
115 trigger: 'h1:contains("Something went wrong.")',
116 },
117 {
118 content: "http validation error page has title and message",
119 trigger: 'div.container pre:contains("This is a validation http test")',
120 run: function () {
121 window.location.href = window.location.origin + '/test_validation_error_http?debug=1';
122 },
123 expectUnloadPage: true,
124 },
125 {
126 trigger: 'h1:contains("Something went wrong.")',
127 },
128 {
129 content: "http validation error page debug has title and message open",
130 trigger: 'div#error_main.collapse.show pre:contains("This is a validation http test")',
131 }, {
132 content: "http validation error page debug has traceback closed",
133 trigger: 'body:has(div#error_traceback.collapse:not(.show) pre#exception_traceback)',
134 run: function () {
135 window.location.href = window.location.origin + '/test_access_error_http?debug=0';
136 },
137 expectUnloadPage: true,
138 },
139 {
140 trigger: 'h1:contains("403: Forbidden")',
141 },
142 {
143 content: "http access error page has title and message",
144 trigger: 'div.container pre:contains("This is an access http test")',
145 run: function () {
146 window.location.href = window.location.origin + '/test_access_error_http?debug=1';
147 },
148 expectUnloadPage: true,
149 },
150 {
151 trigger: 'h1:contains("403: Forbidden")',
152 },
153 {
154 content: "http access error page debug has title and message open",
155 trigger: 'div#error_main.collapse.show pre:contains("This is an access http test")',
156 }, {
157 content: "http access error page debug has traceback closed",
158 trigger: 'body:has(div#error_traceback.collapse:not(.show) pre#exception_traceback)',
159 run: function () {
160 window.location.href = window.location.origin + '/test_view_access_error?debug=0';
161 },
162 expectUnloadPage: true,
163 },
164 {
165 trigger: 'h1:contains("403: Forbidden")',
166 },
167 {
168 content: "http access error page has title and message",
169 trigger: 'div.container pre:contains("Uh-oh! Looks like you have stumbled upon some top-secret records.")',
170 run: function () {
171 window.location.href = window.location.origin + '/test_view_access_error?debug=1';
172 },
173 expectUnloadPage: true,
174 },
175 {
176 trigger: 'h1:contains("403: Forbidden")',
177 },
178 {
179 content: "http access error page debug has title and message open",
180 trigger: 'div#error_main.collapse.show pre:contains("Uh-oh! Looks like you have stumbled upon some top-secret records.")',
181 }, {
182 content: "http access error page debug has traceback closed",
183 trigger: 'body:has(div#error_traceback.collapse:not(.show) pre#exception_traceback)',
184 run: function () {
185 window.location.href = window.location.origin + '/test_missing_error_http?debug=0';
186 },
187 expectUnloadPage: true,
188 },
189 {
190 trigger: 'h1:contains("Error 404")',
191 run: function () {
192 window.location.href = window.location.origin + '/test_missing_error_http?debug=1';
193 },
194 expectUnloadPage: true,
195 },
196 {
197 trigger: 'h1:contains("Error 404")',
198 run: function () {
199 window.location.href = window.location.origin + '/test_access_denied_http?debug=1';
200 },
201 expectUnloadPage: true,
202 },
203 {
204 trigger: 'h1:contains("403: Forbidden")',
205 },
206 {
207 content: "http error 403 page has title but no message",
208 // See http.py _transactionning, the exception is replaced so there is no message !
209 trigger: 'div#wrap:not(:has(pre:contains("Traceback"))',
210 run: function () {
211 window.location.href = window.location.origin + '/test_access_denied_http?debug=1';
212 },
213 expectUnloadPage: true,
214 },
215 {
216 trigger: 'h1:contains("403: Forbidden")',
217 },
218 {
219 content: "http 403 error page debug has title but no message",
220 trigger: 'div#wrap:not(:has(pre:contains("Traceback"))',
221 },
222 ]});