Skip to content

Commit c78b3f3

Browse files
committed
Fixing more tests.
1 parent acb624e commit c78b3f3

File tree

3 files changed

+73
-31
lines changed

3 files changed

+73
-31
lines changed

eform-client/cypress/e2e/j/eform-visual-editor.create-eform.spec.cy.ts

Lines changed: 71 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Visual editor - Create eForm', () => {
2020
// Try to create field without main checklist name (translation)
2121
cy.get('#initialFieldCreateBtn').click();
2222
cy.get('#fieldTypeSelector input').clear().type('Info');
23-
selectValueInNgSelectorNoSelector('Info element');
23+
selectValueInNgSelectorNoSelector('Info');
2424
cy.get('#fieldNameTranslation_0').clear().type(fieldName);
2525
cy.get('#changeFieldSaveBtn').click();
2626
cy.wait(1000);
@@ -39,21 +39,24 @@ describe('Visual editor - Create eForm', () => {
3939

4040
// Save the eForm without adding any fields
4141
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
42+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
43+
cy.intercept('GET', '**/api/tags/index').as('getTags');
4244
cy.get('#saveCreateEformBtn').click();
4345
cy.wait('@saveeForm', { timeout: 60000 });
46+
cy.wait('@getTemplates', { timeout: 60000 });
47+
cy.wait('@getTags', { timeout: 60000 });
4448

4549
// Verify eForm appears in the list
46-
cy.get('#spinner-animation').should('not.exist');
47-
cy.get('#eFormTableBody').should('be.visible');
48-
cy.get('#eFormTableBody tr').first().find('td').eq(1).should('contain', eformName);
50+
cy.get('#mainPageEFormsTableBody').should('be.visible');
51+
cy.get('#mainPageEFormsTableBody tbody tr').first().find('#eform-label-0').eq(0).should('contain', eformName);
4952

5053
// Verify eForm has correct properties when edited
5154
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
5255
cy.get('#edit-eform-btn-0').click();
5356
cy.wait('@geteForm', { timeout: 60000 });
5457

5558
cy.get('#mainCheckListNameTranslation_1').should('have.value', eformName);
56-
cy.get('#mainCheckListDescriptionTranslation_1').should('have.value', eformDescription);
59+
cy.get('#mainCheckListDescriptionTranslation_1').should('contain', eformDescription);
5760

5861
// No fields should be present
5962
cy.get('#fields_0').should('not.exist');
@@ -72,29 +75,32 @@ describe('Visual editor - Create eForm', () => {
7275
// Add a field (Info element/None type)
7376
cy.get('#initialFieldCreateBtn').click();
7477
cy.get('#fieldTypeSelector input').clear().type('Info');
75-
selectValueInNgSelectorNoSelector('Info element');
78+
selectValueInNgSelectorNoSelector('Info');
7679
cy.get('#fieldNameTranslation_0').clear().type(fieldName);
7780
cy.get('#fieldDescriptionTranslation_0').clear().type(fieldDescription);
7881
cy.get('#changeFieldSaveBtn').click();
7982
cy.wait(1000);
8083

8184
// Save the eForm
8285
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
86+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
87+
cy.intercept('GET', '**/api/tags/index').as('getTags');
8388
cy.get('#saveCreateEformBtn').click();
8489
cy.wait('@saveeForm', { timeout: 60000 });
90+
cy.wait('@getTemplates', { timeout: 60000 });
91+
cy.wait('@getTags', { timeout: 60000 });
8592

8693
// Verify eForm appears in the list
87-
cy.get('#spinner-animation').should('not.exist');
88-
cy.get('#eFormTableBody').should('be.visible');
89-
cy.get('#eFormTableBody tr').first().find('td').eq(1).should('contain', eformName);
94+
cy.get('#mainPageEFormsTableBody').should('be.visible');
95+
cy.get('#mainPageEFormsTableBody tbody tr').first().find('#eform-label-0').eq(0).should('contain', eformName);
9096

9197
// Verify eForm has correct properties when edited
9298
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
9399
cy.get('#edit-eform-btn-0').click();
94100
cy.wait('@geteForm', { timeout: 60000 });
95101

96102
cy.get('#mainCheckListNameTranslation_1').should('have.value', eformName);
97-
cy.get('#mainCheckListDescriptionTranslation_1').should('have.value', eformDescription);
103+
cy.get('#mainCheckListDescriptionTranslation_1').should('contain', eformDescription);
98104

99105
// Verify field exists with correct properties
100106
cy.get('#fieldSection0').should('exist');
@@ -127,13 +133,16 @@ describe('Visual editor - Create eForm', () => {
127133

128134
// Save the eForm
129135
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
136+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
137+
cy.intercept('GET', '**/api/tags/index').as('getTags');
130138
cy.get('#saveCreateEformBtn').click();
131139
cy.wait('@saveeForm', { timeout: 60000 });
140+
cy.wait('@getTemplates', { timeout: 60000 });
141+
cy.wait('@getTags', { timeout: 60000 });
132142

133143
// Verify eForm appears in the list
134-
cy.get('#spinner-animation').should('not.exist');
135-
cy.get('#eFormTableBody').should('be.visible');
136-
cy.get('#eFormTableBody tr').first().find('td').eq(1).should('contain', eformName);
144+
cy.get('#mainPageEFormsTableBody').should('be.visible');
145+
cy.get('#mainPageEFormsTableBody tbody tr').first().find('#eform-label-0').eq(0).should('contain', eformName);
137146

138147
// Verify eForm has correct properties when edited
139148
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
@@ -156,7 +165,7 @@ describe('Visual editor - Create eForm', () => {
156165
// Add a field
157166
cy.get('#initialFieldCreateBtn').click();
158167
cy.get('#fieldTypeSelector input').clear().type('Info');
159-
selectValueInNgSelectorNoSelector('Info element');
168+
selectValueInNgSelectorNoSelector('Info');
160169
cy.get('#fieldNameTranslation_0').clear().type(fieldName);
161170
cy.get('#changeFieldSaveBtn').click();
162171
cy.wait(1000);
@@ -170,13 +179,16 @@ describe('Visual editor - Create eForm', () => {
170179

171180
// Save the eForm
172181
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
182+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
183+
cy.intercept('GET', '**/api/tags/index').as('getTags');
173184
cy.get('#saveCreateEformBtn').click();
174185
cy.wait('@saveeForm', { timeout: 60000 });
186+
cy.wait('@getTemplates', { timeout: 60000 });
187+
cy.wait('@getTags', { timeout: 60000 });
175188

176189
// Verify eForm appears in the list
177-
cy.get('#spinner-animation').should('not.exist');
178-
cy.get('#eFormTableBody').should('be.visible');
179-
cy.get('#eFormTableBody tr').first().find('td').eq(1).should('contain', eformName);
190+
cy.get('#mainPageEFormsTableBody').should('be.visible');
191+
cy.get('#mainPageEFormsTableBody tbody tr').first().find('#eform-label-0').eq(0).should('contain', eformName);
180192

181193
// Verify field has red color when edited
182194
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
@@ -221,13 +233,16 @@ describe('Visual editor - Create eForm', () => {
221233

222234
// Save the eForm
223235
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
236+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
237+
cy.intercept('GET', '**/api/tags/index').as('getTags');
224238
cy.get('#saveCreateEformBtn').click();
225239
cy.wait('@saveeForm', { timeout: 60000 });
240+
cy.wait('@getTemplates', { timeout: 60000 });
241+
cy.wait('@getTags', { timeout: 60000 });
226242

227243
// Verify eForm appears in the list
228-
cy.get('#spinner-animation').should('not.exist');
229-
cy.get('#eFormTableBody').should('be.visible');
230-
cy.get('#eFormTableBody tr').first().find('td').eq(1).should('contain', eformName);
244+
cy.get('#mainPageEFormsTableBody').should('be.visible');
245+
cy.get('#mainPageEFormsTableBody tbody tr').first().find('#eform-label-0').eq(0).should('contain', eformName);
231246

232247
// Verify eForm has correct properties when edited
233248
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
@@ -248,7 +263,7 @@ describe('Visual editor - Create eForm', () => {
248263
// Add a field
249264
cy.get('#initialFieldCreateBtn').click();
250265
cy.get('#fieldTypeSelector input').clear().type('Info');
251-
selectValueInNgSelectorNoSelector('Info element');
266+
selectValueInNgSelectorNoSelector('Info');
252267
cy.get('#fieldNameTranslation_0').clear().type(fieldName);
253268
cy.get('#changeFieldSaveBtn').click();
254269
cy.wait(1000);
@@ -259,11 +274,14 @@ describe('Visual editor - Create eForm', () => {
259274

260275
// Save the eForm
261276
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
277+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
278+
cy.intercept('GET', '**/api/tags/index').as('getTags');
262279
cy.get('#saveCreateEformBtn').click();
263280
cy.wait('@saveeForm', { timeout: 60000 });
281+
cy.wait('@getTemplates', { timeout: 60000 });
282+
cy.wait('@getTags', { timeout: 60000 });
264283

265284
// Verify eForm appears in the list
266-
cy.get('#spinner-animation').should('not.exist');
267285

268286
// Verify eForm has two fields when edited
269287
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
@@ -297,7 +315,7 @@ describe('Visual editor - Create eForm', () => {
297315
// Add nested field
298316
cy.get('#fieldSection0 #addNewNestedField').click();
299317
cy.get('#fieldTypeSelector input').clear().type('Info');
300-
selectValueInNgSelectorNoSelector('Info element');
318+
selectValueInNgSelectorNoSelector('Info');
301319
cy.get('#fieldNameTranslation_0').clear().type(nestedFieldName);
302320
cy.get('#changeFieldSaveBtn').click();
303321
cy.wait(1000);
@@ -315,11 +333,14 @@ describe('Visual editor - Create eForm', () => {
315333

316334
// Save the eForm
317335
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
336+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
337+
cy.intercept('GET', '**/api/tags/index').as('getTags');
318338
cy.get('#saveCreateEformBtn').click();
319339
cy.wait('@saveeForm', { timeout: 60000 });
340+
cy.wait('@getTemplates', { timeout: 60000 });
341+
cy.wait('@getTags', { timeout: 60000 });
320342

321343
// Verify eForm has correct structure when edited
322-
cy.get('#spinner-animation').should('not.exist');
323344
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
324345
cy.get('#edit-eform-btn-0').click();
325346
cy.wait('@geteForm', { timeout: 60000 });
@@ -357,7 +378,7 @@ describe('Visual editor - Create eForm', () => {
357378
// Add nested field
358379
cy.get('#fieldSection0 #addNewNestedField').click();
359380
cy.get('#fieldTypeSelector input').clear().type('Info');
360-
selectValueInNgSelectorNoSelector('Info element');
381+
selectValueInNgSelectorNoSelector('Info');
361382
cy.get('#fieldNameTranslation_0').clear().type(nestedFieldName);
362383
cy.get('#changeFieldSaveBtn').click();
363384
cy.wait(1000);
@@ -380,11 +401,14 @@ describe('Visual editor - Create eForm', () => {
380401

381402
// Save the eForm
382403
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
404+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
405+
cy.intercept('GET', '**/api/tags/index').as('getTags');
383406
cy.get('#saveCreateEformBtn').click();
384407
cy.wait('@saveeForm', { timeout: 60000 });
408+
cy.wait('@getTemplates', { timeout: 60000 });
409+
cy.wait('@getTags', { timeout: 60000 });
385410

386411
// Verify field group is deleted when edited
387-
cy.get('#spinner-animation').should('not.exist');
388412
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
389413
cy.get('#edit-eform-btn-0').click();
390414
cy.wait('@geteForm', { timeout: 60000 });
@@ -415,11 +439,14 @@ describe('Visual editor - Create eForm', () => {
415439

416440
// Save the eForm
417441
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
442+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
443+
cy.intercept('GET', '**/api/tags/index').as('getTags');
418444
cy.get('#saveCreateEformBtn').click();
419445
cy.wait('@saveeForm', { timeout: 60000 });
446+
cy.wait('@getTemplates', { timeout: 60000 });
447+
cy.wait('@getTags', { timeout: 60000 });
420448

421449
// Verify eForm has nested checklists when edited
422-
cy.get('#spinner-animation').should('not.exist');
423450
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
424451
cy.get('#edit-eform-btn-0').click();
425452
cy.wait('@geteForm', { timeout: 60000 });
@@ -445,7 +472,7 @@ describe('Visual editor - Create eForm', () => {
445472
// Add field to first nested checklist
446473
cy.get('#addNewNestedField0').click();
447474
cy.get('#fieldTypeSelector input').clear().type('Info');
448-
selectValueInNgSelectorNoSelector('Info element');
475+
selectValueInNgSelectorNoSelector('Info');
449476
cy.get('#fieldNameTranslation_0').clear().type(fieldName);
450477
cy.get('#changeFieldSaveBtn').click();
451478
cy.wait(1000);
@@ -458,11 +485,14 @@ describe('Visual editor - Create eForm', () => {
458485

459486
// Save the eForm
460487
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
488+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
489+
cy.intercept('GET', '**/api/tags/index').as('getTags');
461490
cy.get('#saveCreateEformBtn').click();
462491
cy.wait('@saveeForm', { timeout: 60000 });
492+
cy.wait('@getTemplates', { timeout: 60000 });
493+
cy.wait('@getTags', { timeout: 60000 });
463494

464495
// Verify eForm structure when edited
465-
cy.get('#spinner-animation').should('not.exist');
466496
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
467497
cy.get('#edit-eform-btn-0').click();
468498
cy.wait('@geteForm', { timeout: 60000 });
@@ -506,11 +536,14 @@ describe('Visual editor - Create eForm', () => {
506536

507537
// Save the eForm
508538
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
539+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
540+
cy.intercept('GET', '**/api/tags/index').as('getTags');
509541
cy.get('#saveCreateEformBtn').click();
510542
cy.wait('@saveeForm', { timeout: 60000 });
543+
cy.wait('@getTemplates', { timeout: 60000 });
544+
cy.wait('@getTags', { timeout: 60000 });
511545

512546
// Verify eForm structure when edited
513-
cy.get('#spinner-animation').should('not.exist');
514547
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
515548
cy.get('#edit-eform-btn-0').click();
516549
cy.wait('@geteForm', { timeout: 60000 });
@@ -554,8 +587,12 @@ describe('Visual editor - Create eForm', () => {
554587

555588
// Save the eForm
556589
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
590+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
591+
cy.intercept('GET', '**/api/tags/index').as('getTags');
557592
cy.get('#saveCreateEformBtn').click();
558593
cy.wait('@saveeForm', { timeout: 60000 });
594+
cy.wait('@getTemplates', { timeout: 60000 });
595+
cy.wait('@getTags', { timeout: 60000 });
559596

560597
// Verify field order when edited
561598
// cy.get('#spinner-animation').should('not.exist');
@@ -611,8 +648,12 @@ describe('Visual editor - Create eForm', () => {
611648

612649
// Save the eForm
613650
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
651+
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
652+
cy.intercept('GET', '**/api/tags/index').as('getTags');
614653
cy.get('#saveCreateEformBtn').click();
615654
cy.wait('@saveeForm', { timeout: 60000 });
655+
cy.wait('@getTemplates', { timeout: 60000 });
656+
cy.wait('@getTags', { timeout: 60000 });
616657

617658
// Verify nested field order when edited
618659
// cy.get('#spinner-animation').should('not.exist');
@@ -686,7 +727,6 @@ describe('Visual editor - Create eForm', () => {
686727
cy.wait('@createTemplate', { timeout: 60000 });
687728

688729
// Open in visual editor
689-
cy.get('#spinner-animation').should('not.exist');
690730
cy.intercept('GET', '**/api/template-visual-editor/**').as('geteForm');
691731
cy.get('#edit-eform-btn-0').click();
692732
cy.wait('@geteForm', { timeout: 60000 });

eform-client/src/app/modules/eforms/eform-visual-editor/components/eform-visual-editor-elements/field/visual-editor-field-modal/visual-editor-field-modal.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ <h3 mat-dialog-title>{{ (isFieldSelected ? 'Edit field' : 'New field') | transla
8585
/>
8686
</mat-form-field>
8787
<formatting-text-editor
88+
contenteditable="true"
8889
[(value)]="translation.description"
8990
[placeholder]="'Description' | translate"
9091
id="newFieldDescriptionTranslation_{{ translationIndex }}"

eform-client/src/app/modules/eforms/eform-visual-editor/components/eform-visual-editor-page/eform-visual-editor-header/eform-visual-editor-header.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ <h4>
4545
/>
4646
</mat-form-field>
4747
<formatting-text-editor
48+
contenteditable="true"
4849
[(value)]="translation.description"
4950
[placeholder]="'Description' | translate"
5051
id="mainCheckListDescriptionTranslation_{{ translation.languageId }}"

0 commit comments

Comments
 (0)