diff --git a/cypress/e2e/signup.cy.ts b/cypress/e2e/signup.cy.ts index 4ef4036000378..8c660a69a93ff 100644 --- a/cypress/e2e/signup.cy.ts +++ b/cypress/e2e/signup.cy.ts @@ -12,7 +12,7 @@ describe('Signup', () => { cy.get('[data-attr=signup-email]').type('test@posthog.com').should('have.value', 'test@posthog.com') cy.get('[data-attr=password]').type('12345678').should('have.value', '12345678') cy.get('[data-attr=signup-start]').click() - cy.get('[data-attr=signup-first-name]').type('Jane').should('have.value', 'Jane') + cy.get('[data-attr=signup-name]').type('Jane Doe').should('have.value', 'Jane Doe') cy.get('[data-attr=signup-organization-name]').type('Hogflix Movies').should('have.value', 'Hogflix Movies') cy.get('[data-attr=signup-role-at-organization]').click() cy.get('.Popover li:first-child').click() @@ -39,18 +39,53 @@ describe('Signup', () => { cy.get('.text-danger').should('not.contain', 'Password must be at least 8 characters') // Validation error removed on keystroke }) - it('Can create user account', () => { + it('Can create user account with first name, last name and organization name', () => { + cy.intercept('POST', '/api/signup/').as('signupRequest') + const email = `new_user+${Math.floor(Math.random() * 10000)}@posthog.com` cy.get('[data-attr=signup-email]').type(email).should('have.value', email) cy.get('[data-attr=password]').type('12345678').should('have.value', '12345678') cy.get('[data-attr=signup-start]').click() - cy.get('[data-attr=signup-first-name]').type('Alice').should('have.value', 'Alice') + cy.get('[data-attr=signup-name]').type('Alice Bob').should('have.value', 'Alice Bob') cy.get('[data-attr=signup-organization-name]').type('Hogflix SpinOff').should('have.value', 'Hogflix SpinOff') cy.get('[data-attr=signup-role-at-organization]').click() cy.get('.Popover li:first-child').click() cy.get('[data-attr=signup-role-at-organization]').contains('Engineering') cy.get('[data-attr=signup-submit]').click() + cy.wait('@signupRequest').then((interception) => { + expect(interception.request.body).to.have.property('first_name') + expect(interception.request.body.first_name).to.equal('Alice') + expect(interception.request.body).to.have.property('last_name') + expect(interception.request.body.last_name).to.equal('Bob') + expect(interception.request.body).to.have.property('organization_name') + expect(interception.request.body.organization_name).to.equal('Hogflix SpinOff') + }) + + // lazy regex for a guid + cy.location('pathname').should('match', /\/verify_email\/[a-zA-Z0-9_.-]*/) + }) + + it('Can create user account with just a first name', () => { + cy.intercept('POST', '/api/signup/').as('signupRequest') + + const email = `new_user+${Math.floor(Math.random() * 10000)}@posthog.com` + cy.get('[data-attr=signup-email]').type(email).should('have.value', email) + cy.get('[data-attr=password]').type('12345678').should('have.value', '12345678') + cy.get('[data-attr=signup-start]').click() + cy.get('[data-attr=signup-name]').type('Alice').should('have.value', 'Alice') + cy.get('[data-attr=signup-role-at-organization]').click() + cy.get('.Popover li:first-child').click() + cy.get('[data-attr=signup-role-at-organization]').contains('Engineering') + cy.get('[data-attr=signup-submit]').click() + + cy.wait('@signupRequest').then((interception) => { + expect(interception.request.body).to.have.property('first_name') + expect(interception.request.body.first_name).to.equal('Alice') + expect(interception.request.body).to.not.have.property('last_name') + expect(interception.request.body).to.not.have.property('organization_name') + }) + // lazy regex for a guid cy.location('pathname').should('match', /\/verify_email\/[a-zA-Z0-9_.-]*/) }) @@ -74,7 +109,7 @@ describe('Signup', () => { cy.get('.Toastify [data-attr="error-toast"]').contains('Inactive social login session.') }) - it.only('Shows redirect notice if redirecting for maintenance', () => { + it('Shows redirect notice if redirecting for maintenance', () => { cy.intercept('**/decide/*', (req) => req.reply( decideResponse({ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-user--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-user--dark.png index f68ff84645860..651d180143e39 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-user--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-user--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-user--light.png b/frontend/__snapshots__/scenes-other-settings--settings-user--light.png index b4a80fca60fc9..807819111d701 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-user--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-user--light.png differ diff --git a/frontend/src/scenes/authentication/signup/signupForm/panels/SignupPanel2.tsx b/frontend/src/scenes/authentication/signup/signupForm/panels/SignupPanel2.tsx index 1952c156a8fa2..a79bac3b9b0df 100644 --- a/frontend/src/scenes/authentication/signup/signupForm/panels/SignupPanel2.tsx +++ b/frontend/src/scenes/authentication/signup/signupForm/panels/SignupPanel2.tsx @@ -17,10 +17,10 @@ export function SignupPanel2(): JSX.Element | null { return (