feat: seed existing user for e2e tests #969
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As mentioned in #955, I noticed the end-to-end tests do not have a way to test out flows for users that already exist. This is especially important for the end-to-end test when signup is disallowed. I wanted to be able to verify the flow for existing users.
This change will seed a user so we can verify the various flows for existing users in the end-to-end tests.
Implementation
Aside from migrations, there doesn't seem to be an existing solution to seed data into the databases. While I could've created a separate process within the hanko backend to handle seeding, since this behavior was not requested I decided to not add any functionality to the backend. Instead, I created a SQL script that will be executed by a seeder Docker container after the migrator container has added migrations. The script has constant values it will add into the database, including a user with the email
[email protected]
that will be used by the end-to-end tests.Tests
Added tests within the
nosignup
,pw
andnopw
tests to verify the flow of existing users and what the next screen they see would be after they login.Todos
N/A
Additional context
N/A