mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
add registration steps
This commit is contained in:
69
src/Core/API/API.Specs/Features/Registration.feature
Normal file
69
src/Core/API/API.Specs/Features/Registration.feature
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
Feature: User Registration
|
||||||
|
As a new user
|
||||||
|
I want to register an account
|
||||||
|
So that I can log in and access authenticated routes
|
||||||
|
|
||||||
|
Scenario: Successful registration with valid details
|
||||||
|
Given the API is running
|
||||||
|
When I submit a registration request with values:
|
||||||
|
| Username | FirstName | LastName | Email | DateOfBirth | Password |
|
||||||
|
| newuser | New | User | newuser@example.com | 1990-01-01 | Password1! |
|
||||||
|
Then the response has HTTP status 201
|
||||||
|
And the response JSON should have "message" equal "User registered successfully."
|
||||||
|
And the response JSON should have an access token
|
||||||
|
|
||||||
|
Scenario: Registration fails with existing username
|
||||||
|
Given the API is running
|
||||||
|
And I have an existing account with username "existinguser"
|
||||||
|
When I submit a registration request with values:
|
||||||
|
| Username | FirstName | LastName | Email | DateOfBirth | Password |
|
||||||
|
| existinguser | Existing | User | existing@example.com | 1990-01-01 | Password1! |
|
||||||
|
Then the response has HTTP status 409
|
||||||
|
And the response JSON should have "message" equal "Username already exists."
|
||||||
|
|
||||||
|
Scenario: Registration fails with existing email
|
||||||
|
Given the API is running
|
||||||
|
And I have an existing account with email "existing@example.com"
|
||||||
|
When I submit a registration request with values:
|
||||||
|
| Username | FirstName | LastName | Email | DateOfBirth | Password |
|
||||||
|
| newuser | New | User | existing@example.com | 1990-01-01 | Password1! |
|
||||||
|
Then the response has HTTP status 409
|
||||||
|
And the response JSON should have "message" equal "Email already in use."
|
||||||
|
|
||||||
|
Scenario: Registration fails with missing required fields
|
||||||
|
Given the API is running
|
||||||
|
When I submit a registration request with values:
|
||||||
|
| Username | FirstName | LastName | Email | DateOfBirth | Password |
|
||||||
|
| | New | User | | | Password1! |
|
||||||
|
Then the response has HTTP status 400
|
||||||
|
And the response JSON should have "message" equal "Username is required."
|
||||||
|
|
||||||
|
Scenario: Registration fails with invalid email format
|
||||||
|
Given the API is running
|
||||||
|
When I submit a registration request with values:
|
||||||
|
| Username | FirstName | LastName | Email | DateOfBirth | Password |
|
||||||
|
| newuser | New | User | invalidemail | 1990-01-01 | Password1! |
|
||||||
|
Then the response has HTTP status 400
|
||||||
|
And the response JSON should have "message" equal "Invalid email format."
|
||||||
|
|
||||||
|
Scenario: Registration fails with weak password
|
||||||
|
Given the API is running
|
||||||
|
When I submit a registration request with values:
|
||||||
|
| Username | FirstName | LastName | Email | DateOfBirth | Password |
|
||||||
|
| newuser | New | User | newuser@example.com | 1990-01-01 | weakpass |
|
||||||
|
Then the response has HTTP status 400
|
||||||
|
And the response JSON should have "message" equal "Password does not meet complexity requirements."
|
||||||
|
|
||||||
|
Scenario: Cannot register a user younger than 19 years of age (regulatory requirement)
|
||||||
|
Given the API is running
|
||||||
|
When I submit a registration request with values:
|
||||||
|
| Username | FirstName | LastName | Email | DateOfBirth | Password |
|
||||||
|
| younguser | Young | User | younguser@example.com | | Password1! |
|
||||||
|
Then the response has HTTP status 400
|
||||||
|
And the response JSON should have "message" equal "You must be at least 19 years old to register."
|
||||||
|
|
||||||
|
Scenario: Registration endpoint only accepts POST requests
|
||||||
|
Given the API is running
|
||||||
|
When I submit a registration request using a GET request
|
||||||
|
Then the response has HTTP status 404
|
||||||
|
And the response JSON should have "message" equal "Not Found."
|
||||||
Reference in New Issue
Block a user