Feature: Account creation and login As a new user I want to create a profile and log in So that I can access my household's batch-cooking planning Scenario: A visitor creates a new profile When I sign up with the following details: | firstName | Alice | | lastName | Martin | | email | alice@example.com | | password | correct-horse-battery-staple | Then the response status should be 201 And I am authenticated as "alice@example.com" Scenario: A visitor cannot sign up twice with the same email Given a profile already exists with email "alice@example.com" When I sign up with the following details: | firstName | Alice | | lastName | Martin | | email | alice@example.com | | password | correct-horse-battery-staple | Then the response status should be 409 And the response error code should be "EMAIL_ALREADY_IN_USE" Scenario: A registered user logs in with correct credentials Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple" When I log in with email "alice@example.com" and password "correct-horse-battery-staple" Then the response status should be 200 And I am authenticated as "alice@example.com" Scenario: A registered user cannot log in with the wrong password Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple" When I log in with email "alice@example.com" and password "wrong-password" Then the response status should be 401 And the response error code should be "INVALID_CREDENTIALS" Scenario: A signed-in user cannot delete their account with the wrong password Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple" And I log in with email "alice@example.com" and password "correct-horse-battery-staple" When I delete my account with password "wrong-password" Then the response status should be 401 And the response error code should be "INVALID_CREDENTIALS" And I am authenticated as "alice@example.com" Scenario: A signed-in user deletes their account Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple" And I log in with email "alice@example.com" and password "correct-horse-battery-staple" When I delete my account with password "correct-horse-battery-staple" Then the response status should be 204 And I am no longer authenticated