Skip to content

Commit f1d0192

Browse files
committed
Fixing more tests.
1 parent 79e7431 commit f1d0192

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ describe('Visual editor - Create eForm', () => {
194194

195195
cy.get('#fieldSection0').should('exist');
196196
cy.get('#fieldSection0').should('contain', fieldName);
197-
// Verify color by checking the field has the red color class or styling
198-
// cy.get('#fieldSection0 .field-color-red').should('exist');
199-
// check the style attribyte for background-color to be background-color: rgb(255, 228, 228);
200197
cy.get('#fieldSection0 > div > div').should('have.attr', 'style').and('include', 'background-color: rgb(255, 228, 228)');
201198
});
202199

@@ -224,7 +221,7 @@ describe('Visual editor - Create eForm', () => {
224221
// Set number field properties
225222
cy.get('#minValueEdit').clear().type(minValue.toString());
226223
cy.get('#maxValueEdit').clear().type(maxValue.toString());
227-
cy.get('#defaultValueEdit').clear().type(defaultValue.toString());
224+
cy.get('#defaultValueEdit0').clear().type(defaultValue.toString());
228225
cy.get('#decimalCountEdit').clear().type(decimalCount.toString());
229226

230227
cy.get('#changeFieldSaveBtn').click();
@@ -320,11 +317,11 @@ describe('Visual editor - Create eForm', () => {
320317
cy.wait(1000);
321318

322319
// Change nested field color to red by clicking the red color button (5th button, index 4)
323-
cy.get('#fields_0 #fieldSection0 #colors button').eq(4).click();
320+
cy.get('#nestedFields #fieldSection0 #colors button').eq(4).click();
324321
cy.wait(1000);
325322

326323
// Make a copy of the nested field
327-
cy.get('#fields_0 #fieldSection0 #copyBtn').click();
324+
cy.get('#nestedFields #fieldSection0 #copyBtn').click();
328325
cy.wait(1000);
329326

330327
// Save the eForm
@@ -345,10 +342,10 @@ describe('Visual editor - Create eForm', () => {
345342
cy.get('#fieldSection0').should('contain', fieldGroupName);
346343

347344
// Verify both nested fields exist with red color
348-
cy.get('#fields_0 #fieldSection0').should('contain', nestedFieldName);
349-
cy.get('#fields_0 #fieldSection1').should('contain', nestedFieldName);
350-
cy.get('#fieldSection0 > div > div').should('have.attr', 'style').and('include', 'background-color: rgb(255, 228, 228)');
351-
cy.get('#fieldSection1 > div > div').should('have.attr', 'style').and('include', 'background-color: rgb(255, 228, 228)');
345+
cy.get('#nestedFields #fieldSection0').should('contain', nestedFieldName);
346+
cy.get('#nestedFields #fieldSection1').should('contain', nestedFieldName);
347+
cy.get('#nestedFields #fieldSection0 > div > div').should('have.attr', 'style').and('include', 'background-color: rgb(255, 228, 228)');
348+
cy.get('#nestedFields #fieldSection1 > div > div').should('have.attr', 'style').and('include', 'background-color: rgb(255, 228, 228)');
352349
});
353350

354351
it('should create visual template and delete field', () => {
@@ -380,17 +377,20 @@ describe('Visual editor - Create eForm', () => {
380377
cy.wait(1000);
381378

382379
// Change nested field color to red by clicking the red color button (5th button, index 4)
383-
cy.get('#fields_0 #fieldSection0 #colors button').eq(4).click();
380+
cy.get('#nestedFields #fieldSection0 #colors button').eq(4).click();
384381
cy.wait(1000);
385382

386383
// Make a copy of the nested field
387-
cy.get('#fields_0 #fieldSection0 #copyBtn').click();
384+
cy.get('#nestedFields #fieldSection0 #copyBtn').click();
388385
cy.wait(1000);
389386

390387
// Delete the field group
391-
cy.get('#fieldSection0 #deleteBtn').click();
388+
// await mainChecklist.fields[0].delete(); is the wdio way
389+
cy.get('#fieldSection0 #collapseToggleBtn').click();
390+
cy.wait(500);
391+
cy.get('#fieldSection0 #deleteBtn').first().click();
392392
cy.get('#fieldDeleteDeleteBtn').click();
393-
cy.wait(1000);
393+
cy.wait(500);
394394

395395
// Save the eForm
396396
cy.intercept('POST', '**/api/template-visual-editor/').as('saveeForm');
@@ -661,8 +661,8 @@ describe('Visual editor - Create eForm', () => {
661661
const eformName = generateRandmString();
662662

663663
// Create eForm from XML first (navigate to My eForms)
664-
cy.get('#cancelEditBtn').click();
665-
cy.wait(500);
664+
// cy.get('#cancelEditBtn').click();
665+
// cy.wait(500);
666666

667667
// Create eForm using XML
668668
const xmlContent = `<?xml version="1.0" encoding="UTF-8"?>

0 commit comments

Comments
 (0)