Skip to content

Bugfix Ticket #1041 & #1039 Validations inside a loop (for 4.1)#1070

Merged
caleeli merged 13 commits into4.1-developfrom
bugfix/ticket-1039-4.1
Oct 11, 2021
Merged

Bugfix Ticket #1041 & #1039 Validations inside a loop (for 4.1)#1070
caleeli merged 13 commits into4.1-developfrom
bugfix/ticket-1039-4.1

Conversation

@eiresendez
Copy link
Copy Markdown
Contributor

Problem:

Tickets:

Changes:

  • Code changes to fix required fields in loops.

@caleeli caleeli self-requested a review October 7, 2021 22:05
Copy link
Copy Markdown
Collaborator

@caleeli caleeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the test Verify validation rules with hidden fields in nested screen before submit:
The fields in the loop should be required.
image


function shouldHaveValidationErrors()
{
cy.get('[data-cy=preview-content] [data-cy="screen-field-submit"]')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cy.get('[data-cy=preview-content] [data-cy="screen-field-submit"]')
cy.get('#preview .form-group.form-group--error:visible')

function shouldHaveValidationErrors()
{
cy.get('[data-cy=preview-content] [data-cy="screen-field-submit"]')
.should('contain.html', 'alert alert-danger');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.should('contain.html', 'alert alert-danger');
.should('have.length.greaterThan', 0);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the 4.1 version does not show the invalid fields, chance this test to check if the form has invalid fields


function submitForm()
{
cy.get('[data-cy=preview-content] [data-cy="screen-field-submit"]')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cy.get('[data-cy=preview-content] [data-cy="screen-field-submit"]')
cy.get('#preview .form-group.form-group--error:visible')

function submitForm()
{
cy.get('[data-cy=preview-content] [data-cy="screen-field-submit"]')
.should('not.contain.html', 'alert alert-danger');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.should('not.contain.html', 'alert alert-danger');
.should('have.length', 0);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the 4.1 version does not show the invalid fields, chance this test to check if the form has invalid fields

// Asynchronous loading of validations
const validations = {};
ValidationsFactory(definition, { screen: definition, firstPage }).addValidations(validations).then(() => {
ValidationsFactory(definition, { screen: definition, firstPage, data: this.vdata }).addValidations(validations).then(() => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ValidationsFactory(definition, { screen: definition, firstPage, data: this.vdata }).addValidations(validations).then(() => {
ValidationsFactory(definition, { screen: definition, firstPage, data: {_parent: this._parent, ...this.vdata} }).addValidations(validations).then(() => {

@caleeli caleeli self-requested a review October 11, 2021 14:33
@caleeli caleeli merged commit 0b7269b into 4.1-develop Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants