Skip to content

Commit ddc3cd3

Browse files
author
Pranay Tippa
committed
test: validation of Datasource in UE
2 parents 9d60a2a + 5234062 commit ddc3cd3

6 files changed

Lines changed: 131 additions & 319 deletions

File tree

blocks/form/_form.json

Lines changed: 8 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -41,142 +41,14 @@
4141
{
4242
"id": "form",
4343
"fields": [
44-
{
45-
"component": "select",
46-
"name": "thankYouOption",
47-
"label": "On Submit",
48-
"valueType": "string",
49-
"options": [
50-
{
51-
"name": "Show message",
52-
"value": "message"
53-
}
54-
]
55-
},
56-
{
57-
"component": "richtext",
58-
"name": "thankYouMessage",
59-
"label": "Message Content",
60-
"valueType": "string",
61-
"condition": { "==": [{ "var": "thankYouOption" }, "message"] }
62-
},
63-
{
64-
"component": "select",
65-
"valueType": "string",
66-
"name": "actionType",
67-
"label": "Submit Action",
68-
"options": [
69-
{
70-
"name": "Submit to REST endpoint",
71-
"value": "fd/af/components/guidesubmittype/restendpoint"
72-
},
73-
{
74-
"name": "Send email",
75-
"value": "fd/af/components/guidesubmittype/email"
76-
},
77-
{
78-
"name": "Persist to Spreadsheet",
79-
"value": "spreadsheet"
80-
}
81-
],
82-
"value" : ""
83-
},
84-
{
85-
"component": "boolean",
86-
"name": "enableRestEndpointPost",
87-
"label": "Enable POST request",
88-
"valueType": "string",
89-
"condition": { "==": [{ "var": "actionType" }, "fd/af/components/guidesubmittype/restendpoint"] }
90-
},
91-
{
92-
"component": "text",
93-
"name": "restEndpointPostUrl",
94-
"label": "URL For POST request",
95-
"valueType": "string",
96-
"condition": { "==": [{ "var": "actionType" }, "fd/af/components/guidesubmittype/restendpoint"] }
97-
},
98-
{
99-
"condition": { "==": [{ "var": "actionType" }, "spreadsheet"] },
100-
"component": "text",
101-
"name": "spreadsheetUrl",
102-
"label": "Spreadsheet Url",
103-
"valueType": "string"
104-
},
105-
{
106-
"component": "container",
107-
"name": "email",
108-
"label": "Email Configuration",
109-
"collapsible": false,
110-
"condition": { "==": [{ "var": "actionType" }, "fd/af/components/guidesubmittype/email"] },
111-
"fields": [
112-
{
113-
"component": "text",
114-
"name": "from",
115-
"label": "From",
116-
"valueType": "string"
117-
},
118-
{
119-
"component": "text",
120-
"name": "mailto",
121-
"label": "To",
122-
"valueType": "string",
123-
"multi": true,
124-
"required": true
125-
},
126-
{
127-
"component": "text",
128-
"name": "cc",
129-
"label": "CC",
130-
"valueType": "string",
131-
"multi": true
132-
},
133-
{
134-
"component": "text",
135-
"name": "bcc",
136-
"label": "BCC",
137-
"valueType": "string",
138-
"multi": true
139-
},
140-
{
141-
"component": "text",
142-
"name": "subject",
143-
"label": "Subject",
144-
"valueType": "string"
145-
},
146-
{
147-
"component": "boolean",
148-
"name": "useExternalEmailTemplate",
149-
"label": "Use external template",
150-
"valueType": "boolean"
151-
},
152-
{
153-
"component": "boolean",
154-
"name": "useHtmlTemplate",
155-
"label": "Use html template",
156-
"valueType": "boolean"
157-
},
158-
{
159-
"component": "aem-content",
160-
"name": "templatePath",
161-
"label": "External template path",
162-
"valueType": "string",
163-
"condition": { "==": [{ "var": "useExternalEmailTemplate" }, true] }
164-
},
165-
{
166-
"component": "richtext",
167-
"name": "template",
168-
"label": "Email template",
169-
"valueType": "string",
170-
"condition": { "!=": [{ "var": "useExternalEmailTemplate" }, true] }
171-
},
172-
{
173-
"component": "boolean",
174-
"name": "includeAttachments",
175-
"label": "Include attachments",
176-
"valueType": "boolean"
177-
}
178-
]
179-
}
44+
{
45+
"component": "container",
46+
"name": "basic",
47+
"label": "Use the Edit Form Properties extension to configure Adaptive Form properties, including Submit Action, Prefill, and Thank-You options.",
48+
"description": "Visit https://www.adobe.com/go/learn_aemforms_cs_properties_ext for more details.",
49+
"collapsible": false,
50+
"fields": []
51+
}
18052
]
18153
},
18254
{

blocks/form/rules/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ async function initializeRuleEngineWorker(formDef, renderHTMLForm) {
401401
}
402402

403403
export async function initAdaptiveForm(formDef, createForm) {
404-
await registerCustomFunctions(formDef?.properties?.customFunctionsPath, window.hlx?.codeBasePath);
404+
await registerCustomFunctions(formDef?.properties?.customFunctionsPath || '/blocks/form/functions.js', window.hlx?.codeBasePath);
405405
const response = await initializeRuleEngineWorker(formDef, createForm);
406406
return response?.form;
407407
}

component-models.json

Lines changed: 4 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -197,190 +197,13 @@
197197
{
198198
"id": "form",
199199
"fields": [
200-
{
201-
"component": "select",
202-
"name": "thankYouOption",
203-
"label": "On Submit",
204-
"valueType": "string",
205-
"options": [
206-
{
207-
"name": "Show message",
208-
"value": "message"
209-
}
210-
]
211-
},
212-
{
213-
"component": "richtext",
214-
"name": "thankYouMessage",
215-
"label": "Message Content",
216-
"valueType": "string",
217-
"condition": {
218-
"==": [
219-
{
220-
"var": "thankYouOption"
221-
},
222-
"message"
223-
]
224-
}
225-
},
226-
{
227-
"component": "select",
228-
"valueType": "string",
229-
"name": "actionType",
230-
"label": "Submit Action",
231-
"options": [
232-
{
233-
"name": "Submit to REST endpoint",
234-
"value": "fd/af/components/guidesubmittype/restendpoint"
235-
},
236-
{
237-
"name": "Send email",
238-
"value": "fd/af/components/guidesubmittype/email"
239-
},
240-
{
241-
"name": "Persist to Spreadsheet",
242-
"value": "spreadsheet"
243-
}
244-
],
245-
"value": ""
246-
},
247-
{
248-
"component": "boolean",
249-
"name": "enableRestEndpointPost",
250-
"label": "Enable POST request",
251-
"valueType": "string",
252-
"condition": {
253-
"==": [
254-
{
255-
"var": "actionType"
256-
},
257-
"fd/af/components/guidesubmittype/restendpoint"
258-
]
259-
}
260-
},
261-
{
262-
"component": "text",
263-
"name": "restEndpointPostUrl",
264-
"label": "URL For POST request",
265-
"valueType": "string",
266-
"condition": {
267-
"==": [
268-
{
269-
"var": "actionType"
270-
},
271-
"fd/af/components/guidesubmittype/restendpoint"
272-
]
273-
}
274-
},
275-
{
276-
"condition": {
277-
"==": [
278-
{
279-
"var": "actionType"
280-
},
281-
"spreadsheet"
282-
]
283-
},
284-
"component": "text",
285-
"name": "spreadsheetUrl",
286-
"label": "Spreadsheet Url",
287-
"valueType": "string"
288-
},
289200
{
290201
"component": "container",
291-
"name": "email",
292-
"label": "Email Configuration",
202+
"name": "basic",
203+
"label": "Use the Edit Form Properties extension to configure Adaptive Form properties, including Submit Action, Prefill, and Thank-You options.",
204+
"description": "Visit https://www.adobe.com/go/learn_aemforms_cs_properties_ext for more details.",
293205
"collapsible": false,
294-
"condition": {
295-
"==": [
296-
{
297-
"var": "actionType"
298-
},
299-
"fd/af/components/guidesubmittype/email"
300-
]
301-
},
302-
"fields": [
303-
{
304-
"component": "text",
305-
"name": "from",
306-
"label": "From",
307-
"valueType": "string"
308-
},
309-
{
310-
"component": "text",
311-
"name": "mailto",
312-
"label": "To",
313-
"valueType": "string",
314-
"multi": true,
315-
"required": true
316-
},
317-
{
318-
"component": "text",
319-
"name": "cc",
320-
"label": "CC",
321-
"valueType": "string",
322-
"multi": true
323-
},
324-
{
325-
"component": "text",
326-
"name": "bcc",
327-
"label": "BCC",
328-
"valueType": "string",
329-
"multi": true
330-
},
331-
{
332-
"component": "text",
333-
"name": "subject",
334-
"label": "Subject",
335-
"valueType": "string"
336-
},
337-
{
338-
"component": "boolean",
339-
"name": "useExternalEmailTemplate",
340-
"label": "Use external template",
341-
"valueType": "boolean"
342-
},
343-
{
344-
"component": "boolean",
345-
"name": "useHtmlTemplate",
346-
"label": "Use html template",
347-
"valueType": "boolean"
348-
},
349-
{
350-
"component": "aem-content",
351-
"name": "templatePath",
352-
"label": "External template path",
353-
"valueType": "string",
354-
"condition": {
355-
"==": [
356-
{
357-
"var": "useExternalEmailTemplate"
358-
},
359-
true
360-
]
361-
}
362-
},
363-
{
364-
"component": "richtext",
365-
"name": "template",
366-
"label": "Email template",
367-
"valueType": "string",
368-
"condition": {
369-
"!=": [
370-
{
371-
"var": "useExternalEmailTemplate"
372-
},
373-
true
374-
]
375-
}
376-
},
377-
{
378-
"component": "boolean",
379-
"name": "includeAttachments",
380-
"label": "Include attachments",
381-
"valueType": "boolean"
382-
}
383-
]
206+
"fields": []
384207
}
385208
]
386209
},

test/e2e/main/page/universalEditorBasePage.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,23 @@ export class UniversalEditorBase {
108108
}
109109
}
110110
}
111+
112+
// This function expands the tree nodes in the content tree to reach a specific field.
113+
// Do not include leaf nodes (fields) in the path that do not have an expand/collapse button.
114+
// Only intermediate nodes with expandable behavior should be part of the path.
115+
async expandContentTreeField(page, frame, path) {
116+
await this.componentUtils.verifyAndClickContentTree(frame);
117+
const nodeNames = path.split('/').filter(Boolean);
118+
for (const nodeName of nodeNames) {
119+
const expandButtonSelector = `li[data-resource$="${nodeName}"][class*="treenode"] button`;
120+
const expandButton = frame.locator(expandButtonSelector).first();
121+
await expect(expandButton).toBeVisible({ timeout: 5000 });
122+
123+
const ariaLabel = await expandButton.getAttribute('aria-label');
124+
if (ariaLabel.includes('Expand Node')) {
125+
await expandButton.click();
126+
await expect(expandButton).toHaveAttribute('aria-label', 'Collapse Node');
127+
}
128+
}
129+
}
111130
}

test/e2e/main/utils/componentUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class ComponentUtils {
55
contentTreeLabel: '[aria-label="Content tree"]',
66
deleteButton: 'button[aria-label="Delete"]',
77
componentList: 'div[class*="menu"]',
8-
dataSource: 'button[aria-label="Data Sources"]',
8+
dataSource: 'button[aria-label="Data Sources"]'
99
};
1010

1111
async addComponent(frame, componentName) {

0 commit comments

Comments
 (0)