Skip to content

Commit

Permalink
feat: making role in organization as a required field (#26205)
Browse files Browse the repository at this point in the history
Co-authored-by: Your Name (aider) <[email protected]>
  • Loading branch information
surbhi-posthog and Your Name (aider) authored Nov 15, 2024
1 parent fb4c5b6 commit 2b2e7e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions cypress/e2e/signup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ describe('Signup', () => {
cy.get('[data-attr=password]').type(VALID_PASSWORD).should('have.value', VALID_PASSWORD)
cy.get('[data-attr=signup-start]').click()
cy.get('[data-attr=signup-name]').type('Alice Bob').should('have.value', 'Alice Bob')
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) => {
Expand All @@ -93,6 +96,9 @@ describe('Signup', () => {
cy.get('[data-attr=password]').type(VALID_PASSWORD).should('have.value', VALID_PASSWORD)
cy.get('[data-attr=signup-start]').click()
cy.get('[data-attr=signup-name]').type('Alice Bob').should('have.value', 'Alice Bob')
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(() => {
Expand All @@ -105,6 +111,9 @@ describe('Signup', () => {
const newEmail = `new_user+${Math.floor(Math.random() * 10000)}@posthog.com`
cy.get('[data-attr=signup-email]').clear().type(newEmail).should('have.value', newEmail)
cy.get('[data-attr=signup-start]').click()
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) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/SignupRoleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LemonSelect } from 'lib/lemon-ui/LemonSelect'

export default function SignupRoleSelect({ className }: { className?: string }): JSX.Element {
return (
<LemonField name="role_at_organization" label="What is your role?" className={className} showOptional>
<LemonField name="role_at_organization" label="What is your role?" className={className}>
<LemonSelect
fullWidth
data-attr="signup-role-at-organization"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ export const signupLogic = kea<signupLogicType>([
role_at_organization: '',
referral_source: '',
} as SignupForm,
errors: ({ name }) => ({
errors: ({ name, role_at_organization }) => ({
name: !name ? 'Please enter your name' : undefined,
role_at_organization: !role_at_organization ? 'Please select your role in the organization' : undefined,
}),
submit: async (payload, breakpoint) => {
breakpoint()
Expand Down

0 comments on commit 2b2e7e4

Please sign in to comment.