-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix errors with validation templates when no approver set #19194
base: main
Are you sure you want to change the base?
Fix errors with validation templates when no approver set #19194
Conversation
d03d101
to
088290a
Compare
cy.get('.timeline-buttons .main-actions button.dropdown-toggle-split').click(); | ||
cy.findByText('Ask for validation').click(); | ||
cy.get('.itilvalidation').within(() => { | ||
cy.getDropdownByLabelText('Template').selectDropdownValue(`test ${rand}`); | ||
cy.get('select[name="[validatortype]"]').should('have.value', 'User'); | ||
cy.get('select[name="items_id_target"]').should('have.value', '2'); | ||
cy.get('textarea[name="comment_submission"]').awaitTinyMCE().should('contain.text', 'test content'); | ||
}); | ||
cy.visit(`/front/ticket.form.php?id=${ticket_id}`); | ||
cy.get('.timeline-buttons .main-actions button.dropdown-toggle-split').click(); | ||
cy.findByText('Ask for validation').click(); | ||
cy.get('.itilvalidation').within(() => { | ||
cy.getDropdownByLabelText('Template').selectDropdownValue(`test no approver ${rand}`); | ||
cy.get('select[name="[validatortype]"]').should('have.value', '0'); | ||
cy.get('select[name="items_id_target"]').should('not.exist'); | ||
cy.get('textarea[name="comment_submission"]').awaitTinyMCE().should('contain.text', 'no approver test content'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use stronger selectors (accessibility based or with tests ids).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment textarea cannot use label selectors because the input the label applies to is hidden and TinyMCE doesn't handle fixing the label.
Selects cannot use label selectors because there is a single label for both fields and this is an issue globally for itemtype/item fields as far as I am aware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment textarea cannot use label selectors because the input the label applies to is hidden and TinyMCE doesn't handle fixing the label.
I think findByLabelText()
works for hidden items.
Selects cannot use label selectors because there is a single label for both fields and this is an issue globally for itemtype/item fields as far as I am aware.
We can add the required aria labels in the dropdown code so it can be fixed.
I think it is better to fix these missing labels when needed to prevent adding brittle tests.
Checklist before requesting a review
Description
Fixes #19170