docbrown/cypress/e2e/seededFlows/registrationFlows/emailRegistration.spec.js
dependabot[bot] deb86efb0d
Bump cypress and @knapsack-pro/cypress (#18025)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-06 17:53:13 -04:00

27 lines
1.1 KiB
JavaScript

describe('Sign up with email', () => {
beforeEach(() => {
cy.testSetup();
cy.visit('/enter?state=new-user');
});
// Regression test for #11099
it('should preserve the form data on unsuccessful submissions', () => {
cy.findByRole('link', { name: /Sign up with Email/ }).click();
cy.findByLabelText('Profile image').attachFile('images/admin-image.png');
cy.findByLabelText('Name *').type('Sloan');
cy.findByLabelText('Username *').type('s');
cy.findByLabelText('Email *').type('sloan@example.com');
cy.findByLabelText('Password *').type('password');
cy.findByLabelText('Password Confirmation *').type('password');
cy.findByRole('button', { name: 'Sign up' }).click();
// The validation failed but the user's data is not lost
cy.get('li')
.contains('Username is too short (minimum is 2 characters)')
.should('be.visible');
cy.findByLabelText('Name *').should('have.value', 'Sloan');
cy.findByLabelText('Username *').should('have.value', 's');
cy.findByLabelText('Email *').should('have.value', 'sloan@example.com');
});
});