|
|
@@ -11,7 +11,7 @@ context('Data Field Input Validation in New Form', () => { |
|
|
|
|
|
|
|
function validateField(fieldname, invalid_value, valid_value) { |
|
|
|
// Invalid, should have has-error class |
|
|
|
cy.get_field(fieldname).type(invalid_value).blur(); |
|
|
|
cy.get_field(fieldname).clear().type(invalid_value).blur(); |
|
|
|
cy.get(`.frappe-control[data-fieldname="${fieldname}"]`).should('have.class', 'has-error'); |
|
|
|
// Valid value, should not have has-error class |
|
|
|
cy.get_field(fieldname).clear().type(valid_value); |
|
|
@@ -26,6 +26,10 @@ context('Data Field Input Validation in New Form', () => { |
|
|
|
|
|
|
|
it('should validate URL', () => { |
|
|
|
validateField('url', 'jkl', 'https://frappe.io'); |
|
|
|
validateField('url', 'abcd.com', 'http://google.com/home'); |
|
|
|
validateField('url', '&&http://google.uae', 'gopher://frappe.io'); |
|
|
|
validateField('url', 'ftt2:://google.in?q=news', 'ftps2://frappe.io/__/#home'); |
|
|
|
validateField('url', 'ftt2://', 'ntps://localhost'); // For intranet URLs |
|
|
|
}); |
|
|
|
|
|
|
|
it('should validate phone number', () => { |
|
|
|