From fb593bebe1247f8a2a42d5a37ac161d4d0634632 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Wed, 3 Mar 2021 10:54:17 -0500 Subject: [PATCH] chore: Revert submit validation (#15302) --- packages/driver/cypress/fixtures/dom.html | 21 ------------------- .../commands/actions/submit_spec.js | 15 ------------- .../driver/src/cy/commands/actions/submit.js | 20 ------------------ packages/driver/src/cypress/error_messages.js | 8 +------ 4 files changed, 1 insertion(+), 63 deletions(-) diff --git a/packages/driver/cypress/fixtures/dom.html b/packages/driver/cypress/fixtures/dom.html index 7061e6b30c06..be04e3cbccbc 100644 --- a/packages/driver/cypress/fixtures/dom.html +++ b/packages/driver/cypress/fixtures/dom.html @@ -654,27 +654,6 @@ Cross domain iframe:
- -
-
- - -
- -
- - -
- - -
diff --git a/packages/driver/cypress/integration/commands/actions/submit_spec.js b/packages/driver/cypress/integration/commands/actions/submit_spec.js index 8b1d74008560..d379edbeb8d5 100644 --- a/packages/driver/cypress/integration/commands/actions/submit_spec.js +++ b/packages/driver/cypress/integration/commands/actions/submit_spec.js @@ -335,21 +335,6 @@ describe('src/cy/commands/actions/submit', () => { cy.get('form:first').submit().should('have.class', 'submitted') }) - - // https://github.com/cypress-io/cypress/issues/14911 - it('should throw an error when form validation failed', function (done) { - cy.on('fail', (err) => { - expect(err.message).to.include('2 inputs') - expect(err.message).to.include('Please fill out this field.') - - done() - }) - - cy.get('#form-validation').within(() => { - cy.get('input[type=submit]').click() - cy.root().submit() - }) - }) }) describe('.log', () => { diff --git a/packages/driver/src/cy/commands/actions/submit.js b/packages/driver/src/cy/commands/actions/submit.js index ed7199ef3e9a..70c67bf702a0 100644 --- a/packages/driver/src/cy/commands/actions/submit.js +++ b/packages/driver/src/cy/commands/actions/submit.js @@ -54,26 +54,6 @@ module.exports = (Commands, Cypress, cy) => { }) } - // Validate form. - // @see https://github.com/cypress-io/cypress/issues/14911 - if (!form.checkValidity()) { - const elements = form.querySelectorAll(':invalid') - const failures = _.map(elements, (el) => { - const element = $dom.stringify(el) - const message = el.validationMessage - - return ` - \`${element}\`: ${message}` - }) - - $errUtils.throwErrByPath('submit.failed_validation', { - onFail: options._log, - args: { - failures: failures.join('\n'), - suffix: failures.length ? `${failures.length} inputs` : 'input', - }, - }) - } - // calling the native submit method will not actually trigger // a submit event, so we need to dispatch this manually so // native event listeners and jquery can bind to it diff --git a/packages/driver/src/cypress/error_messages.js b/packages/driver/src/cypress/error_messages.js index 2094eee4468f..57544db340f4 100644 --- a/packages/driver/src/cypress/error_messages.js +++ b/packages/driver/src/cypress/error_messages.js @@ -911,7 +911,7 @@ module.exports = { reached_redirection_limit ({ href, limit }) { return stripIndent`\ The application redirected to \`${href}\` more than ${limit} times. Please check if it's an intended behavior. - + If so, increase \`redirectionLimit\` value in configuration.` }, }, @@ -1542,12 +1542,6 @@ module.exports = { message: `${cmd('submit')} can only be called on a \`
\`. Your subject {{word}} a: \`{{node}}\``, docsUrl: 'https://on.cypress.io/submit', }, - failed_validation: { - message: stripIndent`\ - Form validation failed for the following {{suffix}}: - {{failures}}`, - docsUrl: 'https://on.cypress.io/submit', - }, }, task: {