@@ -42,7 +42,7 @@ def setUpTestData():
42
42
)
43
43
44
44
async with browser_page () as page :
45
- # Goto "Steps and fields "
45
+ # Goto "Logic "
46
46
await self ._admin_login (page )
47
47
await page .goto (str (admin_url ))
48
48
await page .get_by_role ("tab" , name = "Logic" ).click ()
@@ -86,3 +86,79 @@ def assertState():
86
86
)
87
87
88
88
await assertState ()
89
+
90
+ @skip_on_webtest
91
+ async def test_evaluate_dmn_missing_configuration_in_logic (self ):
92
+ @sync_to_async
93
+ def setUpTestData ():
94
+ # set up a form
95
+ form = FormFactory .create (
96
+ name = "Form with logic" ,
97
+ formstep__form_definition__slug = "form-with-logic" ,
98
+ formstep__form_definition__name = "Some step" ,
99
+ formstep__form_definition__configuration = {
100
+ "components" : [
101
+ {
102
+ "type" : "textfield" ,
103
+ "key" : "field1" ,
104
+ "label" : "Some Field" ,
105
+ },
106
+ ],
107
+ },
108
+ generate_minimal_setup = True ,
109
+ )
110
+ return form
111
+
112
+ await create_superuser ()
113
+ form = await setUpTestData ()
114
+ admin_url = str (
115
+ furl (self .live_server_url )
116
+ / reverse ("admin:forms_form_change" , args = (form .pk ,))
117
+ )
118
+
119
+ async with browser_page () as page :
120
+ # Goto "Logic"
121
+ await self ._admin_login (page )
122
+ await page .goto (str (admin_url ))
123
+ await page .get_by_role ("tab" , name = "Logic" ).click ()
124
+ await page .get_by_text ("Add rule" ).click ()
125
+ await page .get_by_role ("button" , name = "Advanced" ).click ()
126
+
127
+ await enter_json_in_editor (page , page .locator (".monaco-editor" ), True )
128
+
129
+ # Add 'Evaluate DMN' action without config
130
+ await page .get_by_text ("Add Action" ).click ()
131
+ await page .locator ('select[name="action.type"]' ).select_option (
132
+ label = "Evaluate DMN"
133
+ )
134
+ await expect (
135
+ page .get_by_text ("DMN configuration:(not configured yet)" )
136
+ ).to_be_visible ()
137
+
138
+ await page .get_by_text ("Save and continue editing" ).click ()
139
+
140
+ change_form_header = page .get_by_role ("heading" , name = "Change form" )
141
+
142
+ await expect (change_form_header ).to_be_visible ()
143
+
144
+ async def assertState ():
145
+ logic_tab = page .get_by_role ("tab" , name = "Logic" )
146
+
147
+ await expect (
148
+ logic_tab .get_by_title ("There are validation errors" )
149
+ ).to_be_visible ()
150
+
151
+ await logic_tab .click ()
152
+
153
+ # Logic shows error for DMN config
154
+ node_with_error = page .locator ("css=.dsl-editor__node--errors" )
155
+ await expect (
156
+ node_with_error .get_by_text ("This field is required" )
157
+ ).to_be_visible ()
158
+ await expect (
159
+ node_with_error .get_by_text (
160
+ "DMN configuration:(not configured yet)"
161
+ )
162
+ ).to_be_visible ()
163
+
164
+ await assertState ()
0 commit comments